Skip to content

Commit 75921db

Browse files
Bump version to 10.2.0 (#3872)
- Bump version to 10.2.0. - Fix-up some formatting from #3822. - Add an extra integration test.
1 parent 1e43cbe commit 75921db

14 files changed

Lines changed: 751 additions & 33 deletions

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
3838
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
3939
<UseArtifactsOutput>true</UseArtifactsOutput>
40-
<VersionPrefix>10.1.8</VersionPrefix>
40+
<VersionPrefix>10.2.0</VersionPrefix>
4141
<WarnOnPackingNonPackableProject>false</WarnOnPackingNonPackableProject>
4242
</PropertyGroup>
4343
<PropertyGroup Condition=" '$(GITHUB_ACTIONS)' != '' AND '$(DEPENDABOT_JOB_ID)' == '' ">

docs/configure-and-customize-redoc.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,6 @@ app.UseReDoc(options =>
134134
> [!TIP]
135135
> To get started, you should base your custom `index.html` on the [default version](../src/Swashbuckle.AspNetCore.ReDoc/index.html).
136136
137-
[redoc-options]: https://github.com/Redocly/redoc/blob/main/docs/deployment/html.md#the-redoc-object
138-
139137
## Use `MapReDoc` with endpoint routing
140138

141139
`MapReDoc` is an endpoint-routing alternative to `UseReDoc`. The options API is the same, so all customization examples on this page also apply when using `MapReDoc`.
@@ -167,3 +165,5 @@ app.MapReDoc("redoc-auth")
167165
<sup><a href='/test/WebSites/WebApi.Map/Program.cs#L37-L40' title='Snippet source file'>snippet source</a> | <a href='#snippet-Redoc-MapReDoc-RequireAuthorization' title='Start of snippet'>anchor</a></sup>
168166
<!-- endSnippet -->
169167
<!-- markdownlint-enable MD031 MD033 -->
168+
169+
[redoc-options]: https://github.com/Redocly/redoc/blob/main/docs/deployment/html.md#the-redoc-object

docs/configure-and-customize-swaggerui.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,6 @@ app.UseSwaggerUI(options =>
243243
<!-- endSnippet -->
244244
<!-- markdownlint-enable MD031 MD033 -->
245245

246-
[swagger-ui]: https://github.com/swagger-api/swagger-ui
247-
248246
## Use `MapSwaggerUI` with endpoint routing
249247

250248
`MapSwaggerUI` is an endpoint-routing alternative to `UseSwaggerUI`. The options API is the same, so all customization examples on this page also apply when using `MapSwaggerUI`.
@@ -277,3 +275,5 @@ app.MapSwaggerUI("swagger-auth")
277275
<sup><a href='/test/WebSites/WebApi.Map/Program.cs#L26-L29' title='Snippet source file'>snippet source</a> | <a href='#snippet-SwaggerUI-MapSwaggerUI-RequireAuthorization' title='Start of snippet'>anchor</a></sup>
278276
<!-- endSnippet -->
279277
<!-- markdownlint-enable MD031 MD033 -->
278+
279+
[swagger-ui]: https://github.com/swagger-api/swagger-ui

src/Swashbuckle.AspNetCore.ReDoc/ReDocBuilderExtensions.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ public static class ReDocBuilderExtensions
1111
/// Register the Redoc middleware with provided options
1212
/// </summary>
1313
public static IApplicationBuilder UseReDoc(this IApplicationBuilder app, ReDocOptions options)
14-
{
15-
return app.UseMiddleware<ReDocMiddleware>(options);
16-
}
14+
=> app.UseMiddleware<ReDocMiddleware>(options);
1715

1816
/// <summary>
1917
/// Register the Redoc middleware with optional setup action for DI-injected options
@@ -23,6 +21,7 @@ public static IApplicationBuilder UseReDoc(
2321
Action<ReDocOptions> setupAction = null)
2422
{
2523
var options = ResolveOptions(app.ApplicationServices, setupAction);
24+
2625
EnsureDefaultSpecUrl(options);
2726

2827
return app.UseReDoc(options);
@@ -41,11 +40,12 @@ public static IEndpointConventionBuilder MapReDoc(
4140
Action<ReDocOptions> setupAction = null)
4241
{
4342
var options = ResolveOptions(endpoints.ServiceProvider, setupAction);
44-
45-
if (routePrefix != null)
46-
{
47-
options.RoutePrefix = routePrefix;
48-
}
43+
44+
if (routePrefix != null)
45+
{
46+
options.RoutePrefix = routePrefix;
47+
}
48+
4949
EnsureDefaultSpecUrl(options);
5050

5151
var pipeline = endpoints.CreateApplicationBuilder()

src/Swashbuckle.AspNetCore.SwaggerUI/SwaggerUIBuilderExtensions.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,13 @@ public static IEndpointConventionBuilder MapSwaggerUI(
4747
{
4848
var options = ResolveOptions(endpoints.ServiceProvider, setupAction);
4949

50-
if (routePrefix != null)
51-
{
52-
options.RoutePrefix = routePrefix;
53-
}
50+
if (routePrefix != null)
51+
{
52+
options.RoutePrefix = routePrefix;
53+
}
5454

5555
var hostingEnv = endpoints.ServiceProvider.GetRequiredService<IWebHostEnvironment>();
56+
5657
EnsureDefaultUrl(options, hostingEnv.ApplicationName);
5758

5859
var pipeline = endpoints.CreateApplicationBuilder()
@@ -66,7 +67,9 @@ private static SwaggerUIOptions ResolveOptions(IServiceProvider serviceProvider,
6667
{
6768
using var scope = serviceProvider.CreateScope();
6869
var options = scope.ServiceProvider.GetRequiredService<IOptionsSnapshot<SwaggerUIOptions>>().Value;
70+
6971
setupAction?.Invoke(options);
72+
7073
return options;
7174
}
7275

test/Swashbuckle.AspNetCore.IntegrationTests/VerifyTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ await Verify(swagger)
6565
[InlineData(typeof(TopLevelSwaggerDoc.Program), "/swagger/v1.json")]
6666
[InlineData(typeof(WebApi.Program), "/swagger/v1/swagger.json")]
6767
[InlineData(typeof(WebApi.Aot.Program), "/swagger/v1/swagger.json")]
68+
[InlineData(typeof(WebApi.Map.Program), "/swagger/v1/swagger.json")]
6869
public async Task Swagger_IsValidJson_No_Startup(
6970
Type entryPointType,
7071
string swaggerRequestUri)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"openapi": "3.0.4",
3+
"info": {
4+
"title": "WebApi",
5+
"version": "v1"
6+
},
7+
"paths": {
8+
"/weatherforecast": {
9+
"get": {
10+
"tags": [
11+
"WebApi.Map"
12+
],
13+
"responses": {
14+
"200": {
15+
"description": "OK",
16+
"content": {
17+
"application/json": {
18+
"schema": {
19+
"type": "array",
20+
"items": {
21+
"$ref": "#/components/schemas/Forecast"
22+
}
23+
}
24+
}
25+
}
26+
}
27+
}
28+
}
29+
}
30+
},
31+
"components": {
32+
"schemas": {
33+
"Forecast": {
34+
"type": "object",
35+
"properties": {
36+
"date": {
37+
"type": "string",
38+
"format": "date-time"
39+
},
40+
"temperatureC": {
41+
"type": "integer",
42+
"format": "int32"
43+
},
44+
"summary": {
45+
"type": "string",
46+
"nullable": true
47+
}
48+
},
49+
"additionalProperties": false
50+
}
51+
}
52+
},
53+
"tags": [
54+
{
55+
"name": "WebApi.Map"
56+
}
57+
]
58+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"openapi": "3.0.4",
3+
"info": {
4+
"title": "WebApi",
5+
"version": "v1"
6+
},
7+
"paths": {
8+
"/weatherforecast": {
9+
"get": {
10+
"tags": [
11+
"WebApi.Map"
12+
],
13+
"responses": {
14+
"200": {
15+
"description": "OK",
16+
"content": {
17+
"application/json": {
18+
"schema": {
19+
"type": "array",
20+
"items": {
21+
"$ref": "#/components/schemas/Forecast"
22+
}
23+
}
24+
}
25+
}
26+
}
27+
}
28+
}
29+
}
30+
},
31+
"components": {
32+
"schemas": {
33+
"Forecast": {
34+
"type": "object",
35+
"properties": {
36+
"date": {
37+
"type": "string",
38+
"format": "date-time"
39+
},
40+
"temperatureC": {
41+
"type": "integer",
42+
"format": "int32"
43+
},
44+
"summary": {
45+
"type": "string",
46+
"nullable": true
47+
}
48+
},
49+
"additionalProperties": false
50+
}
51+
}
52+
},
53+
"tags": [
54+
{
55+
"name": "WebApi.Map"
56+
}
57+
]
58+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"openapi": "3.0.4",
3+
"info": {
4+
"title": "WebApi",
5+
"version": "v1"
6+
},
7+
"paths": {
8+
"/weatherforecast": {
9+
"get": {
10+
"tags": [
11+
"WebApi.Map"
12+
],
13+
"responses": {
14+
"200": {
15+
"description": "OK",
16+
"content": {
17+
"application/json": {
18+
"schema": {
19+
"type": "array",
20+
"items": {
21+
"$ref": "#/components/schemas/Forecast"
22+
}
23+
}
24+
}
25+
}
26+
}
27+
}
28+
}
29+
}
30+
},
31+
"components": {
32+
"schemas": {
33+
"Forecast": {
34+
"type": "object",
35+
"properties": {
36+
"date": {
37+
"type": "string",
38+
"format": "date-time"
39+
},
40+
"temperatureC": {
41+
"type": "integer",
42+
"format": "int32"
43+
},
44+
"summary": {
45+
"type": "string",
46+
"nullable": true
47+
}
48+
},
49+
"additionalProperties": false
50+
}
51+
}
52+
},
53+
"tags": [
54+
{
55+
"name": "WebApi.Map"
56+
}
57+
]
58+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// <auto-generated/>
2+
#pragma warning disable CS0618
3+
using Microsoft.Kiota.Abstractions.Extensions;
4+
using Microsoft.Kiota.Abstractions;
5+
using Microsoft.Kiota.Serialization.Form;
6+
using Microsoft.Kiota.Serialization.Json;
7+
using Microsoft.Kiota.Serialization.Multipart;
8+
using Microsoft.Kiota.Serialization.Text;
9+
using Swashbuckle.AspNetCore.IntegrationTests.KiotaTests.Weatherforecast;
10+
using System.Collections.Generic;
11+
using System.IO;
12+
using System.Threading.Tasks;
13+
using System;
14+
namespace Swashbuckle.AspNetCore.IntegrationTests.KiotaTests
15+
{
16+
/// <summary>
17+
/// The main entry point of the SDK, exposes the configuration and the fluent API.
18+
/// </summary>
19+
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")]
20+
public partial class KiotaOpenApiClient : BaseRequestBuilder
21+
{
22+
/// <summary>The weatherforecast property</summary>
23+
public global::Swashbuckle.AspNetCore.IntegrationTests.KiotaTests.Weatherforecast.WeatherforecastRequestBuilder Weatherforecast
24+
{
25+
get => new global::Swashbuckle.AspNetCore.IntegrationTests.KiotaTests.Weatherforecast.WeatherforecastRequestBuilder(PathParameters, RequestAdapter);
26+
}
27+
/// <summary>
28+
/// Instantiates a new <see cref="global::Swashbuckle.AspNetCore.IntegrationTests.KiotaTests.KiotaOpenApiClient"/> and sets the default values.
29+
/// </summary>
30+
/// <param name="requestAdapter">The request adapter to use to execute the requests.</param>
31+
public KiotaOpenApiClient(IRequestAdapter requestAdapter) : base(requestAdapter, "{+baseurl}", new Dictionary<string, object>())
32+
{
33+
ApiClientBuilder.RegisterDefaultSerializer<JsonSerializationWriterFactory>();
34+
ApiClientBuilder.RegisterDefaultSerializer<TextSerializationWriterFactory>();
35+
ApiClientBuilder.RegisterDefaultSerializer<FormSerializationWriterFactory>();
36+
ApiClientBuilder.RegisterDefaultSerializer<MultipartSerializationWriterFactory>();
37+
ApiClientBuilder.RegisterDefaultDeserializer<JsonParseNodeFactory>();
38+
ApiClientBuilder.RegisterDefaultDeserializer<TextParseNodeFactory>();
39+
ApiClientBuilder.RegisterDefaultDeserializer<FormParseNodeFactory>();
40+
}
41+
}
42+
}
43+
#pragma warning restore CS0618

0 commit comments

Comments
 (0)