interface SwaggerUiOptions {
    deepLinking?: boolean;
    defaultModelExpandDepth?: number;
    defaultModelRendering?: "example" | "model";
    defaultModelsExpandDepth?: number;
    displayOperationId?: boolean;
    displayRequestDuration?: boolean;
    docExpansion?: "list" | "full" | "none";
    filter?: string | boolean;
    layout?: string;
    maxDisplayedTags?: number;
    primaryName?: string;
    queryConfigEnabled?: boolean;
    requestSnippets?: {
        generators?: {
            curl_bash?: {
                syntax: string;
                title: string;
            };
            curl_cmd?: {
                syntax: string;
                title: string;
            };
            curl_powershell?: {
                syntax: string;
                title: string;
            };
            defaultExpanded?: boolean;
            languages?: null | ["curl_bash"];
        };
        persistAuthorization?: boolean;
        showMutatedRequest?: boolean;
        supportedSubmitMethods?: string[];
        validatorUrl?: null | string;
        withCredentials?: boolean;
    };
    requestSnippetsEnabled?: boolean;
    showCommonExtensions?: boolean;
    showExtensions?: boolean;
    syntaxHighlight?: false | {
        activate?: boolean;
        theme?: "agate" | "arta" | "monokai" | "nord" | "obsidian" | "tomorrow-night" | "idea";
    };
    tryItOutEnabled?: boolean;
}

Properties

deepLinking?: boolean

If set to true, enables deep linking for tags and operations. See the Deep Linking documentation for more information.

Default

true
defaultModelExpandDepth?: number

The default expansion depth for the model on the model-example section.

Default

1
defaultModelRendering?: "example" | "model"

Controls how the model is shown when the API is first rendered. The user can always switch the rendering for a given model by clicking the 'Model' and 'Example Value' links.

Default

example
defaultModelsExpandDepth?: number

The default expansion depth for models (set to -1 completely hide the models).

Default

1
displayOperationId?: boolean

Controls the display of operationId in operations list.

Default

false.
displayRequestDuration?: boolean

Controls the display of the request duration (in milliseconds) for "Try it out" requests.

Default

false
docExpansion?: "list" | "full" | "none"

Controls the default expansion setting for the operations and tags. It can be 'list' (expands only the tags), 'full' (expands the tags and operations) or 'none' (expands nothing).

Default

list
filter?: string | boolean

If set, enables filtering. The top bar will show an edit box that you can use to filter the tagged operations that are shown. Can be Boolean to enable or disable, or a string, in which case filtering will be enabled using that string as the filter expression. Filtering is case-sensitive matching the filter expression anywhere inside the tag.

layout?: string

The name of a component available via the plugin system to use as the top-level layout for Swagger UI.

Default

StandaloneLayout
maxDisplayedTags?: number

If set, limits the number of tagged operations displayed to at most this many. The default is to show all operations.

primaryName?: string

If the value matches the name of a spec provided in urls, that spec will be displayed when Swagger UI loads, instead of defaulting to the first spec in urls.

queryConfigEnabled?: boolean

Enables overriding configuration parameters via URL search params.

Default

false
requestSnippets?: {
    generators?: {
        curl_bash?: {
            syntax: string;
            title: string;
        };
        curl_cmd?: {
            syntax: string;
            title: string;
        };
        curl_powershell?: {
            syntax: string;
            title: string;
        };
        defaultExpanded?: boolean;
        languages?: null | ["curl_bash"];
    };
    persistAuthorization?: boolean;
    showMutatedRequest?: boolean;
    supportedSubmitMethods?: string[];
    validatorUrl?: null | string;
    withCredentials?: boolean;
}

This is the default configuration section for the requestSnippets plugin.

Type declaration

  • Optional generators?: {
        curl_bash?: {
            syntax: string;
            title: string;
        };
        curl_cmd?: {
            syntax: string;
            title: string;
        };
        curl_powershell?: {
            syntax: string;
            title: string;
        };
        defaultExpanded?: boolean;
        languages?: null | ["curl_bash"];
    }

    Generators for different shell syntax.

    • Optional curl_bash?: {
          syntax: string;
          title: string;
      }

      cURL command for Bash shell

      • syntax: string
      • title: string
    • Optional curl_cmd?: {
          syntax: string;
          title: string;
      }

      cURL command for CMD shell

      • syntax: string
      • title: string
    • Optional curl_powershell?: {
          syntax: string;
          title: string;
      }

      cURL command for PowerShell shell

      • syntax: string
      • title: string
    • Optional defaultExpanded?: boolean

      True if the list of languages should be expanded by default.

    • Optional languages?: null | ["curl_bash"]

      An array to only show certain syntax. Set to ["curl_bash"] to only show curl bash.

  • Optional persistAuthorization?: boolean

    If set to true, it persists authorization data, and it would not be lost on browser close/refresh

    Default

    false
    
  • Optional showMutatedRequest?: boolean

    If set to true, uses the mutated request returned from a requestInterceptor to produce the curl command in the UI, otherwise the request before the requestInterceptor was applied is used.

    Default

    true
    
  • Optional supportedSubmitMethods?: string[]

    List of HTTP methods that have the "Try it out" feature enabled. An empty array disables "Try it out" for all operations. This does not filter the operations from the display.

    Default

    Array=["get", "put", "post", "delete", "options", "head", "patch", "trace"]
    
  • Optional validatorUrl?: null | string

    By default, Swagger UI attempts to validate specs against swagger.io's online validator. You can use this parameter to set a different validator URL, for example for locally deployed validators (Validator Badge). Setting it to either none, 127.0.0.1 or localhost will disable validation.

    Default

    https://validator.swagger.io/validator
    
  • Optional withCredentials?: boolean

    If set to true, enables passing credentials, as defined in the Fetch standard, in CORS requests that are sent by the browser. Note that Swagger UI cannot currently set cookies cross-domain (see swagger-js#1163) - as a result, you will have to rely on browser-supplied cookies (which this setting enables sending) that Swagger UI cannot control.

requestSnippetsEnabled?: boolean

Enables the request snippet section. When disabled, the legacy curl snippet will be used.

Default

false
showCommonExtensions?: boolean

Controls the display of extensions (pattern, maxLength, minLength, maximum, minimum) fields and values for Parameters.

Default

false
showExtensions?: boolean

Controls the display of vendor extensions (x-) fields and values for Operations, Parameters, Responses, and Schema.

Default

true
syntaxHighlight?: false | {
    activate?: boolean;
    theme?: "agate" | "arta" | "monokai" | "nord" | "obsidian" | "tomorrow-night" | "idea";
}

Set to false to deactivate syntax highlighting of payloads and cURL command, can be otherwise an object with the activate and theme properties.

Type declaration

  • Optional activate?: boolean

    Boolean=true. Whether syntax highlighting should be activated or not.

  • Optional theme?: "agate" | "arta" | "monokai" | "nord" | "obsidian" | "tomorrow-night" | "idea"

    Highlight.js syntax coloring theme to use. (Only these 7 styles are available.)

Default

false
tryItOutEnabled?: boolean

Controls whether the "Try it out" section should be enabled by default.

Default

false