Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.17" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.1.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.1.0" />
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0-preview.5.25277.114" />
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0-preview.6.25358.103" />
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="8.0.17" />
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="4.14.0" />
<PackageVersion Include="Microsoft.OpenApi" Version="2.0.0-preview.18" />
<PackageVersion Include="Microsoft.OpenApi.YamlReader" Version="2.0.0-preview.18" />
<PackageVersion Include="Microsoft.OpenApi" Version="2.0.0-preview.29" />
<PackageVersion Include="Microsoft.OpenApi.YamlReader" Version="2.0.0-preview.29" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="NSubstitute" Version="5.3.0" />
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ for more details.
2. Register the Swagger generator in your application's startup path, defining one or more Swagger documents. For example:

```csharp
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi;
```

```csharp
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "10.0.100-preview.5.25277.114",
"version": "10.0.100-preview.6.25358.103",
"allowPrerelease": false,
"rollForward": "latestMajor",
"paths": [ ".dotnet", "$host$" ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using BenchmarkDotNet.Attributes;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi;
using Swashbuckle.AspNetCore.SwaggerGen;
using Swashbuckle.AspNetCore.SwaggerGen.Test;
using Swashbuckle.AspNetCore.TestSupport;
Expand Down
2 changes: 1 addition & 1 deletion src/Shared/JsonSchemaTypes.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi;

namespace Swashbuckle.AspNetCore;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi;
using Swashbuckle.AspNetCore.SwaggerGen;

namespace Swashbuckle.AspNetCore.Annotations;
Expand All @@ -8,7 +8,7 @@ public class AnnotationsDocumentFilter : IDocumentFilter
{
public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context)
{
swaggerDoc.Tags ??= [];
swaggerDoc.Tags ??= new SortedSet<OpenApiTag>();

// Collect (unique) controller names and custom attributes in a dictionary
var controllerNamesAndAttributes = context.ApiDescriptions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.References;
using Microsoft.OpenApi;
using Swashbuckle.AspNetCore.SwaggerGen;

namespace Swashbuckle.AspNetCore.Annotations;
Expand Down Expand Up @@ -70,7 +69,7 @@ private static void ApplySwaggerOperationAttribute(

if (swaggerOperationAttribute.Tags is { } tags)
{
operation.Tags = [.. tags.Select(tagName => new OpenApiTagReference(tagName))];
operation.Tags = new SortedSet<OpenApiTagReference>(tags.Select(tagName => new OpenApiTagReference(tagName)));
}
}

Expand Down Expand Up @@ -118,7 +117,7 @@ private static void ApplySwaggerResponseAttributes(
swaggerResponseAttribute.ContentTypes is { } contentTypes)
{
concrete.Content?.Clear();
concrete.Content ??= [];
concrete.Content ??= new Dictionary<string, OpenApiMediaType>();

foreach (var contentType in contentTypes)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Reflection;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi;
using Swashbuckle.AspNetCore.SwaggerGen;

namespace Swashbuckle.AspNetCore.Annotations;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Reflection;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi;
using Swashbuckle.AspNetCore.SwaggerGen;

namespace Swashbuckle.AspNetCore.Annotations;
Expand Down
12 changes: 2 additions & 10 deletions src/Swashbuckle.AspNetCore.Annotations/AnnotationsSchemaFilter.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Reflection;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi;
using Swashbuckle.AspNetCore.SwaggerGen;

namespace Swashbuckle.AspNetCore.Annotations;
Expand Down Expand Up @@ -116,14 +115,7 @@ private static void ApplySchemaAttribute(IOpenApiSchema schema, SwaggerSchemaAtt

if (schemaAttribute.Required is { } required)
{
if (required.Length < 2)
{
concrete.Required = [.. required];
}
else
{
concrete.Required = [.. new SortedSet<string>(required)];
}
concrete.Required = new SortedSet<string>(required);
}

if (schemaAttribute.Title is { } title)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
Microsoft.Extensions.DependencyInjection.AnnotationsSwaggerGenOptionsExtensions
static Microsoft.Extensions.DependencyInjection.AnnotationsSwaggerGenOptionsExtensions.EnableAnnotations(this Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenOptions options) -> void
static Microsoft.Extensions.DependencyInjection.AnnotationsSwaggerGenOptionsExtensions.EnableAnnotations(this Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenOptions options, bool enableAnnotationsForInheritance, bool enableAnnotationsForPolymorphism) -> void
static Swashbuckle.AspNetCore.Annotations.AnnotationsOperationFilter.ApplySwaggerOperationFilterAttributes(Microsoft.OpenApi.Models.OpenApiOperation operation, Swashbuckle.AspNetCore.SwaggerGen.OperationFilterContext context, System.Collections.Generic.IEnumerable<object> controllerAndActionAttributes) -> void
Swashbuckle.AspNetCore.Annotations.AnnotationsDocumentFilter
Swashbuckle.AspNetCore.Annotations.AnnotationsDocumentFilter.AnnotationsDocumentFilter() -> void
Swashbuckle.AspNetCore.Annotations.AnnotationsDocumentFilter.Apply(Microsoft.OpenApi.Models.OpenApiDocument swaggerDoc, Swashbuckle.AspNetCore.SwaggerGen.DocumentFilterContext context) -> void
Swashbuckle.AspNetCore.Annotations.AnnotationsOperationFilter
Swashbuckle.AspNetCore.Annotations.AnnotationsOperationFilter.AnnotationsOperationFilter() -> void
Swashbuckle.AspNetCore.Annotations.AnnotationsOperationFilter.Apply(Microsoft.OpenApi.Models.OpenApiOperation operation, Swashbuckle.AspNetCore.SwaggerGen.OperationFilterContext context) -> void
Swashbuckle.AspNetCore.Annotations.AnnotationsParameterFilter
Swashbuckle.AspNetCore.Annotations.AnnotationsParameterFilter.AnnotationsParameterFilter() -> void
Swashbuckle.AspNetCore.Annotations.AnnotationsRequestBodyFilter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Swashbuckle.AspNetCore.Annotations.AnnotationsParameterFilter.Apply(Microsoft.OpenApi.Models.Interfaces.IOpenApiParameter parameter, Swashbuckle.AspNetCore.SwaggerGen.ParameterFilterContext context) -> void
Swashbuckle.AspNetCore.Annotations.AnnotationsRequestBodyFilter.Apply(Microsoft.OpenApi.Models.Interfaces.IOpenApiRequestBody requestBody, Swashbuckle.AspNetCore.SwaggerGen.RequestBodyFilterContext context) -> void
Swashbuckle.AspNetCore.Annotations.AnnotationsSchemaFilter.Apply(Microsoft.OpenApi.Models.Interfaces.IOpenApiSchema schema, Swashbuckle.AspNetCore.SwaggerGen.SchemaFilterContext context) -> void
static Swashbuckle.AspNetCore.Annotations.AnnotationsOperationFilter.ApplySwaggerOperationFilterAttributes(Microsoft.OpenApi.OpenApiOperation operation, Swashbuckle.AspNetCore.SwaggerGen.OperationFilterContext context, System.Collections.Generic.IEnumerable<object> controllerAndActionAttributes) -> void
Swashbuckle.AspNetCore.Annotations.AnnotationsDocumentFilter.Apply(Microsoft.OpenApi.OpenApiDocument swaggerDoc, Swashbuckle.AspNetCore.SwaggerGen.DocumentFilterContext context) -> void
Swashbuckle.AspNetCore.Annotations.AnnotationsOperationFilter.Apply(Microsoft.OpenApi.OpenApiOperation operation, Swashbuckle.AspNetCore.SwaggerGen.OperationFilterContext context) -> void
Swashbuckle.AspNetCore.Annotations.AnnotationsParameterFilter.Apply(Microsoft.OpenApi.IOpenApiParameter parameter, Swashbuckle.AspNetCore.SwaggerGen.ParameterFilterContext context) -> void
Swashbuckle.AspNetCore.Annotations.AnnotationsRequestBodyFilter.Apply(Microsoft.OpenApi.IOpenApiRequestBody requestBody, Swashbuckle.AspNetCore.SwaggerGen.RequestBodyFilterContext context) -> void
Swashbuckle.AspNetCore.Annotations.AnnotationsSchemaFilter.Apply(Microsoft.OpenApi.IOpenApiSchema schema, Swashbuckle.AspNetCore.SwaggerGen.SchemaFilterContext context) -> void
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi;
using Xunit;

namespace Swashbuckle.AspNetCore.ApiTesting.Xunit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Swashbuckle.AspNetCore.ApiTesting.Xunit.ApiTestFixture<TEntryPoint>.Describe(string pathTemplate, System.Net.Http.HttpMethod operationType, Microsoft.OpenApi.Models.OpenApiOperation operationSpec) -> void
Swashbuckle.AspNetCore.ApiTesting.Xunit.ApiTestFixture<TEntryPoint>.Describe(string pathTemplate, System.Net.Http.HttpMethod operationType, Microsoft.OpenApi.OpenApiOperation operationSpec) -> void
3 changes: 1 addition & 2 deletions src/Swashbuckle.AspNetCore.ApiTesting/ApiTestRunnerBase.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Writers;
using Microsoft.OpenApi;

namespace Swashbuckle.AspNetCore.ApiTesting;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi;

namespace Swashbuckle.AspNetCore.ApiTesting;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi;

namespace Swashbuckle.AspNetCore.ApiTesting;

Expand Down
2 changes: 1 addition & 1 deletion src/Swashbuckle.AspNetCore.ApiTesting/IContentValidator.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi;

namespace Swashbuckle.AspNetCore.ApiTesting;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi;
using Newtonsoft.Json.Linq;

namespace Swashbuckle.AspNetCore.ApiTesting;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi;
using Newtonsoft.Json.Linq;

namespace Swashbuckle.AspNetCore.ApiTesting;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi;
using Newtonsoft.Json.Linq;

namespace Swashbuckle.AspNetCore.ApiTesting;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi;
using Newtonsoft.Json.Linq;

namespace Swashbuckle.AspNetCore.ApiTesting;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi;
using Newtonsoft.Json.Linq;

namespace Swashbuckle.AspNetCore.ApiTesting;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi;
using Newtonsoft.Json.Linq;

namespace Swashbuckle.AspNetCore.ApiTesting;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi;
using Newtonsoft.Json.Linq;

namespace Swashbuckle.AspNetCore.ApiTesting;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Globalization;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi;
using Newtonsoft.Json.Linq;

namespace Swashbuckle.AspNetCore.ApiTesting;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi;
using Newtonsoft.Json.Linq;

namespace Swashbuckle.AspNetCore.ApiTesting;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi;
using Newtonsoft.Json.Linq;

namespace Swashbuckle.AspNetCore.ApiTesting;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Text.RegularExpressions;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi;
using Newtonsoft.Json.Linq;

namespace Swashbuckle.AspNetCore.ApiTesting;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi.Models.References;
using Microsoft.OpenApi;
using Newtonsoft.Json.Linq;

namespace Swashbuckle.AspNetCore.ApiTesting;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi;

namespace Swashbuckle.AspNetCore.ApiTesting;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Text;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi;

namespace Swashbuckle.AspNetCore.ApiTesting;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
static Swashbuckle.AspNetCore.ApiTesting.ApiTestRunnerOptionsExtensions.AddOpenApiFile(this Swashbuckle.AspNetCore.ApiTesting.ApiTestRunnerOptions options, string documentName, string filePath) -> void
static Swashbuckle.AspNetCore.ApiTesting.ApiTestRunnerOptionsExtensions.GetOpenApiDocument(this Swashbuckle.AspNetCore.ApiTesting.ApiTestRunnerOptions options, string documentName) -> Microsoft.OpenApi.Models.OpenApiDocument
Swashbuckle.AspNetCore.ApiTesting.ApiTestRunnerBase
Swashbuckle.AspNetCore.ApiTesting.ApiTestRunnerBase.ApiTestRunnerBase() -> void
Swashbuckle.AspNetCore.ApiTesting.ApiTestRunnerBase.Configure(System.Action<Swashbuckle.AspNetCore.ApiTesting.ApiTestRunnerOptions> setupAction) -> void
Expand All @@ -11,14 +10,12 @@ Swashbuckle.AspNetCore.ApiTesting.ApiTestRunnerOptions.FileOutputRoot.get -> str
Swashbuckle.AspNetCore.ApiTesting.ApiTestRunnerOptions.FileOutputRoot.set -> void
Swashbuckle.AspNetCore.ApiTesting.ApiTestRunnerOptions.GenerateOpenApiFiles.get -> bool
Swashbuckle.AspNetCore.ApiTesting.ApiTestRunnerOptions.GenerateOpenApiFiles.set -> void
Swashbuckle.AspNetCore.ApiTesting.ApiTestRunnerOptions.OpenApiDocs.get -> System.Collections.Generic.Dictionary<string, Microsoft.OpenApi.Models.OpenApiDocument>
Swashbuckle.AspNetCore.ApiTesting.ApiTestRunnerOptionsExtensions
Swashbuckle.AspNetCore.ApiTesting.ContentDoesNotMatchSpecException
Swashbuckle.AspNetCore.ApiTesting.ContentDoesNotMatchSpecException.ContentDoesNotMatchSpecException(string message) -> void
Swashbuckle.AspNetCore.ApiTesting.HttpHeadersExtensions
Swashbuckle.AspNetCore.ApiTesting.IContentValidator
Swashbuckle.AspNetCore.ApiTesting.IContentValidator.CanValidate(string mediaType) -> bool
Swashbuckle.AspNetCore.ApiTesting.IContentValidator.Validate(Microsoft.OpenApi.Models.OpenApiMediaType mediaTypeSpec, Microsoft.OpenApi.Models.OpenApiDocument openApiDocument, System.Net.Http.HttpContent content) -> void
Swashbuckle.AspNetCore.ApiTesting.IJsonValidator
Swashbuckle.AspNetCore.ApiTesting.JsonAllOfValidator
Swashbuckle.AspNetCore.ApiTesting.JsonAllOfValidator.JsonAllOfValidator(Swashbuckle.AspNetCore.ApiTesting.JsonValidator jsonValidator) -> void
Expand All @@ -31,7 +28,6 @@ Swashbuckle.AspNetCore.ApiTesting.JsonBooleanValidator.JsonBooleanValidator() ->
Swashbuckle.AspNetCore.ApiTesting.JsonContentValidator
Swashbuckle.AspNetCore.ApiTesting.JsonContentValidator.CanValidate(string mediaType) -> bool
Swashbuckle.AspNetCore.ApiTesting.JsonContentValidator.JsonContentValidator() -> void
Swashbuckle.AspNetCore.ApiTesting.JsonContentValidator.Validate(Microsoft.OpenApi.Models.OpenApiMediaType mediaTypeSpec, Microsoft.OpenApi.Models.OpenApiDocument openApiDocument, System.Net.Http.HttpContent content) -> void
Swashbuckle.AspNetCore.ApiTesting.JsonNullValidator
Swashbuckle.AspNetCore.ApiTesting.JsonNullValidator.JsonNullValidator() -> void
Swashbuckle.AspNetCore.ApiTesting.JsonNumberValidator
Expand Down
Loading
Loading