UNPKG

openapi-diff

Version:

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

19 lines (18 loc) 752 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const parse_swagger2_operations_1 = require("./parse-swagger2-operations"); const parsePath = (path, pathBuilder, spec) => { return { operations: parse_swagger2_operations_1.parseSwagger2Operations(path, pathBuilder, spec), originalValue: { originalPath: pathBuilder.build(), value: path } }; }; exports.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; }, {});