Skip to content

Releases: domaindrivendev/Swashbuckle.AspNetCore

v6.0.0

05 Feb 11:07
Compare
Choose a tag to compare

This release includes a number of small enhancements and bug fixes. See the following for a full list of issues addressed:
https://github.com/domaindrivendev/Swashbuckle.AspNetCore/milestone/16?closed=1

Of note, these include:

  • include discriminator metadata in base schema if either UseOneOfForPolymorphism OR UseAllOfForInheritance are enabled
  • remove fragile logic around X-Forwarded-* headers in favor of MS's Forwarded Headers Middleware (*see breaking changes)
  • beta (opt-in) support for non-nullable reference types
  • enhancements to SwaggerSchemaAttribute incl. use on Enum types & ability to set Nullable flag explicitly
  • wrap generator exceptions to surface contextual info for troubleshooting
  • support JSON object/array syntax in XML tags
  • improved handling for enum default values to reflect serializer behavior more accurately
  • upgrade swagger-ui to 3.40.0

Breaking Changes

  • the obsolete settings DescribeAllEnumsAsStrings and DescribeStringEnumsInCamelCase are now fully removed
  • X-Forwarded-* headers are no longer honored within SB code - use MS's Forwarded Headers Middleware instead

v5.6.0

14 Sep 22:19
Compare
Choose a tag to compare

This release includes a number of small enhancements and bug fixes. See the following for a full list of issues addressed:
https://github.com/domaindrivendev/Swashbuckle.AspNetCore/milestone/15?closed=1

Of note, these include:

  • Improve polymorphism & inheritance behavior, incl. more flexible config & discriminator metadata
  • Better support for reverse proxy environments, incl. assigning servers metadata based on the presence of common reverse proxy headers
  • Support for emitting Swagger / OpenAPI in yaml format
  • Improve Schema generation for ProblemDetails
  • Handle Min/MaxLength attribute for arrays
  • Upgrade swagger-ui to v3.32.5
  • Upgrade redoc to v2.0.0-rc.40

v5.5.0

19 Jun 09:21
a6dce86
Compare
Choose a tag to compare

These release is primarily to improve compatability of the CLI tool with different versions of the dotnet SDK, but also contains a few other minor fixes and enhancements, including an upgrade of the embedded swagger-ui to version 3.26.0.

Addressed issues:

https://github.com/domaindrivendev/Swashbuckle.AspNetCore/milestone/14?closed=1

v5.4.1

30 Apr 12:46
Compare
Choose a tag to compare

Hotfix for #1645

v5.4.0

28 Apr 13:14
b043143
Compare
Choose a tag to compare

v5.3.0

02 Apr 12:30
316ddd0
Compare
Choose a tag to compare

v5.2.0

20 Mar 23:36
21f4bfe
Compare
Choose a tag to compare

V5.1.0

11 Mar 14:13
0a7420c
Compare
Choose a tag to compare

v5.0.0

14 Jan 13:15
1c5ea5d
Compare
Choose a tag to compare

Release Summary

This release contains a number of significant changes, including a transition to Swagger/OpenAPI v3 and support for ASP.NET Core 3.0, and will require modifications to your application setup if you're upgrading from previous major versions.

While it's awesome to finally support the latest Swagger/OpenAPI version (v3), this does introduce significant structural changes to the Swagger object model, which you're likely interacting with to configure and/or extend Swashbuckle. Specific details are provided below but at a high level, the built-in SwaggerDocument and contained types have now been replaced with an OpenApiDocument object model that's imported from the Micorosft/OpenAPI.NET library.

To coincide with the release of ASP.NET Core 3.x, this version of Swashbuckle will be fully compatible with that version of the framework, including out-of-the-box support for the new System.Text.Json (STJ) serializer.

Furthermore, this release also includes a wide range of bug fixes and enhancements including an upgrade of the embedded swagger-ui to 3.24.3, an upgrade of the ReDoc UI to 2.0.0-rc.14, improved handling of IFormFile and FileResult parameters and responses, and support for polymorphic models.

Breaking Changes

  • New Swagger/OpenAPI Object Model:

Best case, you can simply replace references to the old Swagger objects (Info, Operation, Schema etc.) with corresponding types from the new object model (e.g. OpenApiInfo, OpenApiOperation, OpenApiSchema) available in the Microsoft.OpenApi.Models namespace. However, the old model was based on version 2.0 of the Swagger/OpenApi spec. whereas the new version is based on 3.0. Therefore, depending on the extent to which you're manipulating the generated Swagger, you may need to re-work some of your code. Check out the official Swagger docs to get a better sense of what's changed between v2 and v3 of the spec.

It's also worth noting ... if you have consumers of the generated Swagger JSON that still depend on v2 of the spec, you can configure the Swagger middleware to continue outputting in that format:

app.UseSwagger(c => c.SerializeAsV2 = true);
  • Honors System.Text.Json Serializer instead of Newtonsoft by default:

While previous versions of Swashbuckle honored Newtonsoft settings/attributes by default when generating Swagger, this version honors STJ options/attributes by default. If you're still using the Newtonsoft serializer, then you'll need to install a separate Swashbuckle package and explicitly opt-in as described here

  • Changes to Filter Interfaces

As a result of the object model change, the Apply method for all filter types accepts a type from the new model instead of the old. For example, IOperationFilter.Apply now accepts an OpenApiOperation, IParameterFilter.Apply an OpenApiParameter and so on.

Also, the SchemaRegistry property on filter context objects has been replaced with a SchemaGenerator/SchemaRepository pair of properties. This change is the result of an underlying separating of concerns into "schema generation" and "referenced schema storage". Now, if you need to leverage the schema generator within a filter, it should be invoked as follows:

var schema = context.SchemaGenerator.GenerateSchema(typeof(CustomType), context.SchemaRepository);

Issues Addressed

See https://github.com/domaindrivendev/Swashbuckle.AspNetCore/milestone/7?closed=1

Last planned pre-release

12 Dec 14:09
Compare
Choose a tag to compare
Pre-release

Release Summary

This release contains a number of significant changes, including a transition to Swagger/OpenAPI v3 and support for ASP.NET Core 3.0, and will require modifications to your application setup if you're upgrading from previous major versions.

While it's awesome to finally support the latest Swagger/OpenAPI version (v3), this does introduce structural changes to the Swagger object model, which you're likely interacting with to configure and/or extend Swashbuckle. Specific details are provided below but at a high level, the built-in SwaggerDocument and contained types have now been replaced with an OpenApiDocument object model that's imported from the Micorosft/OpenAPI.NET library.

To coincide with the release of ASP.NET Core 3.x, this version of Swashbuckle will be fully compatible with that version of the framework, including out-of-the-box support for the new System.Text.Json (STJ) serializer.

Furthermore, this release also includes a wide range of bug fixes and enhancements including an upgrade of the embedded swagger-ui to 3.24.0, an upgrade of the ReDoc UI to 2.0.0-rc.14, improved handling of IFormFile and FileResult parameters and responses, and support for polymorphic models.

Breaking Changes

  • New Swagger/OpenAPI Object Model:

Best case, you can simply replace references to the old Swagger objects (Info, Operation, Schema etc.) with corresponding types from the new object model (e.g. OpenApiInfo, OpenApiOperation, OpenApiSchema) available in the Microsoft.OpenApi.Models namespace. However, the old model was based on version 2.0 of the Swagger/OpenApi spec. whereas the new version is based on 3.0. Therefore, depending on the extent to which you're manipulating the generated Swagger, you may need to re-work some of your code. Check out the official Swagger docs to get a better sense of what's changed between v2 and v3 of the spec.

It's also worth noting ... if you have consumers of the generated Swagger JSON that still depend on v2 of the spec, you can configure the Swagger middleware to continue outputting in that format:

app.UseSwagger(c => c.SerializeAsV2 = true);
  • Honors System.Text.Json Serializer instead of Newtonsoft by default:

While previous versions of Swashbuckle honored Newtonsoft settings/attributes by default when generating Swagger, this version honors STJ options/attributes by default. If you're still using the Newtonsoft serializer, then you'll need to install a separate Swashbuckle package and explicitly opt-in as described here

  • Changes to Filter Interfaces

As a result of the object model change, the Apply method for all filter types accepts a type from the new model instead of the old. For example, IOperationFilter.Apply now accepts an OpenApiOperation, IParameterFilter.Apply an OpenApiParameter and so on.

Also, the SchemaRegistry property on filter context objects has been replaced with a SchemaGenerator/SchemaRepository pair of properties. This change is the result of an underlying separating of concerns into "schema generation" and "referenced schema storage". Now, if you need to leverage the schema generator within a filter, it should be invoked as follows:

var schema = context.SchemaGenerator.GenerateSchema(typeof(CustomType), context.SchemaRepository);

Issues Addressed

See https://github.com/domaindrivendev/Swashbuckle.AspNetCore/milestone/7?closed=1