import type { JSONSchema4, JSONSchema6, JSONSchema7, JSONSchema7TypeName } from "json-schema"; export interface OpenApiObject { openapi: string; info: InfoObject; servers?: ServerObject[]; paths: PathsObject; components?: ComponentsObject; security?: SecurityRequirementObject[]; tags?: TagObject[]; externalDocs?: ExternalDocumentationObject; swagger?: string; webhooks?: PathsObject; "x-webhooks"?: PathsObject; "x-tagGroups"?: TagGroupObject[]; } export interface OpenApiObjectWithRef { openapi: string; info: InfoObject; servers?: ServerObject[]; paths: PathsObjectWithRef; components?: ComponentsObjectWithRef; security?: SecurityRequirementObject[]; tags?: TagObject[]; externalDocs?: ExternalDocumentationObject; } export interface InfoObject { title: string; description?: string; termsOfService?: string; contact?: ContactObject; license?: LicenseObject; version: string; tags?: TagObject[]; "x-logo"?: LogoObject; "x-dark-logo"?: LogoObject; logo?: LogoObject; darkLogo?: LogoObject; } export interface LogoObject { url?: string; } export interface ContactObject { name?: string; url?: string; email?: string; } export interface LicenseObject { name: string; url?: string; identifier?: string; } export interface ServerObject { url: string; description?: string; variables?: Record; } export interface ServerVariable { enum?: string[]; default: string; description?: string; } export interface ComponentsObject { schemas?: Record; responses?: Record; parameters?: Record; examples?: Record; requestBodies?: Record; headers?: Record; securitySchemes?: Record; links?: Record; callbacks?: Record; } export interface ComponentsObjectWithRef { schemas?: Record; responses?: Record; parameters?: Record; examples?: Record; requestBodies?: Record; headers?: Record; securitySchemes?: Record; links?: Record; callbacks?: Record; } export type PathsObject = Record; export type PathsObjectWithRef = Record; export interface PathItemObject { $ref?: string; summary?: string; description?: string; get?: OperationObject; put?: OperationObject; post?: OperationObject; delete?: OperationObject; options?: OperationObject; head?: OperationObject; patch?: OperationObject; trace?: OperationObject; servers?: ServerObject[]; parameters?: ParameterObject[]; } export interface PathItemObjectWithRef { $ref?: string; summary?: string; description?: string; get?: OperationObjectWithRef; put?: OperationObjectWithRef; post?: OperationObjectWithRef; delete?: OperationObjectWithRef; options?: OperationObjectWithRef; head?: OperationObjectWithRef; patch?: OperationObjectWithRef; trace?: OperationObjectWithRef; servers?: ServerObject[]; parameters?: (ParameterObjectWithRef | ReferenceObject)[]; } export interface OperationObject { tags?: string[]; summary?: string; description?: string; externalDocs?: ExternalDocumentationObject; operationId?: string; parameters?: ParameterObject[]; requestBody?: RequestBodyObject; responses: ResponsesObject; callbacks?: Record; deprecated?: boolean; security?: SecurityRequirementObject[]; servers?: ServerObject[]; "x-position"?: number; "x-deprecated-description"?: string; } export interface OperationObjectWithRef { tags?: string[]; summary?: string; description?: string; externalDocs?: ExternalDocumentationObject; operationId?: string; parameters?: (ParameterObjectWithRef | ReferenceObject)[]; requestBody?: RequestBodyObjectWithRef | ReferenceObject; responses: ResponsesObjectWithRef; callbacks?: Record; deprecated?: boolean; security?: SecurityRequirementObject[]; servers?: ServerObject[]; "x-deprecated-description"?: string; } export interface ExternalDocumentationObject { description?: string; url: string; } export interface ParameterObject { name: string; in: "query" | "header" | "path" | "cookie"; description?: string; required?: boolean; deprecated?: boolean; allowEmptyValue?: boolean; style?: string; explode?: string; allowReserved?: boolean; schema?: SchemaObject; example?: any; examples?: Record; content?: Record; param?: Object; "x-enumDescriptions"?: Record; } export interface ParameterObjectWithRef { name: string; in: string; description?: string; required?: boolean; deprecated?: boolean; allowEmptyValue?: boolean; style?: string; explode?: string; allowReserved?: boolean; schema?: SchemaObjectWithRef | ReferenceObject; example?: any; examples?: Record; content?: Record; } export interface RequestBodyObject { description?: string; content: Record; required?: boolean; } export interface RequestBodyObjectWithRef { description?: string; content: Record; required?: boolean; } export interface MediaTypeObject { schema?: SchemaObject; example?: any; examples?: Record; encoding?: Record; type?: any; } export interface MediaTypeObjectWithRef { schema?: SchemaObjectWithRef | ReferenceObject; example?: any; examples?: Record; encoding?: Record; } export interface EncodingObject { contentType?: string; headers?: Record; style?: string; explode?: boolean; allowReserved?: boolean; } export interface EncodingObjectWithRef { contentType?: string; headers?: Record; style?: string; explode?: boolean; allowReserved?: boolean; } export type ResponsesObject = Record; export type ResponsesObjectWithRef = Record; export interface ResponseObject { description: string; headers?: Record; content?: Record; links?: Record; } export interface ResponseObjectWithRef { description: string; headers?: Record; content?: Record; links?: Record; } export type CallbackObject = Record; export type CallbackObjectWithRef = Record; export interface ExampleObject { summary?: string; description?: string; value?: any; externalValue?: string; } export interface LinkObject { operationRef?: string; operationId?: string; parameters?: Record; requestBody?: any; description?: string; server?: ServerObject; } export type HeaderObject = Omit; export type HeaderObjectWithRef = Omit; export interface TagObject { name?: string; description?: string; externalDocs?: ExternalDocumentationObject; "x-displayName"?: string; } export interface TagGroupObject { name: string; tags: string[]; } export interface ReferenceObject { $ref: string; } export type JSONSchema = JSONSchema4 | JSONSchema6 | JSONSchema7; export type SchemaType = JSONSchema7TypeName; export type SchemaObject = Omit & { type?: SchemaType; allOf?: SchemaObject[]; oneOf?: SchemaObject[]; anyOf?: SchemaObject[]; not?: SchemaObject; items?: SchemaObject; properties?: Record; additionalProperties?: boolean | SchemaObject; nullable?: boolean; discriminator?: DiscriminatorObject; readOnly?: boolean; writeOnly?: boolean; xml?: XMLObject; externalDocs?: ExternalDocumentationObject; example?: any; deprecated?: boolean; "x-tags"?: string[]; "x-enumDescriptions"?: Record; }; export type SchemaObjectWithRef = Omit & { type?: SchemaType; allOf?: (SchemaObject | ReferenceObject)[]; oneOf?: (SchemaObject | ReferenceObject)[]; anyOf?: (SchemaObject | ReferenceObject)[]; not?: SchemaObject | ReferenceObject; items?: SchemaObject | ReferenceObject; properties?: Record; additionalProperties?: boolean | SchemaObject | ReferenceObject; nullable?: boolean; discriminator?: DiscriminatorObject; readOnly?: boolean; writeOnly?: boolean; xml?: XMLObject; externalDocs?: ExternalDocumentationObject; example?: any; deprecated?: boolean; }; export interface DiscriminatorObject { propertyName: string; mapping?: Record; } export interface XMLObject { name?: string; namespace?: string; prefix?: string; attribute?: boolean; wrapped?: boolean; } export type SecuritySchemeObject = ApiKeySecuritySchemeObject | HttpSecuritySchemeObject | Oauth2SecuritySchemeObject | OpenIdConnectSecuritySchemeObject; export interface ApiKeySecuritySchemeObject { type: "apiKey"; description?: string; name: string; in: "query" | "header" | "cookie"; } export interface HttpSecuritySchemeObject { type: "http"; description?: string; scheme: string; bearerFormat?: string; name?: string; in?: string; } export interface Oauth2SecuritySchemeObject { type: "oauth2"; description?: string; flows: OAuthFlowsObject; } export interface OpenIdConnectSecuritySchemeObject { type: "openIdConnect"; description?: string; openIdConnectUrl: string; } export interface OAuthFlowsObject { implicit?: OAuthFlowObject; password?: OAuthFlowObject; clientCredentials?: OAuthFlowObject; authorizationCode?: OAuthFlowObject; } export interface OAuthFlowObject { authorizationUrl?: string; tokenUrl?: string; refreshUrl?: string; scopes: Record; } export type SecurityRequirementObject = Record;