UNPKG

@kubb/plugin-oas

Version:
59 lines (50 loc) 2.11 kB
import { Operation, Oas, SchemaObject, OpenAPIV3, OpenAPIV3_1, contentType, OasTypes } from '@kubb/oas'; export { isOptional } from '@kubb/oas'; import { FunctionParamsAST } from '@kubb/core/utils'; import { Params } from '@kubb/react/types'; import { v as OperationSchema } from './OperationGenerator-DiF6WJNP.js'; import { Config, Output } from '@kubb/core'; import '@kubb/fs/types'; declare function getComments(operation: Operation): string[]; declare function getPathParams(operationSchema: OperationSchema | undefined, options?: { typed?: boolean; casing?: 'camelcase'; override?: (data: FunctionParamsAST) => FunctionParamsAST; }): Params; /** * Make it possible to narrow down the schema based on a specific version(3 or 3.1) */ type SchemaResult<TWithRef extends boolean = false> = { schema?: (TWithRef extends true ? OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject : OpenAPIV3.SchemaObject) & { nullable?: boolean; 'x-nullable'?: boolean; }; version: '3.0'; } | { schema?: (TWithRef extends true ? OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject : OpenAPIV3_1.SchemaObject) & { nullable?: boolean; 'x-nullable'?: boolean; }; version: '3.1'; }; declare function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (schema?: SchemaObject) => SchemaResult<TWithRef>; type Mode = 'schemas' | 'responses' | 'requestBodies'; type GetSchemasProps = { oas: Oas; contentType?: contentType; includes?: Mode[]; }; declare function getSchemas({ oas, contentType, includes }: GetSchemasProps): Record<string, OasTypes.SchemaObject>; declare function parseFromConfig(config: Config, oasClass?: typeof Oas): Promise<Oas>; type Props$1 = { oas: Oas; output: Output<Oas>; config?: Config; }; declare function getBanner({ output, oas, config }: Props$1): string; type Props = { oas: Oas; output: Output<Oas>; }; declare function getFooter({ output, oas }: Props): string | undefined; export { getBanner, getComments, getFooter, getPathParams, getSchemaFactory, getSchemas, parseFromConfig };