openapi-diff
Version:
A CLI tool to identify differences between Swagger/OpenAPI specs.
17 lines (16 loc) • 528 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const isXProperty = (propertyPath) => {
return propertyPath.startsWith('x-');
};
exports.parseXPropertiesInObject = (object, pathBuilder) => {
return Object.keys(object)
.filter(isXProperty)
.reduce((xProperties, currentKey) => {
xProperties[currentKey] = {
originalPath: pathBuilder.withChild(currentKey).build(),
value: object[currentKey]
};
return xProperties;
}, {});
};