Class UserAgentDocumentFilter
- Assembly
- Codebelt.Extensions.Swashbuckle.AspNetCore.dll
Provides a User-Agent field to the generated Microsoft.OpenApi.Models.OpenApiDocument.
public class UserAgentDocumentFilter : DocumentFilter<UserAgentDocumentOptions>, IDocumentFilter, IConfigurable<UserAgentDocumentOptions>
- Inheritance
-
UserAgentDocumentFilter
- Implements
-
IDocumentFilter
- Inherited Members
Remarks
Inspiration for this class was borrowed from: https://github.com/tgstation/tgstation-server/blob/dev/src/Tgstation.Server.Host/Core/SwaggerConfiguration.cs
Constructors
UserAgentDocumentFilter(UserAgentDocumentOptions)
Initializes a new instance of the UserAgentDocumentFilter class.
public UserAgentDocumentFilter(UserAgentDocumentOptions options)
Parameters
options
UserAgentDocumentOptionsThe configured options of this instance.
Methods
Apply(OpenApiDocument, DocumentFilterContext)
Applies post-processing to the swaggerDoc
.
public override void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context)
Parameters
swaggerDoc
OpenApiDocumentThe Microsoft.OpenApi.Models.OpenApiDocument to modify.
context
DocumentFilterContextThe Swashbuckle.AspNetCore.SwaggerGen.DocumentFilterContext that provides additional context.
Remarks
Once an Microsoft.OpenApi.Models.OpenApiDocument has been generated you have full control to modify the document however you see fit.