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": 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 be configured, it would be overwritten in every API routes.

For reference, key means the name of security scheme and value means the scopes. The scopes can be used only when 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 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 displayed (in Swagger-UI) without description.

webhooks?: Record<string, OpenApi.IPath>

An object to hold Webhooks.

Its structure is same with paths, so that the 1st key is the path, and the 2nd key is the HTTP method.

"x-samchon-emended": true

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