OpenAPI document.

OpenApi.IDocument represents an OpenAPI document of emended OpenAPI v3.1.

In other words, OpenApi.IDocument is a structure of swagger.json file of OpenAPI v3.1 specification, but a little bit shrunk to remove ambiguous and duplicated expressions of OpenAPI v3.1 for the convenience and clarity.

interface IDocument {
    components: OpenApi.IComponents;
    info?: OpenApi.IDocument.IInfo;
    openapi: `3.1.${number}`;
    paths?: Record<string, OpenApi.IPath>;
    security?: Record<string, string[]>[];
    servers?: OpenApi.IServer[];
    tags?: OpenApi.IDocument.ITag[];
    webhooks?: Record<string, OpenApi.IPath>;
    "x-samchon-emended-v4": true;
}

Properties

components: OpenApi.IComponents

An object to hold reusable data structures.

It stores both DTO schemas and security schemes.

For reference, nestia defines every object and alias types as reusable DTO schemas. The alias type means that defined by type keyword in TypeScript.

Information about the API.

openapi: `3.1.${number}`

OpenAPI version number.

paths?: Record<string, OpenApi.IPath>

The available paths and operations for the API.

The 1st key is the path, and the 2nd key is the HTTP method.

security?: Record<string, string[]>[]

A declaration of which security mechanisms can be used across the API.

When this property is configured, it will be overwritten in every API route.

For reference, the key means the name of the security scheme and the value means the scopes. The scopes can be used only when the target security scheme is oauth2 type, especially for ISwaggerSecurityScheme.IOAuth2.IFlow.scopes property.

servers?: OpenApi.IServer[]

List of servers that provide the API.

List of tag names with descriptions.

It is possible to omit this property or skip some tag names even if the tag name is used in the API routes. In that case, the tag name will be displayed (in Swagger-UI) without description.

webhooks?: Record<string, OpenApi.IPath>

An object to hold Webhooks.

Its structure is the same as paths, so the first key is the path, and the second key is the HTTP method.

"x-samchon-emended-v4": true

Flag for indicating this document is emended by @samchon/openapi v4.