UNPKG

openapi-diff

Version:

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

10 lines (9 loc) 613 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) => spec.definitions || {}; exports.toDiffReadySwagger2Schema = (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, { definitions: compatibleReferenceSources }); };