UNPKG

@apideck/portman

Version:

Port OpenAPI Spec to Postman Collection, with contract & variation tests included

28 lines 1.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parsePortmanConfig = void 0; var tslib_1 = require("tslib"); var json_schema_ref_parser_1 = tslib_1.__importDefault(require("@apidevtools/json-schema-ref-parser")); var Either = tslib_1.__importStar(require("fp-ts/lib/Either")); var parsePortmanConfig = function (data) { return tslib_1.__awaiter(void 0, void 0, void 0, function () { var config, err_1; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 3]); return [4, json_schema_ref_parser_1.default.dereference(data)]; case 1: config = (_a.sent()); return [2, Either.right(config)]; case 2: err_1 = _a.sent(); return [2, Either.left({ error: 'Failed to resolve configuration', detail: err_1.message.replace(/(?:\n)+/g, '- ') })]; case 3: return [2]; } }); }); }; exports.parsePortmanConfig = parsePortmanConfig; //# sourceMappingURL=PortmanConfig.parse.js.map