@trapi/swagger
Version:
Generate Swagger files from a decorator APIs.
830 lines (829 loc) • 26.7 kB
text/typescript
import { BaseError } from "@ebec/core";
import { BaseType, CollectionFormat, EnumType, Extension, IntersectionType, Metadata, Method, NestedObjectLiteralType, Parameter, ParameterSource, RefAliasType, RefEnumType, RefObjectType, ReferenceType, ResolverProperty, Response, UnionType, Validators, VariableType } from "@trapi/core";
//#region src/core/constants.d.ts
declare const Version: {
readonly V2: "v2";
readonly V3: "v3";
readonly V3_1: "v3.1";
readonly V3_2: "v3.2";
};
type Version = typeof Version[keyof typeof Version];
declare const DocumentFormat: {
readonly YAML: "yaml";
readonly JSON: "json";
};
type DocumentFormat = typeof DocumentFormat[keyof typeof DocumentFormat];
declare const SecurityType: {
readonly API_KEY: "apiKey";
readonly BASIC: "basic";
readonly HTTP: "http";
readonly OAUTH2: "oauth2";
};
type SecurityType = typeof SecurityType[keyof typeof SecurityType];
//#endregion
//#region src/core/schema/constants.d.ts
declare const TransferProtocol: {
readonly HTTP: "http";
readonly HTTPS: "https";
readonly WS: "ws";
readonly WSS: "wss";
};
type TransferProtocol = typeof TransferProtocol[keyof typeof TransferProtocol];
declare const DataFormatName: {
readonly INT_32: "int32";
readonly INT_64: "int64";
readonly FLOAT: "float";
readonly DOUBLE: "double";
readonly BYTE: "byte";
readonly BINARY: "binary";
readonly DATE: "date";
readonly DATE_TIME: "date-time";
readonly PASSWORD: "password";
};
type DataFormatName = typeof DataFormatName[keyof typeof DataFormatName];
declare const DataTypeName: {
readonly VOID: "void";
readonly INTEGER: "integer";
readonly NUMBER: "number";
readonly BOOLEAN: "boolean";
readonly STRING: "string";
readonly ARRAY: "array";
readonly OBJECT: "object";
readonly FILE: "file";
};
type DataTypeName = typeof DataTypeName[keyof typeof DataTypeName];
//#endregion
//#region src/core/schema/types.d.ts
type BaseSpec = {
info: Info;
tags?: Tag[];
externalDocs?: ExternalDocs;
};
type Info = {
title: string;
version: string;
description?: string;
termsOfService?: string;
contact?: Contact;
license?: License;
};
type Contact = {
name?: string;
email?: string;
url?: string;
};
type License = {
name: string;
url?: string;
};
type ExternalDocs = {
url: string;
description?: string;
};
type Tag = {
name: string;
description?: string;
externalDocs?: ExternalDocs;
};
type BaseResponse = {
description: string;
};
type BaseOperation<P, R> = {
responses: {
[name: string]: R;
};
summary?: string;
description?: string;
externalDocs?: ExternalDocs;
operationId?: string;
consumes?: string[];
parameters?: P[];
schemes?: string[];
deprecated?: boolean;
security?: Record<string, string[]>[];
tags?: string[];
};
type Example = {
value: unknown | unknown[];
summary?: string;
description?: string;
};
type BaseSchema<T> = {
type?: `${DataTypeName}` | Array<`${DataTypeName}` | 'null'>;
format?: `${DataFormatName}`;
title?: string;
description?: string;
default?: string | boolean | number | any;
multipleOf?: number;
maximum?: number;
exclusiveMaximum?: number;
minimum?: number;
exclusiveMinimum?: number;
maxLength?: number;
minLength?: number;
pattern?: string;
maxItems?: number;
minItems?: number;
uniqueItems?: boolean;
maxProperties?: number;
minProperties?: number;
enum?: Array<string | number | boolean>;
'x-enum-varnames'?: string[];
items?: T | BaseSchema<T> | any;
additionalProperties?: boolean | {
[ref: string]: string;
} | T;
properties?: {
[propertyName: string]: T;
};
discriminator?: string;
readOnly?: boolean;
xml?: XML;
externalDocs?: ExternalDocs;
example?: {
[exampleName: string]: Example;
} | unknown;
required?: string[];
$ref?: string;
};
type XML = {
type?: string;
namespace?: string;
prefix?: string;
attribute?: string;
wrapped?: boolean;
};
type BaseParameter = {
name: string;
in: `${ParameterSourceV2}`;
required?: boolean;
description?: string;
};
type BodyParameter = BaseParameter & {
in: typeof ParameterSourceV2.BODY;
};
type QueryParameter = BaseParameter & {
in: typeof ParameterSourceV2.QUERY;
allowEmptyValue?: boolean;
collectionFormat?: `${CollectionFormat}`;
};
type PathParameter = BaseParameter & {
in: typeof ParameterSourceV2.PATH;
};
type HeaderParameter = BaseParameter & {
in: typeof ParameterSourceV2.HEADER;
};
type FormDataParameter = BaseParameter & {
in: typeof ParameterSourceV2.FORM_DATA;
collectionFormat?: `${CollectionFormat}`;
};
type Path<Operation, Parameter> = {
$ref?: string;
get?: Operation;
put?: Operation;
post?: Operation;
delete?: Operation;
options?: Operation;
head?: Operation;
patch?: Operation;
parameters?: Parameter[];
};
//#endregion
//#region src/core/schema/v2/types.d.ts
type SpecV2 = BaseSpec & {
swagger: '2.0';
host?: string;
basePath?: string;
schemes?: string[];
consumes?: string[];
produces?: string[];
paths: {
[pathName: string]: Path<OperationV2, ResponseV2>;
};
definitions?: {
[definitionsName: string]: SchemaV2;
};
parameters?: {
[parameterName: string]: ParameterV2;
};
responses?: {
[responseName: string]: ResponseV2;
};
security?: SecurityV2[];
securityDefinitions?: {
[name: string]: SecurityV2;
};
};
type PatternField = `x-${string}`;
type BaseParameterV2 = {
type?: `${DataTypeName}`;
format?: `${DataFormatName}`;
allowEmptyValue?: boolean;
items?: Record<string, any>;
collectionFormat?: `${CollectionFormat}`;
default?: any;
maximum?: number;
exclusiveMaximum?: number;
minimum?: number;
exclusiveMinimum?: number;
maxLength?: number;
minLength?: number;
pattern?: string;
maxItems?: number;
minItems?: number;
uniqueItems?: number;
enum?: unknown[];
multipleOf?: number;
};
type BodyParameterV2 = BodyParameter & {
schema: BaseSchema<SchemaV2>;
};
type QueryParameterV2 = QueryParameter & BaseParameterV2;
type PathParameterV2 = PathParameter & BaseParameterV2;
type HeaderParameterV2 = HeaderParameter & BaseParameterV2;
type FormDataParameterV2 = FormDataParameter & BaseParameterV2;
type ParameterV2 = (BodyParameterV2 | QueryParameterV2 | PathParameterV2 | HeaderParameterV2 | FormDataParameterV2) & {
[key: PatternField]: any | undefined;
};
type OperationV2 = BaseOperation<ParameterV2, ResponseV2> & {
consumes?: string[];
produces?: string[];
schemes?: `${TransferProtocol}`[];
};
type ResponseV2 = BaseResponse & {
schema?: SchemaV2;
headers?: {
[headerName: string]: HeaderV2;
};
examples?: {
[exampleName: string]: unknown;
};
};
type HeaderV2 = {
type: 'string' | 'number' | 'integer' | 'boolean' | 'array';
};
interface SchemaV2 extends BaseSchema<SchemaV2> {
['x-nullable']?: boolean;
['x-deprecated']?: boolean;
}
type BasicSecurityV2 = BaseSecurity & {
type: typeof SecurityType.BASIC;
};
type BaseOAuthSecurityV2 = BaseSecurity & {
type: typeof SecurityType.OAUTH2;
};
type OAuth2ImplicitSecurityV2 = BaseOAuthSecurityV2 & {
flow: 'implicit';
authorizationUrl: string;
scopes?: Record<string, string>;
};
type OAuth2PasswordSecurityV2 = BaseOAuthSecurityV2 & {
flow: 'password';
tokenUrl: string;
scopes?: Record<string, string>;
};
type OAuth2ApplicationSecurityV2 = BaseOAuthSecurityV2 & {
flow: 'application';
tokenUrl: string;
scopes?: Record<string, string>;
};
type OAuth2AccessCodeSecurityV2 = BaseOAuthSecurityV2 & {
flow: 'accessCode';
tokenUrl: string;
authorizationUrl: string;
scopes?: Record<string, string>;
};
type OAuth2SecurityV2 = OAuth2AccessCodeSecurityV2 | OAuth2ApplicationSecurityV2 | OAuth2ImplicitSecurityV2 | OAuth2PasswordSecurityV2;
type SecurityV2 = BasicSecurityV2 | OAuth2SecurityV2 | ApiKeySecurity;
//#endregion
//#region src/core/schema/v2/constants.d.ts
declare const ParameterSourceV2: {
readonly BODY: "body";
readonly FORM_DATA: "formData";
readonly HEADER: "header";
readonly PATH: "path";
readonly QUERY: "query";
};
type ParameterSourceV2 = typeof ParameterSourceV2[keyof typeof ParameterSourceV2];
//#endregion
//#region src/core/schema/v3/constants.d.ts
declare const ParameterSourceV3: {
readonly COOKIE: "cookie";
readonly HEADER: "header";
readonly PATH: "path";
readonly QUERY: "query";
};
type ParameterSourceV3 = typeof ParameterSourceV3[keyof typeof ParameterSourceV3];
//#endregion
//#region src/core/schema/v3/types.d.ts
type SpecV3 = BaseSpec & {
openapi: string;
servers: ServerV3[];
components: ComponentsV3;
paths: PathsV3;
};
type ServerV3 = {
url: string;
description?: string;
variables?: Record<string, VariableV3>;
};
type VariableV3 = {
enum?: string[];
description?: string;
default: string;
};
type ComponentsV3 = {
callbacks?: {
[name: string]: any;
};
examples?: {
[name: string]: Example | string;
};
headers?: {
[name: string]: any;
};
links?: {
[name: string]: any;
};
parameters?: {
[name: string]: ParameterV3;
};
requestBodies?: {
[name: string]: any;
};
responses?: {
[name: string]: ResponseV3;
};
schemas?: {
[name: string]: SchemaV3;
};
securitySchemes?: {
[name: string]: SecurityV3;
};
};
type PathsV3 = {
[key: string]: Path<OperationV3, ParameterV3>;
};
type BaseParameterV3 = {
/**
* Default: false
*/
deprecated?: boolean;
/**
* Default: false
*/
allowEmptyValue?: boolean;
style?: string;
explode?: boolean;
allowReserved?: boolean;
schema?: SchemaV3;
example?: unknown;
examples?: Record<string, Example | string>;
content?: Record<string, any>;
};
type BodyParameterV3 = BodyParameter & BaseParameterV3;
type CookieParameterV3 = BaseParameterV3 & {
in: typeof ParameterSourceV3.COOKIE;
};
type QueryParameterV3 = QueryParameter & BaseParameterV3;
type PathParameterV3 = PathParameter & BaseParameterV3;
type HeaderParameterV3 = HeaderParameter & BaseParameterV3;
type FormDataParameterV3 = FormDataParameter & BaseParameterV3;
type PatternFieldV3 = `x-${string}`;
type ParameterV3 = (BodyParameterV3 | CookieParameterV3 | QueryParameterV3 | PathParameterV3 | HeaderParameterV3 | FormDataParameterV3) & {
[key: PatternFieldV3]: unknown;
};
type OperationV3 = BaseOperation<ParameterV3, ResponseV3> & {
requestBody?: RequestBodyV3;
[key: string]: unknown;
};
type ResponseV3 = BaseResponse & {
content?: Record<string, {
schema: SchemaV3;
examples?: Record<string, Example>;
}>;
headers?: {
[name: string]: HeaderV3;
};
};
type HeaderV3 = Omit<BaseSchema<SchemaV3>, 'required'> & {
required?: boolean;
description?: string;
example?: unknown;
examples?: Record<string, Example | string>;
schema: SchemaV3;
type?: `${DataTypeName}`;
format?: `${DataFormatName}`;
};
type RequestBodyV3 = {
content: {
[name: string]: MediaTypeV3;
};
description?: string;
required?: boolean;
};
type MediaTypeV3 = {
schema?: SchemaV3;
example?: Example;
examples?: Record<string, Example | string>;
encoding?: {
[name: string]: any;
};
};
interface SchemaV3 extends Omit<BaseSchema<SchemaV3>, 'discriminator'> {
discriminator?: string | {
propertyName: string;
mapping?: Record<string, string>;
};
nullable?: boolean;
anyOf?: SchemaV3[];
allOf?: SchemaV3[];
oneOf?: SchemaV3[];
deprecated?: boolean;
}
type BasicSecurityV3 = BaseSecurity & {
type: typeof SecurityType.HTTP;
scheme: 'basic';
};
type OAuth2SecurityV3 = BaseSecurity & {
type: typeof SecurityType.OAUTH2;
flows: {
implicit?: OAuth2ImplicitFlowV3;
password?: OAuth2PasswordFlowV3;
authorizationCode?: OAuth2AuthorizationCodeFlowV3;
clientCredentials?: OAuth2ClientCredentialsFlowV3;
};
};
type Oauth2BaseFlowV3 = {
scopes?: Record<string, string>;
refreshUrl?: string;
};
type OAuth2ImplicitFlowV3 = Oauth2BaseFlowV3 & {
authorizationUrl: string;
};
type OAuth2PasswordFlowV3 = Oauth2BaseFlowV3 & {
tokenUrl: string;
};
type OAuth2AuthorizationCodeFlowV3 = Oauth2BaseFlowV3 & {
authorizationUrl: string;
tokenUrl: string;
};
type OAuth2ClientCredentialsFlowV3 = Oauth2BaseFlowV3 & {
tokenUrl: string;
};
type SecurityV3 = BasicSecurityV3 | OAuth2SecurityV3 | ApiKeySecurity;
//#endregion
//#region src/core/types.d.ts
type ValidatorOpenApiMeta = {
kind: 'keyword';
key: string;
} | {
kind: 'format';
format: string;
} | {
kind: 'ignore';
};
/**
* Resolves the OpenAPI specification output type for a given `Version`.
*
* Use this to type wrapper functions around `generateSwagger()` whose return
* type depends on the requested `Version`:
*
* ```ts
* type GeneratorOutput<V extends `${Version}`> = OutputForVersion<V>;
* ```
*
* Internally `Version.V2` resolves to `SpecV2`; everything else resolves to
* `SpecV3` (which models OpenAPI 3.0, 3.1, and 3.2 — they share a schema).
*/
type OutputForVersion<V extends `${Version}`> = V extends typeof Version.V2 ? SpecV2 : SpecV3;
declare module '@trapi/core' {
interface ValidatorMeta {
openApi?: ValidatorOpenApiMeta;
}
}
type DocumentFormatData = {
path: string;
name: string;
content?: string;
};
type BaseSecurity = {
description?: string;
};
type ApiKeySecurity = BaseSecurity & {
type: typeof SecurityType.API_KEY;
name: string;
in: 'query' | 'header';
};
type BasicSecurity = BaseSecurity & {
type: typeof SecurityType.HTTP;
scheme: 'basic';
};
type OAuth2Security = BaseSecurity & {
type: typeof SecurityType.OAUTH2;
flows: {
implicit?: OAuth2ImplicitFlow;
password?: OAuth2PasswordFlow;
authorizationCode?: OAuth2AuthorizationCodeFlow;
clientCredentials?: OAuth2ClientCredentialsFlow;
};
};
type Oauth2BaseFlow = {
scopes?: Record<string, string>;
refreshUrl?: string;
};
type OAuth2ImplicitFlow = Oauth2BaseFlow & {
authorizationUrl: string;
};
type OAuth2PasswordFlow = Oauth2BaseFlow & {
tokenUrl: string;
};
type OAuth2AuthorizationCodeFlow = Oauth2BaseFlow & {
authorizationUrl: string;
tokenUrl: string;
};
type OAuth2ClientCredentialsFlow = Oauth2BaseFlow & {
tokenUrl: string;
};
type SecurityDefinition = ApiKeySecurity | BasicSecurity | OAuth2Security;
type SecurityDefinitions = {
[key: string]: SecurityDefinition;
};
//#endregion
//#region src/core/config/types.d.ts
type ServerOption = {
url: string;
description?: string;
};
type SpecGeneratorOptions = {
/**
* API host, e.g. localhost:3000 or https://myapi.com
*/
servers?: ServerOption[];
/**
* API version number; defaults to npm package version
*/
version?: string;
/**
* API name; defaults to npm package name
*/
name?: string;
/**
* 'API description; defaults to npm package description
*/
description?: string;
/**
* API license; defaults to npm package license
*/
license?: string;
/**
* Extend generated swagger spec with this object
* Note that generated properties will always take precedence over what get specified here
*/
specificationExtra?: Record<string, any>;
/**
* Security Definitions Object
* A declaration of the security schemes available to be used in the
* specification. This does not enforce the security schemes on the operations
* and only serves to provide the relevant details for each scheme.
*/
securityDefinitions?: SecurityDefinitions;
/**
* Default consumes property for the entire API
*/
consumes?: string[];
/**
* Default produces property for the entire API
*/
produces?: string[];
/**
* Default collectionFormat property for query parameters of array type.
* Possible values are `csv`, `ssv`, `tsv`, `pipes`, `multi`. If not specified, Swagger defaults to `csv`.
*/
collectionFormat?: `${CollectionFormat}`;
};
type SpecGeneratorOptionsInput = Omit<Partial<SpecGeneratorOptions>, 'servers'> & {
servers?: string | string[] | ServerOption | ServerOption[];
};
type SwaggerSaveOptions = {
/**
* Working directory the output file is written to. Relative paths are resolved against it.
*
* default: process.cwd()
*/
cwd?: string;
/**
* File format to emit.
*
* default: DocumentFormat.JSON
*/
format?: `${DocumentFormat}`;
/**
* File name, with or without extension. Any `.json` / `.yaml` suffix is stripped
* and replaced to match `format`.
*
* default: 'swagger'
*/
name?: string;
};
type SwaggerGenerateData = {
/**
* API name; defaults to npm package name.
*/
name?: string;
/**
* API version; defaults to npm package version.
*/
version?: string;
/**
* API description; defaults to npm package description.
*/
description?: string;
/**
* API license; defaults to npm package license.
*/
license?: string;
/**
* API servers.
*/
servers?: string | string[] | ServerOption | ServerOption[];
/**
* Security scheme definitions.
*/
securityDefinitions?: SecurityDefinitions;
/**
* Default consumes content types.
*/
consumes?: string[];
/**
* Default produces content types.
*/
produces?: string[];
/**
* Default collection format for array query parameters.
*/
collectionFormat?: `${CollectionFormat}`;
/**
* Extra properties to merge into the generated spec.
*/
extra?: Record<string, any>;
};
type SwaggerGenerateOptions = {
/**
* Swagger/OpenAPI spec version to generate (e.g. 'v2', 'v3').
*/
version: `${Version}`;
/**
* Pre-built metadata. Produce it with `generateMetadata` from `@trapi/metadata`,
* or supply your own `Metadata`-shaped value (e.g. read from a JSON fixture or
* an alternate extractor) — `@trapi/swagger` does not depend on the TypeScript
* compiler.
*/
metadata: Metadata;
/**
* Document content (info, servers, security, etc.).
*/
data?: SwaggerGenerateData;
};
//#endregion
//#region src/core/config/utils.d.ts
declare function buildSpecGeneratorOptions(input: SpecGeneratorOptionsInput): SpecGeneratorOptions;
//#endregion
//#region src/core/error/codes.d.ts
declare const SwaggerErrorCode: {
readonly SPEC_NOT_BUILT: "SWAGGER_SPEC_NOT_BUILT";
readonly ENUM_UNSUPPORTED_TYPE: "SWAGGER_ENUM_UNSUPPORTED_TYPE";
readonly BODY_PARAMETER_DUPLICATE: "SWAGGER_BODY_PARAMETER_DUPLICATE";
readonly BODY_FORM_CONFLICT: "SWAGGER_BODY_FORM_CONFLICT";
readonly PARAMETER_SOURCE_UNSUPPORTED: "SWAGGER_PARAMETER_SOURCE_UNSUPPORTED";
readonly METADATA_INVALID: "SWAGGER_METADATA_INVALID";
};
//#endregion
//#region src/core/error/module.d.ts
declare class SwaggerError extends BaseError {}
//#endregion
//#region src/core/utils/character.d.ts
declare function removeDuplicateSlashes(str: string): string;
declare function removeFinalCharacter(str: string, character: string): string;
//#endregion
//#region src/core/utils/path.d.ts
declare function normalizePathParameters(str: string): string;
declare function joinPaths(...segments: string[]): string;
//#endregion
//#region src/core/utils/object.d.ts
declare function hasOwnProperty<X extends object, Y extends PropertyKey>(obj: X, prop: Y): obj is X & Record<Y, unknown>;
//#endregion
//#region src/core/utils/value.d.ts
declare function transformValueTo(type: 'string' | 'number' | 'integer' | 'boolean' | 'bigint', value: unknown): string | number | boolean | null;
//#endregion
//#region src/adapters/generator/abstract.d.ts
declare abstract class AbstractSpecGenerator<Spec extends SpecV2 | SpecV3, Schema extends SchemaV3 | SchemaV2> {
protected spec: Spec | undefined;
protected readonly metadata: Metadata;
protected readonly config: SpecGeneratorOptions;
constructor(metadata: Metadata, config: SpecGeneratorOptionsInput);
abstract build(): Promise<Spec>;
protected buildInfo(): Info;
protected buildTags(): ({
name: string;
} & Record<string, unknown>)[];
protected getSchemaForType(type: BaseType): Schema | BaseSchema<Schema>;
protected abstract getSchemaForIntersectionType(type: IntersectionType): Schema;
protected getSchemaForEnumType(enumType: EnumType): Schema;
protected abstract applyNullable(schema: Schema, nullable: boolean): void;
private getSchemaForPrimitiveType;
private getSchemaForArrayType;
private getSchemaForTupleType;
getSchemaForObjectLiteralType(objectLiteral: NestedObjectLiteralType): BaseSchema<Schema>;
protected getSchemaForReferenceType(referenceType: ReferenceType): Schema;
protected abstract getRefPrefix(): string;
protected abstract getSchemaForUnionType(type: UnionType): Schema;
protected buildSchemaForRefAlias(referenceType: RefAliasType): Schema;
protected buildSchemaForRefEnum(referenceType: RefEnumType): Schema;
protected buildSchemasForReferenceTypes(extendFn?: (output: Schema, input: ReferenceType) => void): Record<string, Schema>;
protected isUndefinedProperty(input: ResolverProperty): boolean;
protected buildProperties(properties: ResolverProperty[]): Record<string, Schema>;
protected abstract markPropertyDeprecated(schema: Schema): void;
protected shouldStripRefSiblings(): boolean;
protected assignPropertyDefaults(_schema: Schema, _property: ResolverProperty): void;
protected buildSchemaForRefObject(referenceType: RefObjectType): Schema;
protected abstract resolveAdditionalProperties(type: BaseType): Schema | boolean;
protected determineTypesUsedInEnum(anEnum: Array<string | number | boolean | null>): VariableType[];
protected decideEnumType(input: Array<string | number | boolean>): 'string' | 'number' | 'boolean';
protected getOperationId(name: string): string;
protected groupParameters(items: Parameter[]): Partial<Record<ParameterSource, Parameter[]>>;
protected transformExtensions(input?: Extension[]): Record<string, any>;
protected transformValidators(input?: Validators): Record<string, any>;
}
//#endregion
//#region src/adapters/generator/v2/module.d.ts
declare class V2Generator extends AbstractSpecGenerator<SpecV2, SchemaV2> {
build(): Promise<SpecV2>;
private static translateSecurityDefinitions;
protected resolveAdditionalProperties(_type: BaseType): SchemaV2 | boolean;
protected markPropertyDeprecated(schema: SchemaV2): void;
private buildPaths;
private buildMethod;
private transformParameterSource;
protected buildParameter(input: Parameter): ParameterV2;
private buildMethodConsumes;
private hasFileParams;
private hasFormParams;
private supportsBodyParameters;
protected applyNullable(schema: SchemaV2, nullable: boolean): void;
protected getRefPrefix(): string;
protected getSchemaForIntersectionType(type: IntersectionType): SchemaV2;
protected getSchemaForUnionType(type: UnionType): SchemaV2;
private buildOperation;
}
//#endregion
//#region src/adapters/generator/v3/module.d.ts
declare class V3Generator extends AbstractSpecGenerator<SpecV3, SchemaV3> {
private readonly openApiVersion;
constructor(metadata: Metadata, config: SpecGeneratorOptionsInput, version?: `${Version}`);
build(): Promise<SpecV3>;
private buildComponents;
private static translateSecurityDefinitions;
private buildPaths;
private buildMethod;
private buildRequestBodyWithFormData;
private buildRequestBody;
private buildMediaType;
protected buildResponses(input: Response[]): Record<string, ResponseV3>;
protected buildOperation(_controllerName: string, method: Method): OperationV3;
protected transformParameterSource(source: `${ParameterSource}`): `${ParameterSourceV3}` | undefined;
protected buildParameter(input: Parameter): ParameterV3;
private transformParameterExamples;
private buildServers;
protected resolveAdditionalProperties(type: BaseType): SchemaV3;
protected markPropertyDeprecated(schema: SchemaV3): void;
protected assignPropertyDefaults(schema: SchemaV3, property: ResolverProperty): void;
protected buildSchemaForRefEnum(referenceType: RefEnumType): SchemaV3;
private isV31OrLater;
protected shouldStripRefSiblings(): boolean;
protected getSchemaForIntersectionType(type: IntersectionType): SchemaV3;
protected applyNullable(schema: SchemaV3, nullable: boolean): void;
protected getRefPrefix(): string;
protected getSchemaForUnionType(type: UnionType): SchemaV3;
private static isObjectLikeType;
private applyDiscriminator;
private detectDiscriminator;
/**
* Resolve a union member to its refName and properties for discriminator
* detection. Accepts both refObject and refAlias members, unwrapping
* aliases to find the underlying properties while preserving the
* original refName for $ref mapping.
*/
private resolveDiscriminatorMember;
}
//#endregion
//#region src/app/module.d.ts
declare function generateSwagger<V extends `${Version}`>(options: Omit<SwaggerGenerateOptions, 'version'> & {
version: V;
}): Promise<OutputForVersion<V>>;
//#endregion
//#region src/app/save.d.ts
declare function saveSwagger(spec: SpecV2 | SpecV3, options?: SwaggerSaveOptions): Promise<DocumentFormatData>;
//#endregion
export { AbstractSpecGenerator, ApiKeySecurity, BaseOAuthSecurityV2, BaseOperation, BaseParameter, BaseParameterV2, BaseParameterV3, BaseResponse, BaseSchema, BaseSecurity, BaseSpec, BasicSecurity, BasicSecurityV2, BasicSecurityV3, BodyParameter, BodyParameterV2, BodyParameterV3, ComponentsV3, CookieParameterV3, DataFormatName, DataTypeName, DocumentFormat, DocumentFormatData, Example, FormDataParameter, FormDataParameterV2, FormDataParameterV3, HeaderParameter, HeaderParameterV2, HeaderParameterV3, HeaderV2, HeaderV3, Info, MediaTypeV3, OAuth2AccessCodeSecurityV2, OAuth2ApplicationSecurityV2, OAuth2AuthorizationCodeFlow, OAuth2AuthorizationCodeFlowV3, OAuth2ClientCredentialsFlow, OAuth2ClientCredentialsFlowV3, OAuth2ImplicitFlow, OAuth2ImplicitFlowV3, OAuth2ImplicitSecurityV2, OAuth2PasswordFlow, OAuth2PasswordFlowV3, OAuth2PasswordSecurityV2, OAuth2Security, OAuth2SecurityV2, OAuth2SecurityV3, Oauth2BaseFlow, Oauth2BaseFlowV3, OperationV2, OperationV3, OutputForVersion, ParameterSourceV2, ParameterSourceV3, ParameterV2, ParameterV3, Path, PathParameter, PathParameterV2, PathParameterV3, PathsV3, QueryParameter, QueryParameterV2, QueryParameterV3, RequestBodyV3, ResponseV2, ResponseV3, SchemaV2, SchemaV3, SecurityDefinition, SecurityDefinitions, SecurityType, SecurityV2, SecurityV3, ServerOption, ServerV3, SpecGeneratorOptions, SpecGeneratorOptionsInput, SpecV2, SpecV3, SwaggerError, SwaggerErrorCode, SwaggerGenerateData, SwaggerGenerateOptions, SwaggerSaveOptions, TransferProtocol, V2Generator, V3Generator, ValidatorOpenApiMeta, VariableV3, Version, buildSpecGeneratorOptions, generateSwagger, hasOwnProperty, joinPaths, normalizePathParameters, removeDuplicateSlashes, removeFinalCharacter, saveSwagger, transformValueTo };
//# sourceMappingURL=index.d.mts.map