diff --git a/Build.ps1 b/Build.ps1 index 7c5a85f..90aec5a 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -21,7 +21,7 @@ foreach ($src in ls src/*) { echo "build: Packaging project in $src" & dotnet pack -c Release -o ..\..\artifacts --version-suffix=$suffix - if($LASTEXITCODE -ne 0) { exit 1 } + if($LASTEXITCODE -ne 0) { exit 1 } Pop-Location } @@ -37,15 +37,4 @@ foreach ($test in ls test/*.PerformanceTests) { Pop-Location } -foreach ($test in ls test/*.Tests) { - Push-Location $test - - echo "build: Testing project in $test" - - & dotnet test -c Release - if($LASTEXITCODE -ne 0) { exit 3 } - - Pop-Location -} - Pop-Location diff --git a/CHANGELOG.md b/CHANGELOG.md index d7f7260..57a7730 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.6.12 `2021-10-05` + +- [x] Fix [#17](https://github.com/unchase/Unchase.Swashbuckle.AspNetCore.Extensions/issues/17): check schema for null in `DisplayEnumsWithValuesDocumentFilter` + ## v2.6.11 `2021-09-29` - [x] Fix [#18](https://github.com/unchase/Unchase.Swashbuckle.AspNetCore.Extensions/issues/18): add aliases for "x-enumNames" and "x-enumDescriptions" diff --git a/src/Unchase.Swashbuckle.AspNetCore.Extensions/Filters/DisplayEnumsWithValuesDocumentFilter.cs b/src/Unchase.Swashbuckle.AspNetCore.Extensions/Filters/DisplayEnumsWithValuesDocumentFilter.cs index 1f3a8d0..cbb3357 100644 --- a/src/Unchase.Swashbuckle.AspNetCore.Extensions/Filters/DisplayEnumsWithValuesDocumentFilter.cs +++ b/src/Unchase.Swashbuckle.AspNetCore.Extensions/Filters/DisplayEnumsWithValuesDocumentFilter.cs @@ -76,9 +76,9 @@ public void Apply(OpenApiDocument openApiDoc, DocumentFilterContext context) foreach (var parameter in openApiDoc.Paths.Values.SelectMany(v => v.Operations).SelectMany(op => op.Value.Parameters)) { OpenApiSchema schema = null; - if (parameter.Schema.Reference == null) + if (parameter.Schema?.Reference == null) { - if (parameter.Schema.AllOf.Count > 0) + if (parameter.Schema?.AllOf?.Count > 0) { schema = context.SchemaRepository.Schemas.FirstOrDefault(s => parameter.Schema.AllOf.FirstOrDefault(a => a.Reference.Id == s.Key) != null).Value; } @@ -89,7 +89,7 @@ public void Apply(OpenApiDocument openApiDoc, DocumentFilterContext context) } else { - var componentReference = parameter.Schema.Reference.Id; + var componentReference = parameter.Schema?.Reference?.Id; if (!string.IsNullOrWhiteSpace(componentReference)) { schema = openApiDoc.Components.Schemas[componentReference]; 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 3fbef23..b1761a3 100644 --- a/src/Unchase.Swashbuckle.AspNetCore.Extensions/Unchase.Swashbuckle.AspNetCore.Extensions.csproj +++ b/src/Unchase.Swashbuckle.AspNetCore.Extensions/Unchase.Swashbuckle.AspNetCore.Extensions.csproj @@ -14,9 +14,9 @@ 7.3 https://github.com/unchase/Unchase.Swashbuckle.AspNetCore.Extensions/blob/master/assets/icon.png?raw=true - 2.6.11 - 2.6.11.0 - 2.6.11.0 + 2.6.12 + 2.6.12.0 + 2.6.12.0 false Unchase.Swashbuckle.AspNetCore.Extensions.xml