Skip to content

Commit 0f130fc

Browse files
committed
Fix references to sample app
1 parent 2f05a5a commit 0f130fc

File tree

4 files changed

+26
-26
lines changed

4 files changed

+26
-26
lines changed

aspnetcore/fundamentals/minimal-apis/responses.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Minimal endpoints support the following types of return values:
2828

2929
Consider the following route handler, which returns a `Hello world` text.
3030

31-
:::code language="csharp" source="~/fundamentals/minimal-apis/9.0-samples/Snippets/Program.cs" id="snippet_01":::
31+
:::code language="csharp" source="~/fundamentals/openapi/samples/9.x/Snippets/Program.cs" id="snippet_01":::
3232

3333
The `200` status code is returned with `text/plain` Content-Type header and the following content.
3434

@@ -44,7 +44,7 @@ Hello World
4444

4545
Consider the following route handler, which returns an anonymous type containing a `Message` string property.
4646

47-
:::code language="csharp" source="~/fundamentals/minimal-apis/9.0-samples/Snippets/Program.cs" id="snippet_02":::
47+
:::code language="csharp" source="~/fundamentals/openapi/samples/9.x/Snippets/Program.cs" id="snippet_02":::
4848

4949
The `200` status code is returned with `application/json` Content-Type header and the following content.
5050

@@ -114,11 +114,11 @@ This has the added benefit of providing compile-time checking that a route handl
114114

115115
Consider the following endpoint, for which a `400 BadRequest` status code is returned when the `orderId` is greater than `999`. Otherwise, it produces a `200 OK` with the expected content.
116116

117-
:::code language="csharp" source="~/fundamentals/minimal-apis/9.0-samples/Snippets/Program.cs" id="snippet_03":::
117+
:::code language="csharp" source="~/fundamentals/openapi/samples/9.x/Snippets/Program.cs" id="snippet_03":::
118118

119119
In order to document this endpoint correctly the extension method `Produces` is called. However, since the `TypedResults` helper automatically includes the metadata for the endpoint, you can return the `Results<T1, Tn>` union type instead, as shown in the following code.
120120

121-
:::code language="csharp" source="~/fundamentals/minimal-apis/9.0-samples/Snippets/Program.cs" id="snippet_04":::
121+
:::code language="csharp" source="~/fundamentals/openapi/samples/9.x/Snippets/Program.cs" id="snippet_04":::
122122

123123
<a name="binr7"></a>
124124

@@ -130,25 +130,25 @@ The following sections demonstrate the usage of the common result helpers.
130130

131131
#### JSON
132132

133-
:::code language="csharp" source="~/fundamentals/minimal-apis/9.0-samples/Snippets/Program.cs" id="snippet_05":::
133+
:::code language="csharp" source="~/fundamentals/openapi/samples/9.x/Snippets/Program.cs" id="snippet_05":::
134134

135135
<xref:Microsoft.AspNetCore.Http.HttpResponseJsonExtensions.WriteAsJsonAsync%2A> is an alternative way to return JSON:
136136

137137
:::code language="csharp" source="~/fundamentals/minimal-apis/7.0-samples/WebMinJson/Program.cs" id="snippet_writeasjsonasync":::
138138

139139
#### Custom Status Code
140140

141-
:::code language="csharp" source="~/fundamentals/minimal-apis/9.0-samples/Snippets/Program.cs" id="snippet_06":::
141+
:::code language="csharp" source="~/fundamentals/openapi/samples/9.x/Snippets/Program.cs" id="snippet_06":::
142142

143143
#### Internal Server Error
144144

145-
:::code language="csharp" source="~/fundamentals/minimal-apis/9.0-samples/Snippets/Program.cs" id="snippet_07":::
145+
:::code language="csharp" source="~/fundamentals/openapi/samples/9.x/Snippets/Program.cs" id="snippet_07":::
146146

147147
The preceding example returns a 500 status code.
148148

149149
#### Text
150150

151-
:::code language="csharp" source="~/fundamentals/minimal-apis/9.0-samples/Snippets/Program.cs" id="snippet_08":::
151+
:::code language="csharp" source="~/fundamentals/openapi/samples/9.x/Snippets/Program.cs" id="snippet_08":::
152152

153153
<a name="stream7"></a>
154154

@@ -170,11 +170,11 @@ The following example streams a video from an Azure Blob:
170170

171171
#### Redirect
172172

173-
:::code language="csharp" source="~/fundamentals/minimal-apis/9.0-samples/Snippets/Program.cs" id="snippet_09":::
173+
:::code language="csharp" source="~/fundamentals/openapi/samples/9.x/Snippets/Program.cs" id="snippet_09":::
174174

175175
#### File
176176

177-
:::code language="csharp" source="~/fundamentals/minimal-apis/9.0-samples/Snippets/Program.cs" id="snippet_10":::
177+
:::code language="csharp" source="~/fundamentals/openapi/samples/9.x/Snippets/Program.cs" id="snippet_10":::
178178

179179
<a name="httpresultinterfaces7"></a>
180180

@@ -215,7 +215,7 @@ The `ProducesHtmlMetadata` is an implementation of <xref:Microsoft.AspNetCore.Ht
215215

216216
An alternative approach is using the <xref:Microsoft.AspNetCore.Mvc.ProducesAttribute?displayProperty=fullName> to describe the produced response. The following code changes the `PopulateMetadata` method to use `ProducesAttribute`.
217217

218-
:::code language="csharp" source="~/fundamentals/minimal-apis/9.0-samples/Snippets/Program.cs" id="snippet_11":::
218+
:::code language="csharp" source="~/fundamentals/openapi/samples/9.x/Snippets/Program.cs" id="snippet_11":::
219219

220220
## Configure JSON serialization options
221221

aspnetcore/fundamentals/openapi/aspnetcore-openapi.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ The following code:
6767
* Adds OpenAPI services.
6868
* Enables the endpoint for viewing the OpenAPI document in JSON format.
6969

70-
[!code-csharp[](~/fundamentals/minimal-apis/9.0-samples/WebMinOpenApi/Program.cs?name=snippet_first&highlight=3,7)]
70+
[!code-csharp[](~/fundamentals/openapi/samples/9.x/WebMinOpenApi/Program.cs?name=snippet_first&highlight=3,7)]
7171

7272
Launch the app and navigate to `https://localhost:<port>/openapi/v1.json` to view the generated OpenAPI document.
7373

@@ -649,13 +649,13 @@ Because the OpenAPI document is served via a route handler endpoint, any customi
649649
650650
The OpenAPI endpoint doesn't enable any authorization checks by default. However, authorization checks can be applied to the OpenAPI document. In the following code, access to the OpenAPI document is limited to those with the `tester` role:
651651
652-
[!code-csharp[](~/fundamentals/minimal-apis/9.0-samples/WebMinOpenApi/Program.cs?name=snippet_mapopenapiwithauth)]
652+
[!code-csharp[](~/fundamentals/openapi/samples/9.x/WebMinOpenApi/Program.cs?name=snippet_mapopenapiwithauth)]
653653
654654
#### Cache generated OpenAPI document
655655
656656
The OpenAPI document is regenerated every time a request to the OpenAPI endpoint is sent. Regeneration enables transformers to incorporate dynamic application state into their operation. For example, regenerating a request with details of the HTTP context. When applicable, the OpenAPI document can be cached to avoid executing the document generation pipeline on each HTTP request.
657657
658-
[!code-csharp[](~/fundamentals/minimal-apis/9.0-samples/WebMinOpenApi/Program.cs?name=snippet_mapopenapiwithcaching)]
658+
[!code-csharp[](~/fundamentals/openapi/samples/9.x/WebMinOpenApi/Program.cs?name=snippet_mapopenapiwithcaching)]
659659
660660
<a name="transformers"></a>
661661
@@ -689,13 +689,13 @@ Transformers can be registered onto the document by calling the <xref:Microsoft.
689689
* Register a schema transformer using an instance of <xref:Microsoft.AspNetCore.OpenApi.IOpenApiSchemaTransformer>.
690690
* Register a schema transformer using a DI-activated <xref:Microsoft.AspNetCore.OpenApi.IOpenApiSchemaTransformer>.
691691
692-
[!code-csharp[](~/fundamentals/minimal-apis/9.0-samples/WebMinOpenApi/Program.cs?name=snippet_transUse&highlight=8-19)]
692+
[!code-csharp[](~/fundamentals/openapi/samples/9.x/WebMinOpenApi/Program.cs?name=snippet_transUse&highlight=8-19)]
693693
694694
### Execution order for transformers
695695
696696
Transformers execute in first-in first-out order based on registration. In the following snippet, the document transformer has access to the modifications made by the operation transformer:
697697
698-
[!code-csharp[](~/fundamentals/minimal-apis/9.0-samples/WebMinOpenApi/Program.cs?name=snippet_transInOut&highlight=3-9)]
698+
[!code-csharp[](~/fundamentals/openapi/samples/9.x/WebMinOpenApi/Program.cs?name=snippet_transInOut&highlight=3-9)]
699699
700700
### Use document transformers
701701
@@ -707,18 +707,18 @@ Document transformers have access to a context object that includes:
707707
708708
Document transformers can also mutate the OpenAPI document that is generated. The following example demonstrates a document transformer that adds some information about the API to the OpenAPI document.
709709
710-
[!code-csharp[](~/fundamentals/minimal-apis/9.0-samples/WebMinOpenApi/Program.cs?name=snippet_documenttransformer1)]
710+
[!code-csharp[](~/fundamentals/openapi/samples/9.x/WebMinOpenApi/Program.cs?name=snippet_documenttransformer1)]
711711
712712
Service-activated document transformers can utilize instances from DI to modify the app. The following sample demonstrates a document transformer that uses the <xref:Microsoft.AspNetCore.Authentication.IAuthenticationSchemeProvider> service from the authentication layer. It checks if any JWT bearer-related schemes are registered in the app and adds them to the OpenAPI document's top level:
713713
714-
[!code-csharp[](~/fundamentals/minimal-apis/9.0-samples/WebMinOpenApi/Program.cs?name=snippet_documenttransformer2)]
714+
[!code-csharp[](~/fundamentals/openapi/samples/9.x/WebMinOpenApi/Program.cs?name=snippet_documenttransformer2)]
715715
716716
Document transformers are unique to the document instance they're associated with. In the following example, a transformer:
717717
718718
* Registers authentication-related requirements to the `internal` document.
719719
* Leaves the `public` document unmodified.
720720
721-
[!code-csharp[](~/fundamentals/minimal-apis/9.0-samples/WebMinOpenApi/Program.cs?name=snippet_multidoc_operationtransformer1)]
721+
[!code-csharp[](~/fundamentals/openapi/samples/9.x/WebMinOpenApi/Program.cs?name=snippet_multidoc_operationtransformer1)]
722722
723723
### Use operation transformers
724724
@@ -735,7 +735,7 @@ Operation transformers have access to a context object which contains:
735735
736736
For example, the following operation transformer adds `500` as a response status code supported by all operations in the document.
737737
738-
[!code-csharp[](~/fundamentals/minimal-apis/9.0-samples/WebMinOpenApi/Program.cs?name=snippet_operationtransformer1)]
738+
[!code-csharp[](~/fundamentals/openapi/samples/9.x/WebMinOpenApi/Program.cs?name=snippet_operationtransformer1)]
739739
740740
### Use schema transformers
741741
@@ -752,7 +752,7 @@ Schema transformers have access to a context object which contains:
752752
753753
For example, the following schema transformer sets the `format` of decimal types to `decimal` instead of `double`:
754754
755-
[!code-csharp[](~/fundamentals/minimal-apis/9.0-samples/WebMinOpenApi/Program.cs?name=snippet_schematransformer1)]
755+
[!code-csharp[](~/fundamentals/openapi/samples/9.x/WebMinOpenApi/Program.cs?name=snippet_schematransformer1)]
756756
757757
## Additional resources
758758

aspnetcore/fundamentals/openapi/overview.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ ASP.NET Core apps provide built-in support for generating information about endp
2727

2828
The following code is generated by the ASP.NET Core minimal web API template and uses OpenAPI:
2929

30-
[!code-csharp[](~/fundamentals/minimal-apis/9.0-samples/WebMinOpenApi/Program.cs?name=snippet_default&highlight=5,9-12)]
30+
[!code-csharp[](~/fundamentals/openapi/samples/9.x/WebMinOpenApi/Program.cs?name=snippet_default&highlight=5,9-12)]
3131

3232
In the preceding highlighted code:
3333

@@ -45,7 +45,7 @@ The [`Microsoft.AspNetCore.OpenApi`](https://www.nuget.org/packages/Microsoft.As
4545

4646
To use the `Microsoft.AspNetCore.OpenApi` package, add it as a PackageReference to a project file:
4747

48-
[!code-xml[](~/fundamentals/minimal-apis/9.0-samples/WebMinOpenApi/projectFile.xml?highlight=15)]
48+
[!code-xml[](~/fundamentals/openapi/samples/9.x/WebMinOpenApi/projectFile.xml?highlight=15)]
4949

5050
To learn more about the `Microsoft.AspNetCore.OpenApi` package, see <xref:fundamentals/openapi/aspnetcore-openapi>.
5151

@@ -58,7 +58,7 @@ Document generation at build time is enabled by setting the `OpenApiGenerateDocu
5858
By default, the generated OpenAPI document is saved to the `obj` directory, but you can customize
5959
the output directory by setting the `OpenApiDocumentsDirectory` property.
6060

61-
[!code-xml[](~/fundamentals/minimal-apis/9.0-samples/WebMinOpenApi/projectFile.xml?highlight=9-12,16-19)]
61+
[!code-xml[](~/fundamentals/openapi/samples/9.x/WebMinOpenApi/projectFile.xml?highlight=9-12,16-19)]
6262

6363
## ASP.NET Core OpenAPI source code on GitHub
6464

aspnetcore/fundamentals/openapi/using-openapi-documents.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The `Swashbuckle.AspNetCore.SwaggerUi` package provides a bundle of Swagger UI's
2222
* Enable the swagger-ui middleware with a reference to the [OpenAPI route registered earlier](xref:fundamentals/openapi/aspnetcore-openapi#customize-the-openapi-endpoint-route).
2323
* To limit information disclosure and security vulnerability, ***only enable Swagger UI in development environments.***
2424

25-
[!code-csharp[](~/fundamentals/minimal-apis/9.0-samples/WebMinOpenApi/Program.cs?name=snippet_swaggerui)]
25+
[!code-csharp[](~/fundamentals/openapi/samples/9.x/WebMinOpenApi/Program.cs?name=snippet_swaggerui)]
2626

2727
## Use Scalar for interactive API documentation
2828

@@ -76,4 +76,4 @@ The output shows any issues with the OpenAPI document. For example:
7676
```
7777
:::moniker-end
7878

79-
[!INCLUDE[](~/fundamentals/openapi/includes/using-openapi-documents-6-8.md)]
79+
[!INCLUDE[](~/fundamentals/openapi/includes/using-openapi-documents-6-8.md)]

0 commit comments

Comments
 (0)