Skip to content

Commit b172038

Browse files
authored
Merge pull request #35251 from dotnet/main
2 parents 79e60de + 966a1e6 commit b172038

10 files changed

Lines changed: 624 additions & 65 deletions

File tree

aspnetcore/blazor/fundamentals/startup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ In a component that adopts Interactive WebAssembly rendering, wrap the component
678678

679679
#### Global Interactive WebAssembly rendering with prerendering
680680

681-
*This scenario applies to global Interactive WebAssembly rendering without prerendering (`@rendermode="InteractiveWebAssembly"` on the `HeadOutlet` and `Routes` components in the `App` component).*
681+
*This scenario applies to global Interactive WebAssembly rendering with prerendering (`@rendermode="InteractiveWebAssembly"` on the `HeadOutlet` and `Routes` components in the `App` component).*
682682

683683
Create a `ContentLoading` component in the `Layout` folder of the `.Client` app that calls <xref:Microsoft.AspNetCore.Components.RendererInfo.IsInteractive?displayProperty=nameWithType>:
684684

aspnetcore/blazor/security/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ Two additional abstractions participate in managing authentication state:
535535

536536
* <xref:Microsoft.AspNetCore.Components.Server.RevalidatingServerAuthenticationStateProvider> ([reference source](https://github.com/dotnet/aspnetcore/blob/main/src/Components/Server/src/Circuits/RevalidatingServerAuthenticationStateProvider.cs)): A base class for <xref:Microsoft.AspNetCore.Components.Authorization.AuthenticationStateProvider> services used by the Blazor framework to receive an authentication state from the host environment and revalidate it at regular intervals.
537537

538-
The default 30 minute revalidation interval can be adjusted in [`RevalidatingIdentityAuthenticationStateProvider` (`Areas/Identity/RevalidatingIdentityAuthenticationStateProvider.cs`)](https://github.com/dotnet/aspnetcore/blob/release/7.0/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Areas/Identity/RevalidatingIdentityAuthenticationStateProvider.cs). The following example shortens the interval to 20 minutes:
538+
The default 30 minute revalidation interval can be adjusted in [`RevalidatingIdentityAuthenticationStateProvider` (reference source)](https://github.com/dotnet/aspnetcore/blob/v7.0.0/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp/Areas/Identity/RevalidatingIdentityAuthenticationStateProvider.cs#L26). The following example shortens the interval to 20 minutes:
539539

540540
```csharp
541541
protected override TimeSpan RevalidationInterval => TimeSpan.FromMinutes(20);

aspnetcore/fundamentals/openapi/aspnetcore-openapi.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,11 @@ The OpenAPI document is regenerated every time a request to the OpenAPI endpoint
150150

151151
## Generate multiple OpenAPI documents
152152

153-
In some scenarios, it's helpful to generate multiple OpenAPI documents with different content from a single ASP.NET Core API app. These scenarios include:
153+
In some scenarios, it's helpful to generate multiple OpenAPI documents with different content from a single ASP.NET Core API app. These scenarios include generating OpenAPI documentation for different:
154154

155-
* Generating OpenAPI documentation for different audiences, such as public and internal APIs.
156-
* Generating OpenAPI documentation for different versions of an API.
157-
* Generating OpenAPI documentation for different parts of an app, such as a frontend and backend API.
155+
* Audiences, such as public and internal APIs.
156+
* Versions of an API.
157+
* Parts of an app, such as a frontend and backend API.
158158

159159
To generate multiple OpenAPI documents, call the <xref:Microsoft.Extensions.DependencyInjection.OpenApiServiceCollectionExtensions.AddOpenApi%2A> extension method once for each document, specifying a different document name in the first parameter each time.
160160

aspnetcore/fundamentals/openapi/include-metadata.md

Lines changed: 9 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ uid: fundamentals/openapi/include-metadata
1212

1313
## Include OpenAPI metadata for endpoints
1414

15+
:::moniker range=">= aspnetcore-10.0"
16+
1517
ASP.NET collects metadata from the web app's endpoints and uses it to generate an OpenAPI document.
1618
In controller-based apps, metadata is collected from attributes like [`[EndpointDescription]`](xref:Microsoft.AspNetCore.Http.EndpointDescriptionAttribute), [`[HttpPost]`](xref:Microsoft.AspNetCore.Mvc.HttpPostAttribute),
1719
and [`[Produces]`](xref:Microsoft.AspNetCore.Mvc.ProducesAttribute).
@@ -31,7 +33,7 @@ The following table provides an overview of the metadata collected and the strat
3133
| responses | [`[Produces]`](xref:Microsoft.AspNetCore.Mvc.ProducesAttribute) | <xref:Microsoft.AspNetCore.Http.OpenApiRouteHandlerBuilderExtensions.Produces%2A>, <xref:Microsoft.AspNetCore.Http.OpenApiRouteHandlerBuilderExtensions.ProducesProblem%2A> | <xref:Microsoft.AspNetCore.Http.TypedResults> |
3234
| Excluding endpoints | [`[ExcludeFromDescription]`](xref:Microsoft.AspNetCore.Routing.ExcludeFromDescriptionAttribute), [`[ApiExplorerSettings]`](xref:Microsoft.AspNetCore.Mvc.ApiExplorerSettingsAttribute) | <xref:Microsoft.AspNetCore.Http.OpenApiRouteHandlerBuilderExtensions.ExcludeFromDescription%2A> | |
3335

34-
ASP.NET Core does not collect metadata from XML doc comments.
36+
ASP.NET Core can also collect metadata from XML doc comments. For more information, see <xref:fundamentals/openapi/aspnet-openapi-xml> for more details.
3537

3638
The following sections demonstrate how to include metadata in an app to customize the generated OpenAPI document.
3739

@@ -314,8 +316,6 @@ app.MapGet("/todos",
314316
async (TodoDb db) => await db.Todos.ToListAsync());
315317
```
316318

317-
:::moniker range=">= aspnetcore-10.0"
318-
319319
[`[ProducesResponseType]`](xref:Microsoft.AspNetCore.Mvc.ProducesResponseTypeAttribute), [`[Produces]`](xref:Microsoft.AspNetCore.Mvc.ProducesAttribute), and [`[ProducesDefaultResponseType]`](xref:Microsoft.AspNetCore.Mvc.ProducesResponseTypeAttribute) also support an optional string property called `Description` that can be used to describe the response. This is useful for explaining why or when clients can expect a specific response:
320320

321321
```csharp
@@ -327,8 +327,6 @@ app.MapGet("/todos/{id}",
327327
async (int id, TodoDb db) => /* Code here */);
328328
```
329329

330-
:::moniker-end
331-
332330
Using <xref:Microsoft.AspNetCore.Http.TypedResults> in the implementation of an endpoint's route handler automatically includes the response type metadata for the endpoint. For example, the following code automatically annotates the endpoint with a response under the `200` status code with an `application/json` content type.
333331

334332
```csharp
@@ -398,8 +396,6 @@ Only one [`[Produces]`](xref:Microsoft.AspNetCore.Mvc.ProducesAttribute) or <xre
398396

399397
All of the above attributes can be applied to individual action methods or to the controller class where it applies to all action methods in the controller.
400398

401-
:::moniker range=">= aspnetcore-10.0"
402-
403399
[`[ProducesResponseType]`](xref:Microsoft.AspNetCore.Mvc.ProducesResponseTypeAttribute), [`[Produces]`](xref:Microsoft.AspNetCore.Mvc.ProducesAttribute), and [`[ProducesDefaultResponseType]`](xref:Microsoft.AspNetCore.Mvc.ProducesResponseTypeAttribute) also support an optional string property called `Description` that can be used to describe the response. This is useful for explaining why or when clients can expect a specific response:
404400

405401
```csharp
@@ -412,8 +408,6 @@ All of the above attributes can be applied to individual action methods or to th
412408
public async Task<ActionResult<Todo>> GetTodoItem(string id, Todo todo)
413409
```
414410

415-
:::moniker-end
416-
417411
When not specified by an attribute:
418412

419413
* The status code for the response defaults to 200.
@@ -493,39 +487,6 @@ of the property in the schema.
493487

494488
### type and format
495489

496-
:::moniker range="< aspnetcore-10.0"
497-
498-
The JSON Schema library maps standard C# types to OpenAPI `type` and `format` as follows:
499-
500-
| C# Type | OpenAPI `type` | OpenAPI `format` |
501-
| -------------- | -------------- | ---------------- |
502-
| int | integer | int32 |
503-
| long | integer | int64 |
504-
| short | integer | int16 |
505-
| byte | integer | uint8 |
506-
| float | number | float |
507-
| double | number | double |
508-
| decimal | number | double |
509-
| bool | boolean | |
510-
| string | string | |
511-
| char | string | char |
512-
| byte[] | string | byte |
513-
| DateTimeOffset | string | date-time |
514-
| DateOnly | string | date |
515-
| TimeOnly | string | time |
516-
| Uri | string | uri |
517-
| Guid | string | uuid |
518-
| object | _omitted_ | |
519-
| dynamic | _omitted_ | |
520-
521-
Note that object and dynamic types have _no_ type defined in the OpenAPI because these can contain data of any type, including primitive types like int or string.
522-
523-
The `type` and `format` can also be set with a [Schema Transformer](xref:fundamentals/openapi/customize-openapi#use-schema-transformers). For example, you may want the `format` of decimal types to be `decimal` instead of `double`.
524-
525-
:::moniker-end
526-
527-
:::moniker range=">= aspnetcore-10.0"
528-
529490
#### Numeric types
530491

531492
The JSON Schema library maps standard C# numeric types to OpenAPI `type` and `format` based on the
@@ -593,8 +554,6 @@ Other C# types are represented in the generated OpenAPI document as shown in the
593554
| object | _omitted_ | |
594555
| dynamic | _omitted_ | |
595556

596-
:::moniker-end
597-
598557
### Use attributes to add metadata
599558

600559
ASP.NET uses metadata from attributes on class or record properties to set metadata on the corresponding properties of the generated schema.
@@ -675,13 +634,6 @@ An enum type without a [`[JsonConverter]`](xref:System.Text.Json.Serialization.
675634

676635
#### nullable
677636

678-
:::moniker range="< aspnetcore-10.0"
679-
680-
Properties defined as a nullable value or reference type have `nullable: true` in the generated schema. This is consistent with the default behavior of the <xref:System.Text.Json> deserializer, which accepts `null` as a valid value for a nullable property.
681-
682-
:::moniker-end
683-
:::moniker range=">= aspnetcore-10.0"
684-
685637
Properties defined as a nullable value or reference type appear in the generated schema with a `type` keyword whose value is an array that includes `null` as one of the types. This is consistent with the default behavior of the <xref:System.Text.Json> deserializer, which accepts `null` as a valid value for a nullable property.
686638

687639
For example, a C# property defined as `string?` is represented in the generated schema as:
@@ -698,8 +650,6 @@ For example, a C# property defined as `string?` is represented in the generated
698650

699651
If the app is configured to produce OpenAPI v3.0 or OpenAPI v2 documents, nullable value or reference types have `nullable: true` in the generated schema because these OpenAPI versions do not allow the `type` field to be an array.
700652

701-
:::moniker-end
702-
703653
#### additionalProperties
704654

705655
Schemas are generated without an `additionalProperties` assertion by default, which implies the default of `true`. This is consistent with the default behavior of the <xref:System.Text.Json> deserializer, which silently ignores additional properties in a JSON object.
@@ -722,3 +672,9 @@ A schema transformer can be used to override any default metadata or add additio
722672

723673
* <xref:fundamentals/openapi/using-openapi-documents>
724674
* [OpenAPI specification](https://spec.openapis.org/oas/v3.0.3)
675+
676+
:::moniker-end
677+
678+
[!INCLUDE[](~/fundamentals/openapi/includes/include-metadata9.md)]
679+
680+
:::moniker-end

0 commit comments

Comments
 (0)