openapi-diff
Version:
A CLI tool to identify differences between Swagger/OpenAPI specs.
12 lines (11 loc) • 743 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.toDiffReadySwagger2Schema = void 0;
const to_diff_compatible_json_schema_1 = require("../common/to-diff-compatible-json-schema");
const getReferenceSources = (spec) => spec.definitions || {};
const toDiffReadySwagger2Schema = (schema, spec) => {
const compatibleReferenceSources = (0, to_diff_compatible_json_schema_1.toDiffCompatibleJsonSchemaMap)(getReferenceSources(spec));
const compatibleSchema = (0, to_diff_compatible_json_schema_1.toDiffCompatibleJsonSchema)(schema);
return Object.assign(Object.assign({}, compatibleSchema), { definitions: compatibleReferenceSources });
};
exports.toDiffReadySwagger2Schema = toDiffReadySwagger2Schema;