UNPKG

openapi-ts-json-schema

Version:

OpenAPI to JSON schema generator with TypeScript in mind

23 lines (22 loc) 738 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.patchJsonSchema = void 0; const json_schema_traverse_1 = __importDefault(require("json-schema-traverse")); /** * Patch generated schemas with a user-provided patch function */ function patchJsonSchema(schema, schemaPatcher) { if (schema && schemaPatcher) { (0, json_schema_traverse_1.default)(schema, { allKeys: true, cb: (schema) => { schemaPatcher({ schema }); }, }); } return schema; } exports.patchJsonSchema = patchJsonSchema;