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.parseOpenApi3Paths = void 0; const parse_openapi3_operations_1 = require("./parse-openapi3-operations"); const parsePath = (path, pathBuilder, spec) => { return { operations: (0, parse_openapi3_operations_1.parseOpenApi3Operations)(path, pathBuilder, spec), originalValue: { originalPath: pathBuilder.build(), value: path } }; }; const parseOpenApi3Paths = (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.parseOpenApi3Paths = parseOpenApi3Paths;