diff --git a/CHANGELOG.md b/CHANGELOG.md index 8960a97..9feedbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ These are the changes to each version that has been released on the [nuget](https://www.nuget.org/packages/Unchase.Swashbuckle.AspNetCore.Extensions/). +## v2.1.2 `(2020-02-20)` + +- [x] Add xml-comments to nuget package + ## v2.1.1 `(2020-02-19)` - [x] Fix bug: use `System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping` encoder for responses examples diff --git a/src/Unchase.Swashbuckle.AspNetCore.Extensions/Filters/ChangeResponseByHttpStatusCodeDocumentFilter.cs b/src/Unchase.Swashbuckle.AspNetCore.Extensions/Filters/ChangeResponseByHttpStatusCodeDocumentFilter.cs index bd2a80f..13b39a9 100644 --- a/src/Unchase.Swashbuckle.AspNetCore.Extensions/Filters/ChangeResponseByHttpStatusCodeDocumentFilter.cs +++ b/src/Unchase.Swashbuckle.AspNetCore.Extensions/Filters/ChangeResponseByHttpStatusCodeDocumentFilter.cs @@ -93,12 +93,14 @@ public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context) case ResponseExampleOptions.AddNew: if (this._responseExample != null) { - jsonContent.Example = new OpenApiString(System.Text.Json.JsonSerializer.Serialize(this._responseExample, + var jsonExample = new OpenApiString(System.Text.Json.JsonSerializer.Serialize(this._responseExample, new System.Text.Json.JsonSerializerOptions { WriteIndented = true, Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping })); + + jsonContent.Example = jsonExample; } jsonContent.Schema = schema; break; @@ -114,14 +116,15 @@ public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context) case ResponseExampleOptions.AddNew: if (this._responseExample != null) { + var jsonExample = new OpenApiString(System.Text.Json.JsonSerializer.Serialize(this._responseExample, + new System.Text.Json.JsonSerializerOptions + { + WriteIndented = true, + Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping + })); response.Value.Content.Add("application/json", new OpenApiMediaType() { - Example = new OpenApiString(System.Text.Json.JsonSerializer.Serialize(this._responseExample, - new System.Text.Json.JsonSerializerOptions - { - WriteIndented = true, - Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping - })), + Example = jsonExample, Schema = schema }); } diff --git a/src/Unchase.Swashbuckle.AspNetCore.Extensions/Unchase.Swashbuckle.AspNetCore.Extensions.csproj b/src/Unchase.Swashbuckle.AspNetCore.Extensions/Unchase.Swashbuckle.AspNetCore.Extensions.csproj index 48e0eda..035aede 100644 --- a/src/Unchase.Swashbuckle.AspNetCore.Extensions/Unchase.Swashbuckle.AspNetCore.Extensions.csproj +++ b/src/Unchase.Swashbuckle.AspNetCore.Extensions/Unchase.Swashbuckle.AspNetCore.Extensions.csproj @@ -14,10 +14,14 @@ 7.3 https://github.com/unchase/Unchase.Swashbuckle.AspNetCore.Extensions/blob/master/assets/icon.png?raw=true - 2.1.0 + 2.1.2 2.1.0.0 + + Unchase.Swashbuckle.AspNetCore.Extensions.xml + + diff --git a/src/Unchase.Swashbuckle.AspNetCore.Extensions/Unchase.Swashbuckle.AspNetCore.Extensions.xml b/src/Unchase.Swashbuckle.AspNetCore.Extensions/Unchase.Swashbuckle.AspNetCore.Extensions.xml new file mode 100644 index 0000000..89da3b6 --- /dev/null +++ b/src/Unchase.Swashbuckle.AspNetCore.Extensions/Unchase.Swashbuckle.AspNetCore.Extensions.xml @@ -0,0 +1,137 @@ + + + + Unchase.Swashbuckle.AspNetCore.Extensions + + + + + Change all responses by specific http status codes in OpenApi document. + + Type of response example. + . + HTTP status code. + Response description. + . + New example for response. + + Returns . + + + + + Change all responses by specific http status codes in OpenApi document. + + Type of response example. + . + HTTP status code. + Response description. + . + New example for response. + + Returns . + + + + + Add filters to fix enums in OpenApi document. + + . + If true - add extensions (descriptions) from . + + Returns . + + + + + Options for response example. + + + + + Clear example. + + + + + Add (replace) example. + + + + + Do nothing. + + + + + Document filter for changing responses by specific http status codes in OpenApi document. + + Type of response example. + + + + Constructor. + + HTTP status code. + Response description. + . + New example for response. + + + + Apply filter. + + . + . + + + + Filter for removing Paths and Defenitions from OpenApi documentation without accepted roles. + + + + + Конструктор класса . + + + + + + Apply filter. + + . + . + + + + Document filter for ordering tags by name in OpenApi document. + + + + + Apply filter. + + . + . + + + + Constructor. + + If true - add "x-enumDescriptions" extensions from . + + + + Constructor. + + If true - add "x-enumDescriptions" extensions from . + + + + Apply the filter. + + . + . + + +