Documentation
    Preparing search index...

    Building swagger.json is also possible.

    interface ISwaggerConfig {
        additional?: boolean;
        beautify?: number | boolean;
        decompose?: boolean;
        info?: Partial<IInfo>;
        openapi?: "2.0" | "3.0" | "3.1" | "3.2";
        output: string;
        security?: Record<string, ISecurityScheme>;
        servers?: IServer[];
        tags?: ITag[];
        operationId?(
            props: {
                class: string;
                function: string;
                method: "HEAD" | "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "QUERY";
                path: string;
            },
        ): string;
    }
    Index

    Properties

    additional?: boolean

    Whether to include additional information or not.

    If configured to be true, those properties would be added into each API endpoinnt.

    • x-nestia-method
    • x-nestia-namespace x-nestia-jsDocTags`
    false
    
    beautify?: number | boolean

    Whether to beautify JSON content or not.

    If you configure this property to be true, the swagger.json file would be beautified with indentation (2 spaces) and line breaks. If you configure numeric value instead, the indentation would be specified by the number.

    false
    
    decompose?: boolean

    Decompose query DTO.

    If you configure this property to be true, the query DTO would be decomposed into individual query parameters per each property. Otherwise you set it to be false, the query DTO would be one object type which contains all of query parameters.

    true
    
    info?: Partial<IInfo>

    API information.

    If omitted, package.json content would be used instead.

    openapi?: "2.0" | "3.0" | "3.1" | "3.2"

    OpenAPI version.

    If you configure this property to be 2.0 or 3.0, the newly generated swagger.json file would follow the specified OpenAPI version. The newly generated swagger.json file would be downgraded from the OpenAPI v3.1 specification by OpenApi.downgrade method.

    3.1
    
    output: string

    Response path of the swagger.json.

    If you've configured only directory, the file name would be the swagger.json. Otherwise you've configured the full path with file name and extension, the swagger.json file would be renamed to it.

    security?: Record<string, ISecurityScheme>

    Security schemes.

    When generating swagger.json file through nestia, if your controllers or theirs methods have a security key which is not enrolled in here property, it would be an error.

    servers?: IServer[]

    List of server addresses.

    tags?: ITag[]

    List of tag names with description.

    It is possible to omit this property or skip some tag name even if the tag name is used in the API routes. In that case, the tag name would be used without description.

    Of course, if you've written a comment like @tag {name} {description}, you can entirely replace this property specification.

    Methods

    • Operation ID generator.

      Parameters

      • props: {
            class: string;
            function: string;
            method: "HEAD" | "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "QUERY";
            path: string;
        }

        Properties of the API endpoint.

      Returns string

      Operation ID.