Search Results for

    Show / Hide Table of Contents

    Class DocumentOptions

    options for the swagger document

    Inheritance
    object
    DocumentOptions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: FastEndpoints.Swagger
    Assembly: FastEndpoints.Swagger.dll
    Syntax
    public class DocumentOptions

    Constructors

    DocumentOptions(IServiceProvider)

    options for the swagger document

    Declaration
    public DocumentOptions(IServiceProvider serviceProvider)
    Parameters
    Type Name Description
    IServiceProvider serviceProvider

    Properties

    AutoTagPathSegmentIndex

    the index of the route path segment to use for tagging/grouping endpoints. set 0 to disable auto tagging.

    Declaration
    public int AutoTagPathSegmentIndex { get; set; }
    Property Value
    Type Description
    int

    DocumentSettings

    a function for configuring the swagger document generator settings

    Declaration
    public Action<AspNetCoreOpenApiDocumentGeneratorSettings>? DocumentSettings { get; set; }
    Property Value
    Type Description
    Action<AspNetCoreOpenApiDocumentGeneratorSettings>

    EnableGetRequestsWithBody

    by default GET request DTO properties are automatically converted to query parameters because fetch-client/swagger ui doesn't support it. set this to true if for some reason you'd like to disable this auto conversion and allow GET requests with a body.

    Declaration
    public bool EnableGetRequestsWithBody { get; set; }
    Property Value
    Type Description
    bool

    EnableJWTBearerAuth

    set to false to disable auto addition of jwt bearer auth support

    Declaration
    public bool EnableJWTBearerAuth { get; set; }
    Property Value
    Type Description
    bool

    EndpointFilter

    a function to filter out endpoints from the swagger document. this function will be run against every fast endpoint discovered. return true to include the endpoint and return false to exclude the endpoint from the swagger doc.

    Declaration
    public Func<EndpointDefinition, bool>? EndpointFilter { get; set; }
    Property Value
    Type Description
    Func<EndpointDefinition, bool>

    ExcludeNonFastEndpoints

    if set to true, only FastEndpoints will show up in the swagger doc

    Declaration
    public bool ExcludeNonFastEndpoints { get; set; }
    Property Value
    Type Description
    bool

    FlattenSchema

    enabling this flattens the inheritance hierarchy of all the schema.

    Declaration
    public bool FlattenSchema { get; set; }
    Property Value
    Type Description
    bool

    MaxEndpointVersion

    endpoints greater than this version will not be included in this swagger doc.

    Declaration
    public int MaxEndpointVersion { get; set; }
    Property Value
    Type Description
    int

    MinEndpointVersion

    endpoints lower than this version will not be included in the swagger doc.

    Declaration
    public int MinEndpointVersion { get; set; }
    Property Value
    Type Description
    int

    NewtonsoftSettings

    any additional newtonsoft serializer settings. most useful for registering custom converters.

    Declaration
    public Action<JsonSerializerSettings>? NewtonsoftSettings { get; set; }
    Property Value
    Type Description
    Action<JsonSerializerSettings>

    ReleaseVersion

    specify a "release version" for this swagger document. you can exclude endpoints from showing up under this swagger doc by specifying a higher number than this on the endpoint like so:

    Version(x).StartingRelease(2)

    i.e. if the starting release of the endpoint is higher than the release version of this swagger doc, that endpoint will not show up for this swagger doc.

    Declaration
    public int ReleaseVersion { get; set; }
    Property Value
    Type Description
    int

    RemoveEmptyRequestSchema

    set to true for removing empty request dto schema from the swagger document.

    WARNING: enabling this also flattens the inheritance hierarchy of the schema.

    Declaration
    public bool RemoveEmptyRequestSchema { get; set; }
    Property Value
    Type Description
    bool

    SerializerSettings

    json serializer options

    Declaration
    public Action<JsonSerializerOptions>? SerializerSettings { get; set; }
    Property Value
    Type Description
    Action<JsonSerializerOptions>

    Services

    service provider instance for resolving any services from the di container

    Declaration
    public IServiceProvider Services { get; }
    Property Value
    Type Description
    IServiceProvider

    ShortSchemaNames

    set to true if you'd like schema names to be just the class name instead of the full name.

    Declaration
    public bool ShortSchemaNames { get; set; }
    Property Value
    Type Description
    bool

    ShowDeprecatedOps

    by default deprecated endpoints/operations will not show up in the swagger doc. set this to true if you instead want them to show up but displayed as "obsolete".

    Declaration
    public bool ShowDeprecatedOps { get; set; }
    Property Value
    Type Description
    bool

    TagCase

    the casing strategy to use when naming endpoint tags.

    Declaration
    public TagCase TagCase { get; set; }
    Property Value
    Type Description
    TagCase

    TagDescriptions

    specify swagger tag descriptions for the document. the key of the dictionary is the name of the tag to add a description for.

    Declaration
    public Action<Dictionary<string, string>>? TagDescriptions { get; set; }
    Property Value
    Type Description
    Action<Dictionary<string, string>>

    TagStripSymbols

    specify whether to strip non-alphanumeric characters from tags.

    Declaration
    public bool TagStripSymbols { get; set; }
    Property Value
    Type Description
    bool

    UseOneOfForPolymorphism

    by setting this to true, you can have base class types as request/response dtos and get swagger to generate possible derived types within a oneOf field. for this to take effect, you must correctly annotate the base type as follows:

    [JsonPolymorphic(TypeDiscriminatorPropertyName = "_t")]
    [JsonDerivedType(typeof(Apple), "a")]
    [JsonDerivedType(typeof(Orange), "o")]
    public class FruitBase
    {
        ...
    }
    Declaration
    public bool UseOneOfForPolymorphism { get; set; }
    Property Value
    Type Description
    bool

    UsePropertyNamingPolicy

    specify if PropertyNamingPolicy should be used by the default swagger operation processor for identifying/matching schema properties. default is 'true'.

    Declaration
    public bool UsePropertyNamingPolicy { get; set; }
    Property Value
    Type Description
    bool
    In this article
    Back to top Developed by Đĵ ΝιΓΞΗΛψΚ and contributors / Licensed under MIT / Website generated by DocFX