UNPKG

openapi-diff

Version:

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

21 lines (20 loc) 841 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseSwagger2Paths = void 0; const parse_swagger2_operations_1 = require("./parse-swagger2-operations"); const parsePath = (path, pathBuilder, spec) => { return { operations: (0, parse_swagger2_operations_1.parseSwagger2Operations)(path, pathBuilder, spec), originalValue: { originalPath: pathBuilder.build(), value: path } }; }; const parseSwagger2Paths = (paths, pathBuilder, spec) => Object.keys(paths).reduce((accumulator, pathName) => { const pathItemObject = paths[pathName]; const originalPath = pathBuilder.withChild(pathName); accumulator[pathName] = parsePath(pathItemObject, originalPath, spec); return accumulator; }, {}); exports.parseSwagger2Paths = parseSwagger2Paths;