import { IJsonSchemaAttribute } from "./structures/IJsonSchemaAttribute"; /** * OpenAPI 3.0 definition. * * @author Jeongho Nam - https://github.com/samchon */ export declare namespace OpenApiV3 { type Method = "get" | "post" | "put" | "delete" | "options" | "head" | "patch" | "trace"; interface IDocument { openapi: "3.0" | `3.0.${number}`; servers?: IServer[]; info?: IDocument.IInfo; components?: IComponents; paths?: Record; security?: Record[]; tags?: IDocument.ITag[]; } namespace IDocument { interface IInfo { title: string; description?: string; termsOfService?: string; contact?: IContact; license?: ILicense; version: string; } interface ITag { name: string; description?: string; } interface IContact { name?: string; url?: string; email?: string; } interface ILicense { name: string; url?: string; } } interface IServer { url: string; description?: string; variables?: Record; } namespace IServer { interface IVariable { default: string; enum?: string[]; description?: string; } } interface IPath extends Partial> { parameters?: Array | IJsonSchema.IReference<`#/components/parameters/${string}`>>; servers?: IServer[]; summary?: string; description?: string; } interface IOperation { operationId?: string; parameters?: Array | IJsonSchema.IReference<`#/components/parameters/${string}`>>; requestBody?: IOperation.IRequestBody | IJsonSchema.IReference<`#/components/requestBodies/${string}`>; responses?: Record>; servers?: IServer[]; summary?: string; description?: string; security?: Record[]; tags?: string[]; deprecated?: boolean; } namespace IOperation { interface IParameter { name?: string; in: "path" | "query" | "header" | "cookie"; schema: IJsonSchema; required?: boolean; description?: string; example?: any; examples?: Record>; } interface IRequestBody { description?: string; required?: boolean; content?: Record; } interface IResponse { content?: Record; headers?: Record | IJsonSchema.IReference<`#/components/headers/${string}`>>; description?: string; } interface IMediaType { schema?: IJsonSchema; example?: any; examples?: Record>; } } interface IExample { summary?: string; description?: string; value?: any; externalValue?: string; } interface IComponents { schemas?: Record; responses?: Record; parameters?: Record; requestBodies?: Record; securitySchemes?: Record; headers?: Record>; examples?: Record; } type IJsonSchema = IJsonSchema.IBoolean | IJsonSchema.IInteger | IJsonSchema.INumber | IJsonSchema.IString | IJsonSchema.IArray | IJsonSchema.IObject | IJsonSchema.IReference | IJsonSchema.IAllOf | IJsonSchema.IAnyOf | IJsonSchema.IOneOf | IJsonSchema.INullOnly | IJsonSchema.IUnknown; namespace IJsonSchema { interface IBoolean extends Omit, __IAttribute { nullable?: boolean; default?: boolean | null; enum?: Array; } interface IInteger extends Omit, __IAttribute { nullable?: boolean; /** @type int64 */ default?: number | null; /** @type int64 */ enum?: Array; /** @type int64 */ minimum?: number; /** @type int64 */ maximum?: number; exclusiveMinimum?: number | boolean; exclusiveMaximum?: number | boolean; /** * @type uint64 * @exclusiveMinimum 0 */ multipleOf?: number; } interface INumber extends Omit, __IAttribute { nullable?: boolean; default?: number | null; enum?: Array; minimum?: number; maximum?: number; exclusiveMinimum?: number | boolean; exclusiveMaximum?: number | boolean; /** @exclusiveMinimum 0 */ multipleOf?: number; } interface IString extends Omit, __IAttribute { nullable?: boolean; default?: string | null; enum?: Array; format?: "binary" | "byte" | "password" | "regex" | "uuid" | "email" | "hostname" | "idn-email" | "idn-hostname" | "iri" | "iri-reference" | "ipv4" | "ipv6" | "uri" | "uri-reference" | "uri-template" | "url" | "date-time" | "date" | "time" | "duration" | "json-pointer" | "relative-json-pointer" | (string & {}); pattern?: string; /** @type uint64 */ minLength?: number; /** @type uint64 */ maxLength?: number; } interface IArray extends Omit, __IAttribute { nullable?: boolean; items: IJsonSchema; uniqueItems?: boolean; /** @type uint64 */ minItems?: number; /** @type uint64 */ maxItems?: number; } interface IObject extends Omit, __IAttribute { nullable?: boolean; properties?: Record; required?: string[]; additionalProperties?: boolean | IJsonSchema; maxProperties?: number; minProperties?: number; } interface IReference extends __IAttribute { $ref: Key; } interface IAllOf extends __IAttribute { allOf: IJsonSchema[]; } interface IAnyOf extends __IAttribute { anyOf: IJsonSchema[]; } interface IOneOf extends __IAttribute { oneOf: IJsonSchema[]; discriminator?: IOneOf.IDiscriminator; } namespace IOneOf { interface IDiscriminator { propertyName: string; mapping?: Record; } } interface INullOnly extends Omit, __IAttribute { default?: null; } interface IUnknown extends Omit, __IAttribute { default?: any; } interface __IAttribute extends Omit { examples?: any[] | Record; } } type ISecurityScheme = ISecurityScheme.IApiKey | ISecurityScheme.IHttpBasic | ISecurityScheme.IHttpBearer | ISecurityScheme.IOAuth2 | ISecurityScheme.IOpenId; namespace ISecurityScheme { interface IApiKey { type: "apiKey"; in?: "header" | "query" | "cookie"; name?: string; description?: string; } interface IHttpBasic { type: "http"; scheme: "basic"; description?: string; } interface IHttpBearer { type: "http"; scheme: "bearer"; bearerFormat?: string; description?: string; } interface IOAuth2 { type: "oauth2"; flows: IOAuth2.IFlowSet; description?: string; } interface IOpenId { type: "openIdConnect"; openIdConnectUrl: string; description?: string; } namespace IOAuth2 { interface IFlowSet { authorizationCode?: IFlow; implicit?: Omit; password?: Omit; clientCredentials?: Omit; } interface IFlow { authorizationUrl?: string; tokenUrl?: string; refreshUrl?: string; scopes?: Record; } } } }