UNPKG

openapi-ts-request

Version:

Swagger2/OpenAPI3/Apifox to TypeScript/JavaScript, request client(support any client), request mock service, enum and enum translation, react-query/vue-query, type field label, JSON Schemas

107 lines (106 loc) 3.5 kB
import type { OpenAPIV3 } from 'openapi-types'; import type { OpenAPIObject, ParameterObject, ReferenceObject, SchemaObject } from '../type'; export declare function objectify<T>(thing: T): T; export declare function get(openAPI: OpenAPIObject, path: string): OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject; export declare function normalizeArray(arr: string[] | string): string[]; export declare function inferSchema(thing: ParameterObject | SchemaObject | ReferenceObject | OpenAPIV3.MediaTypeObject): OpenAPIV3.ReferenceObject | OpenAPIV3.MediaTypeObject | { type: string; enum?: any[]; title?: string; description?: string; default?: any; 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[]; not?: OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject; nullable?: boolean; discriminator?: OpenAPIV3.DiscriminatorObject; readOnly?: boolean; writeOnly?: boolean; xml?: OpenAPIV3.XMLObject; externalDocs?: OpenAPIV3.ExternalDocumentationObject; example?: any; deprecated?: boolean; format?: import("../type").ISchemaObjectFormat; additionalProperties?: boolean | import("../type").ISchemaObject; properties?: { [name: string]: import("../type").ISchemaObject; }; allOf?: import("../type").ISchemaObject[]; oneOf?: import("../type").ISchemaObject[]; anyOf?: import("../type").ISchemaObject[]; 'x-enum-varnames'?: string[]; 'x-enum-comments'?: { [name: string]: string; }; 'x-apifox'?: { enumDescriptions: Record<string, string>; }; 'x-apifox-enum'?: { value: string; name: string; description: string; }[]; items: import("../type").ISchemaObject; } | { type: string; enum?: any[]; title?: string; description?: string; default?: any; 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[]; not?: OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject; nullable?: boolean; discriminator?: OpenAPIV3.DiscriminatorObject; readOnly?: boolean; writeOnly?: boolean; xml?: OpenAPIV3.XMLObject; externalDocs?: OpenAPIV3.ExternalDocumentationObject; example?: any; deprecated?: boolean; format?: import("../type").ISchemaObjectFormat; additionalProperties?: boolean | import("../type").ISchemaObject; properties?: { [name: string]: import("../type").ISchemaObject; }; allOf?: import("../type").ISchemaObject[]; oneOf?: import("../type").ISchemaObject[]; anyOf?: import("../type").ISchemaObject[]; 'x-enum-varnames'?: string[]; 'x-enum-comments'?: { [name: string]: string; }; 'x-apifox'?: { enumDescriptions: Record<string, string>; }; 'x-apifox-enum'?: { value: string; name: string; description: string; }[]; }; export declare function getRandomInt(min: number, max: number): number;