UNPKG

@kubb/plugin-oas

Version:

OpenAPI Specification (OAS) plugin for Kubb, providing core functionality for parsing and processing OpenAPI/Swagger schemas for code generation.

113 lines (112 loc) 3.39 kB
import { S as Output, _ as contentType, b as Config, f as OasTypes, g as SchemaObject, h as Operation, l as isOptional, m as OpenAPIV3_1, p as OpenAPIV3, u as Oas } from "./SchemaMapper-zzZesrTN.js"; import { h as OperationSchema } from "./createGenerator-5F-s3MqT.js"; import { Params } from "@kubb/react-fabric/types"; //#region src/utils/getBanner.d.ts type Props$1<TOas extends Oas> = { oas: TOas; output: Output<any>; config?: Config; }; declare function getBanner<TOas extends Oas>({ output, oas, config }: Props$1<TOas>): string; //#endregion //#region src/utils/getComments.d.ts declare function getComments(operation: Operation): string[]; //#endregion //#region src/utils/getFooter.d.ts type Props<TOas extends Oas> = { oas: TOas; output: Output<any>; }; declare function getFooter<TOas extends Oas>({ output, oas }: Props<TOas>): string | undefined; //#endregion //#region ../core/src/utils/FunctionParams.d.ts type FunctionParamsASTWithoutType = { name?: string; type?: string; /** * @default true */ required?: boolean; /** * @default true */ enabled?: boolean; default?: string; }; type FunctionParamsASTWithType = { name?: never; type: string; /** * @default true */ required?: boolean; /** * @default true */ enabled?: boolean; default?: string; }; /** * @deprecated */ type FunctionParamsAST = FunctionParamsASTWithoutType | FunctionParamsASTWithType; //#endregion //#region src/utils/getParams.d.ts declare function getPathParams(operationSchema: OperationSchema | undefined, options?: { typed?: boolean; casing?: 'camelcase'; override?: (data: FunctionParamsAST) => FunctionParamsAST; }): Params; //#endregion //#region src/utils/getSchemaFactory.d.ts /** * Make it possible to narrow down the schema based on a specific version(3 or 3.1) */ type SchemaResult<TWithRef extends boolean = false> = { schemaObject?: (TWithRef extends true ? OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject : OpenAPIV3.SchemaObject) & { nullable?: boolean; 'x-nullable'?: boolean; }; version: '3.0'; } | { schemaObject?: (TWithRef extends true ? OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject : OpenAPIV3_1.SchemaObject) & { nullable?: boolean; 'x-nullable'?: boolean; }; version: '3.1'; }; /** * Creates a factory function that generates a versioned OpenAPI schema result. * * The returned function accepts an optional schema object and produces a {@link SchemaResult} containing the dereferenced schema and the OpenAPI version ('3.0' or '3.1'). * * @returns A function that takes an optional schema and returns a versioned schema result. */ declare function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (schema?: SchemaObject) => SchemaResult<TWithRef>; //#endregion //#region src/utils/getSchemas.d.ts type Mode = 'schemas' | 'responses' | 'requestBodies'; type GetSchemasProps = { oas: Oas; contentType?: contentType; includes?: Mode[]; }; /** * Collect schemas from OpenAPI components (schemas, responses, requestBodies) * and return them in dependency order. */ declare function getSchemas({ oas, contentType, includes }: GetSchemasProps): Record<string, OasTypes.SchemaObject>; //#endregion export { getBanner, getComments, getFooter, getPathParams, getSchemaFactory, getSchemas, isOptional }; //# sourceMappingURL=utils.d.ts.map