typed-openapi
Version:
62 lines (55 loc) • 3.45 kB
TypeScript
import { ReferenceObject } from 'openapi3-ts/oas31';
import { S as StringOrBox, O as OpenapiSchemaConvertContext, L as LibSchemaObject, B as BoxFactory, m as mapOpenApiEndpoints, N as NameTransformOptions, a as OpenapiSchemaConvertArgs, b as Box, A as AnyBoxDef } from './types-BOJSTQwz.js';
export { q as AnyBox, j as BoxArray, f as BoxDefinition, i as BoxIntersection, o as BoxKeyword, n as BoxLiteral, p as BoxObject, k as BoxOptional, g as BoxParams, l as BoxRef, h as BoxUnion, c as Endpoint, E as EndpointParameters, F as FactoryCreator, G as GenericFactory, M as Method, R as RefInfo, e as RefResolver, W as WithSchema, d as createRefResolver } from './types-BOJSTQwz.js';
import * as arktype_internal_methods_string_ts from 'arktype/internal/methods/string.ts';
import * as Codegen from '@sinclair/typebox-codegen';
import 'openapi3-ts/oas30';
declare const unwrap: (param: StringOrBox) => string;
declare const createFactory: <T extends OpenapiSchemaConvertContext["factory"]>(f: T) => T;
/**
* Create a box-factory using your schema provider and automatically add the input schema to each box.
*/
declare const createBoxFactory: (schema: LibSchemaObject | ReferenceObject, ctx: OpenapiSchemaConvertContext) => BoxFactory;
type GeneratorOptions$1 = ReturnType<typeof mapOpenApiEndpoints> & {
runtime?: "none" | keyof typeof runtimeValidationGenerator;
schemasOnly?: boolean;
nameTransform?: NameTransformOptions | undefined;
successStatusCodes?: readonly number[];
errorStatusCodes?: readonly number[];
includeClient?: boolean;
};
declare const allowedRuntimes: arktype_internal_methods_string_ts.StringType<"none" | "arktype" | "io-ts" | "typebox" | "valibot" | "yup" | "zod", {}>;
type OutputRuntime = typeof allowedRuntimes.infer;
declare const runtimeValidationGenerator: {
arktype: typeof Codegen.ModelToArkType.Generate;
"io-ts": typeof Codegen.ModelToIoTs.Generate;
typebox: typeof Codegen.ModelToTypeBox.Generate;
valibot: typeof Codegen.ModelToValibot.Generate;
yup: typeof Codegen.ModelToYup.Generate;
zod: typeof Codegen.ModelToZod.Generate;
};
declare const generateFile: (options: GeneratorOptions$1) => string;
type GeneratorOptions = ReturnType<typeof mapOpenApiEndpoints>;
type GeneratorContext = Required<GeneratorOptions> & {
errorStatusCodes?: readonly number[];
};
declare const generateTanstackQueryFile: (ctx: GeneratorContext & {
relativeApiClientPath: string;
}) => Promise<string>;
declare const openApiSchemaToTs: ({ schema, meta: _inheritedMeta, ctx }: OpenapiSchemaConvertArgs) => Box<AnyBoxDef>;
declare const tsFactory: {
union: (types: StringOrBox[]) => string;
intersection: (types: StringOrBox[]) => string;
array: (type: StringOrBox) => string;
optional: (type: StringOrBox) => string;
reference: (name: string, typeArgs: StringOrBox[] | undefined) => string;
literal: (value: StringOrBox) => string;
string: () => "string";
number: () => "number";
boolean: () => "boolean";
unknown: () => "unknown";
any: () => "any";
never: () => "never";
object: (props: Record<string, StringOrBox>) => string;
};
export { AnyBoxDef, BoxFactory, LibSchemaObject, NameTransformOptions, OpenapiSchemaConvertArgs, OpenapiSchemaConvertContext, type OutputRuntime, StringOrBox, createBoxFactory, createFactory, generateFile, generateTanstackQueryFile, mapOpenApiEndpoints, openApiSchemaToTs, tsFactory, unwrap };