@nestjs/swagger
Version:
Nest - modern, fast, powerful node.js web framework (@swagger)
263 lines (262 loc) • 11.7 kB
TypeScript
import { ApiPropertyOptions } from '../decorators/index.js';
import { BaseParameterObject, ReferenceObject, SchemaObject } from '../interfaces/open-api-spec.interface.js';
import { ParamWithTypeMetadata } from './parameter-metadata-accessor.js';
type KeysToRemove = keyof ApiPropertyOptions | '$ref' | 'properties' | 'enumName' | 'enumSchema' | 'standardSchema' | 'selfRequired';
export declare class SwaggerTypesMapper {
private readonly keysToRemove;
mapParamTypes(parameters: Array<ParamWithTypeMetadata | BaseParameterObject>): (Partial<BaseParameterObject> | Partial<ParamWithTypeMetadata> | {
schema: {
type: string;
items: any;
nullable?: boolean;
discriminator?: import("../interfaces/open-api-spec.interface.js").DiscriminatorObject;
readOnly?: boolean;
writeOnly?: boolean;
xml?: import("../interfaces/open-api-spec.interface.js").XmlObject;
externalDocs?: import("../interfaces/open-api-spec.interface.js").ExternalDocumentationObject;
example?: any;
examples?: any[] | Record<string, any>;
deprecated?: boolean;
allOf?: (SchemaObject | ReferenceObject)[];
oneOf?: (SchemaObject | ReferenceObject)[];
anyOf?: (SchemaObject | ReferenceObject)[];
not?: SchemaObject | ReferenceObject;
properties?: Record<string, SchemaObject | ReferenceObject>;
additionalProperties?: SchemaObject | ReferenceObject | boolean;
patternProperties?: SchemaObject | ReferenceObject | any;
description?: string;
format?: import("../interfaces/open-api-spec.interface.js").OpenAPIFormat;
default?: any;
title?: string;
multipleOf?: number;
maximum?: number;
exclusiveMaximum?: boolean;
minimum?: number;
exclusiveMinimum?: boolean;
maxLength?: number;
minLength?: number;
pattern?: string;
maxItems?: number;
minItems?: number;
uniqueItems?: boolean;
maxProperties?: number;
minProperties?: number;
required?: string[];
enum?: any[];
'x-enumNames'?: string[];
};
} | {
schema: Record<string, any>;
description?: string;
required?: boolean;
deprecated?: boolean;
allowEmptyValue?: boolean;
style?: import("../interfaces/open-api-spec.interface.js").ParameterStyle;
explode?: boolean;
allowReserved?: boolean;
examples?: Record<string, import("../interfaces/open-api-spec.interface.js").ExampleObject | ReferenceObject>;
example?: any;
content?: import("../interfaces/open-api-spec.interface.js").ContentObject;
} | {
schema: Record<string, any>;
name?: string | number | object;
type?: import("@nestjs/common").Type<unknown>;
in?: import("../interfaces/open-api-spec.interface.js").ParameterLocation | "body" | "placeholder";
standardSchema?: import("../index.js").StandardSchemaObject;
isArray?: boolean;
items?: SchemaObject;
required?: boolean;
enum?: unknown[];
enumName?: string;
enumSchema?: import("../interfaces/enum-schema-attributes.interface.js").EnumSchemaAttributes;
selfRequired?: boolean;
})[];
mapTypeToOpenAPIType(type: string | Function): string;
mapEnumArrayType(param: Record<string, any>, keysToRemove: KeysToRemove[]): {
schema: {
type: string;
items: any;
nullable?: boolean;
discriminator?: import("../interfaces/open-api-spec.interface.js").DiscriminatorObject;
readOnly?: boolean;
writeOnly?: boolean;
xml?: import("../interfaces/open-api-spec.interface.js").XmlObject;
externalDocs?: import("../interfaces/open-api-spec.interface.js").ExternalDocumentationObject;
example?: any;
examples?: any[] | Record<string, any>;
deprecated?: boolean;
allOf?: (SchemaObject | ReferenceObject)[];
oneOf?: (SchemaObject | ReferenceObject)[];
anyOf?: (SchemaObject | ReferenceObject)[];
not?: SchemaObject | ReferenceObject;
properties?: Record<string, SchemaObject | ReferenceObject>;
additionalProperties?: SchemaObject | ReferenceObject | boolean;
patternProperties?: SchemaObject | ReferenceObject | any;
description?: string;
format?: import("../interfaces/open-api-spec.interface.js").OpenAPIFormat;
default?: any;
title?: string;
multipleOf?: number;
maximum?: number;
exclusiveMaximum?: boolean;
minimum?: number;
exclusiveMinimum?: boolean;
maxLength?: number;
minLength?: number;
pattern?: string;
maxItems?: number;
minItems?: number;
uniqueItems?: boolean;
maxProperties?: number;
minProperties?: number;
required?: string[];
enum?: any[];
'x-enumNames'?: string[];
};
};
mapArrayType(param: (ParamWithTypeMetadata & SchemaObject) | BaseParameterObject, keysToRemove: KeysToRemove[]): {
schema: {
type: string;
items: any;
nullable?: boolean;
discriminator?: import("../interfaces/open-api-spec.interface.js").DiscriminatorObject;
readOnly?: boolean;
writeOnly?: boolean;
xml?: import("../interfaces/open-api-spec.interface.js").XmlObject;
externalDocs?: import("../interfaces/open-api-spec.interface.js").ExternalDocumentationObject;
example?: any;
examples?: any[] | Record<string, any>;
deprecated?: boolean;
allOf?: (SchemaObject | ReferenceObject)[];
oneOf?: (SchemaObject | ReferenceObject)[];
anyOf?: (SchemaObject | ReferenceObject)[];
not?: SchemaObject | ReferenceObject;
properties?: Record<string, SchemaObject | ReferenceObject>;
additionalProperties?: SchemaObject | ReferenceObject | boolean;
patternProperties?: SchemaObject | ReferenceObject | any;
description?: string;
format?: import("../interfaces/open-api-spec.interface.js").OpenAPIFormat;
default?: any;
title?: string;
multipleOf?: number;
maximum?: number;
exclusiveMaximum?: boolean;
minimum?: number;
exclusiveMinimum?: boolean;
maxLength?: number;
minLength?: number;
pattern?: string;
maxItems?: number;
minItems?: number;
uniqueItems?: boolean;
maxProperties?: number;
minProperties?: number;
required?: string[];
enum?: any[];
'x-enumNames'?: string[];
};
description?: string;
required?: boolean;
deprecated?: boolean;
allowEmptyValue?: boolean;
style?: import("../interfaces/open-api-spec.interface.js").ParameterStyle;
explode?: boolean;
allowReserved?: boolean;
examples?: Record<string, import("../interfaces/open-api-spec.interface.js").ExampleObject | ReferenceObject>;
example?: any;
content?: import("../interfaces/open-api-spec.interface.js").ContentObject;
} | {
schema: {
type: string;
items: any;
nullable?: boolean;
discriminator?: import("../interfaces/open-api-spec.interface.js").DiscriminatorObject;
readOnly?: boolean;
writeOnly?: boolean;
xml?: import("../interfaces/open-api-spec.interface.js").XmlObject;
externalDocs?: import("../interfaces/open-api-spec.interface.js").ExternalDocumentationObject;
example?: any;
examples?: any[] | Record<string, any>;
deprecated?: boolean;
allOf?: (SchemaObject | ReferenceObject)[];
oneOf?: (SchemaObject | ReferenceObject)[];
anyOf?: (SchemaObject | ReferenceObject)[];
not?: SchemaObject | ReferenceObject;
properties?: Record<string, SchemaObject | ReferenceObject>;
additionalProperties?: SchemaObject | ReferenceObject | boolean;
patternProperties?: SchemaObject | ReferenceObject | any;
description?: string;
format?: import("../interfaces/open-api-spec.interface.js").OpenAPIFormat;
default?: any;
title?: string;
multipleOf?: number;
maximum?: number;
exclusiveMaximum?: boolean;
minimum?: number;
exclusiveMinimum?: boolean;
maxLength?: number;
minLength?: number;
pattern?: string;
maxItems?: number;
minItems?: number;
uniqueItems?: boolean;
maxProperties?: number;
minProperties?: number;
required?: string[];
enum?: any[];
'x-enumNames'?: string[];
};
name?: string | number | object;
type?: import("@nestjs/common").Type<unknown> & (string | string[]);
in?: import("../interfaces/open-api-spec.interface.js").ParameterLocation | "body" | "placeholder";
standardSchema?: import("../index.js").StandardSchemaObject;
isArray?: boolean;
items?: SchemaObject | (SchemaObject & ReferenceObject);
required?: boolean & string[];
enum?: unknown[] & any[];
enumName?: string;
enumSchema?: import("../interfaces/enum-schema-attributes.interface.js").EnumSchemaAttributes;
selfRequired?: boolean;
nullable?: boolean;
discriminator?: import("../interfaces/open-api-spec.interface.js").DiscriminatorObject;
readOnly?: boolean;
writeOnly?: boolean;
xml?: import("../interfaces/open-api-spec.interface.js").XmlObject;
externalDocs?: import("../interfaces/open-api-spec.interface.js").ExternalDocumentationObject;
example?: any;
examples?: any[] | Record<string, any>;
deprecated?: boolean;
allOf?: (SchemaObject | ReferenceObject)[];
oneOf?: (SchemaObject | ReferenceObject)[];
anyOf?: (SchemaObject | ReferenceObject)[];
not?: SchemaObject | ReferenceObject;
properties?: Record<string, SchemaObject | ReferenceObject>;
additionalProperties?: SchemaObject | ReferenceObject | boolean;
patternProperties?: SchemaObject | ReferenceObject | any;
description?: string;
format?: import("../interfaces/open-api-spec.interface.js").OpenAPIFormat;
default?: any;
title?: string;
multipleOf?: number;
maximum?: number;
exclusiveMaximum?: boolean;
minimum?: number;
exclusiveMinimum?: boolean;
maxLength?: number;
minLength?: number;
pattern?: string;
maxItems?: number;
minItems?: number;
uniqueItems?: boolean;
maxProperties?: number;
minProperties?: number;
'x-enumNames'?: string[];
};
getSchemaOptionsKeys(): Array<keyof SchemaObject>;
private getSchemaOptions;
private isEnumArrayType;
private hasSchemaDefinition;
private hasRawContentDefinition;
private omitParamKeys;
}
export {};