interface Oas3DefinitionBase { openapi: string; info?: Oas3Info; servers?: Oas3Server[]; paths?: Oas3Paths; components?: T extends Oas3_1Schema ? Oas3_1Components : Oas3Components; security?: Oas3SecurityRequirement[]; tags?: Oas3Tag[]; externalDocs?: Oas3ExternalDocs; } export interface Oas3Definition extends Oas3DefinitionBase { 'x-webhooks'?: Oas3Webhooks; } export interface Oas3_1Definition extends Oas3DefinitionBase { webhooks?: Oas3Webhooks; } export interface Oas3Info { title: string; version: string; description?: string; termsOfService?: string; contact?: Oas3Contact; license?: Oas3License; } export interface Oas3Server { url: string; description?: string; variables?: { [name: string]: Oas3ServerVariable; }; } export interface Oas3ServerVariable { enum?: string[]; default: string; description?: string; } export interface Oas3Paths { [path: string]: Referenced>; } export interface OasRef { $ref: string; } export type Referenced = OasRef | T; export interface Oas3PathItem { summary?: string; description?: string; get?: Oas3Operation; put?: Oas3Operation; post?: Oas3Operation; delete?: Oas3Operation; options?: Oas3Operation; head?: Oas3Operation; patch?: Oas3Operation; trace?: Oas3Operation; servers?: Oas3Server[]; parameters?: Array>>; } export interface Oas3XCodeSample { lang: string; label?: string; source: string; } export interface Oas3Operation { tags?: string[]; summary?: string; description?: string; externalDocs?: Oas3ExternalDocs; operationId?: string; parameters?: Array>>; requestBody?: Referenced>; responses: Oas3Responses; callbacks?: { [name: string]: Referenced>; }; deprecated?: boolean; security?: Oas3SecurityRequirement[]; servers?: Oas3Server[]; 'x-codeSamples'?: Oas3XCodeSample[]; 'x-code-samples'?: Oas3XCodeSample[]; 'x-hideTryItPanel'?: boolean; } export interface Oas3Parameter { name: string; in?: Oas3ParameterLocation; description?: string; required?: boolean; deprecated?: boolean; allowEmptyValue?: boolean; style?: Oas3ParameterStyle; explode?: boolean; allowReserved?: boolean; schema?: Referenced; example?: unknown; examples?: { [media: string]: Referenced; }; content?: { [media: string]: Oas3MediaType; }; } export interface Oas3Example { value: unknown; summary?: string; description?: string; externalValue?: string; } export interface Oas3Xml { name?: string; namespace?: string; prefix?: string; attribute?: string; wrapped?: string; } interface Oas3XSchemaBase { $ref?: string; properties?: { [name: string]: Referenced; }; additionalProperties?: boolean | T; description?: string; default?: unknown; required?: string[]; readOnly?: boolean; writeOnly?: boolean; deprecated?: boolean; format?: string; externalDocs?: Oas3ExternalDocs; discriminator?: Oas3Discriminator; oneOf?: T[]; anyOf?: T[]; allOf?: T[]; not?: T; title?: string; multipleOf?: number; maximum?: number; minimum?: number; maxLength?: number; minLength?: number; pattern?: string; items?: boolean | T; maxItems?: number; minItems?: number; uniqueItems?: boolean; maxProperties?: number; minProperties?: number; enum?: unknown[]; example?: unknown; xml?: Oas3Xml; 'x-tags'?: string[]; } export interface Oas3Schema extends Oas3XSchemaBase { type?: string; exclusiveMaximum?: boolean; exclusiveMinimum?: boolean; nullable?: boolean; } export interface Oas3_1Schema extends Oas3XSchemaBase { $id?: string; $schema?: string; $anchor?: string; $dynamicAnchor?: string; $dynamicRef?: string; $defs?: { [name: string]: Referenced; }; $vocabulary?: { [uri: string]: boolean; }; $comment?: string; type?: string | string[]; examples?: unknown[]; prefixItems?: Oas3_1Schema[]; exclusiveMaximum?: number; exclusiveMinimum?: number; const?: unknown; contains?: Oas3_1Schema; minContains?: number; maxContains?: number; propertyNames?: Oas3_1Schema; if?: Oas3_1Schema; then?: Oas3_1Schema; else?: Oas3_1Schema; dependentRequired?: { [name: string]: string[]; }; dependentSchemas?: { [name: string]: Referenced; }; patternProperties?: { [name: string]: Referenced; }; unevaluatedItems?: boolean | Oas3_1Schema; unevaluatedProperties?: boolean | Oas3_1Schema; contentSchema?: Oas3_1Schema; contentMediaType?: string; contentEncoding?: string; } export interface Oas3Webhooks { [webhook: string]: Referenced>; } export interface Oas3Discriminator { propertyName: string; mapping?: { [name: string]: string; }; 'x-explicitMappingOnly'?: boolean; } export interface Oas3MediaType { schema?: Referenced; example?: unknown; examples?: { [name: string]: Referenced; }; encoding?: { [field: string]: Oas3Encoding; }; } export interface Oas3Encoding { contentType: string; headers?: { [name: string]: Referenced>; }; style: Oas3ParameterStyle; explode: boolean; allowReserved: boolean; } export type Oas3ParameterLocation = 'query' | 'header' | 'path' | 'cookie'; export type Oas3ParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject'; export interface Oas3RequestBody { description?: string; required?: boolean; content: { [mime: string]: Oas3MediaType; }; } export interface Oas3Responses { [code: string]: Oas3Response; } export interface Oas3Response { description?: string; headers?: { [name: string]: Referenced>; }; content?: { [mime: string]: Oas3MediaType; }; links?: { [name: string]: Referenced; }; } export interface Oas3Link { operationRef?: string; operationId?: string; parameters?: { [name: string]: unknown; }; requestBody?: unknown; description?: string; server?: Oas3Server; } export type Oas3Header = Omit, 'in' | 'name'>; export interface Oas3Callback { [name: string]: Oas3PathItem; } export interface Oas3ComponentsBase { schemas?: { [name: string]: Referenced; }; responses?: { [name: string]: Referenced>; }; parameters?: { [name: string]: Referenced>; }; examples?: { [name: string]: Referenced; }; requestBodies?: { [name: string]: Referenced>; }; headers?: { [name: string]: Referenced>; }; securitySchemes?: { [name: string]: Referenced; }; links?: { [name: string]: Referenced; }; callbacks?: { [name: string]: Referenced>; }; } export interface Oas3_1Components extends Oas3ComponentsBase { pathItems?: { [name: string]: Referenced>; }; } export interface Oas3Components extends Oas3ComponentsBase { } export type Oas3ComponentName = keyof Oas3ComponentsBase; export interface Oas3SecurityRequirement { [name: string]: string[]; } export interface Oas3SecurityScheme { type: 'apiKey' | 'http' | 'oauth2' | 'openIdConnect' | 'mutualTLS'; description?: string; name?: string; in?: 'query' | 'header' | 'cookie'; scheme?: string; bearerFormat?: string; flows: { implicit?: { refreshUrl?: string; scopes: Record; authorizationUrl: string; }; password?: { refreshUrl?: string; scopes: Record; tokenUrl: string; }; clientCredentials?: { refreshUrl?: string; scopes: Record; tokenUrl: string; }; authorizationCode?: { refreshUrl?: string; scopes: Record; tokenUrl: string; }; }; openIdConnectUrl?: string; } export interface Oas3Tag { name: string; description?: string; externalDocs?: Oas3ExternalDocs; 'x-displayName'?: string; } export interface Oas3ExternalDocs { description?: string; url: string; } export interface Oas3Contact { name?: string; url?: string; email?: string; } export interface Oas3License { name: string; url?: string; } export {};