UNPKG

openapi-json-schema

Version:

Minimalistic OpenAPI 3 ⬌ JSON Schema (draft 7) conversion

30 lines (29 loc) 1.31 kB
import type { JSONSchema7 } from 'json-schema'; import type { OpenApiSchemaVersion, PartialOpenApiSchema } from './types.js'; export interface JsonSchemaDocumentToOpenApiOptions { title: string; version: string; schemaVersion?: OpenApiSchemaVersion; } export declare function decorateOpenApi(schema: Partial<PartialOpenApiSchema>, { title, version, schemaVersion, }: JsonSchemaDocumentToOpenApiOptions): { openapi: OpenApiSchemaVersion; info: { title: string; version: string; description?: string | undefined; termsOfService?: string | undefined; contact?: import("./types.js").OpenApiSchemaContact | undefined; license?: import("./types.js").OpenApiLicenseContact | undefined; 'x-id'?: string | undefined; 'x-comment'?: string | undefined; }; paths: Record<string, unknown>; servers?: import("./types.js").OpenApiSchemaServer[] | undefined; components?: import("./types.js").OpenApiSchemaComponents | undefined; }; export declare function jsonSchemaDocumentToOpenApi(schema: JSONSchema7, options: JsonSchemaDocumentToOpenApiOptions): PartialOpenApiSchema; export declare function openApiToJsonSchema(openApi: any): { definitions: { [k: string]: import("json-schema").JSONSchema7Definition; }; };