UNPKG

openapi-diff

Version:

A CLI tool to identify differences between Swagger/OpenAPI specs.

14 lines (13 loc) 708 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const to_diff_compatible_json_schema_1 = require("../common/to-diff-compatible-json-schema"); const getReferenceSources = (spec) => { return spec.components && spec.components.schemas ? spec.components.schemas : {}; }; exports.toDiffReadyOpenApi3Schema = (schema, spec) => { const compatibleReferenceSources = to_diff_compatible_json_schema_1.toDiffCompatibleJsonSchemaMap(getReferenceSources(spec)); const compatibleSchema = to_diff_compatible_json_schema_1.toDiffCompatibleJsonSchema(schema); return Object.assign({}, compatibleSchema, { components: { schemas: compatibleReferenceSources } }); };