UNPKG

openapi-modifier

Version:

This package allows you to automate the process of modifying OpenAPI specifications by applying a set of predefined rules

15 lines (14 loc) 633 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.forEachComponent = void 0; const forEachComponent = (openAPIFile, callback) => { var _a, _b; const componentSchemas = (_b = (_a = openAPIFile.document) === null || _a === void 0 ? void 0 : _a.components) === null || _b === void 0 ? void 0 : _b.schemas; Object.keys(componentSchemas || {}).forEach((name) => { callback({ name, schema: (componentSchemas === null || componentSchemas === void 0 ? void 0 : componentSchemas[name]) || null, }); }); }; exports.forEachComponent = forEachComponent;