main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
982 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
---|
| 4 | exports.__esModule = true;
|
---|
| 5 | exports.default = getOperationRaw;
|
---|
| 6 | var _findOperation = _interopRequireDefault(require("./find-operation.js"));
|
---|
| 7 | var _opId = _interopRequireDefault(require("./op-id.js"));
|
---|
| 8 | var _legacy = _interopRequireDefault(require("./id-from-path-method/legacy.js"));
|
---|
| 9 | function getOperationRaw(spec, id) {
|
---|
| 10 | if (!spec || !spec.paths) {
|
---|
| 11 | return null;
|
---|
| 12 | }
|
---|
| 13 | return (0, _findOperation.default)(spec, ({
|
---|
| 14 | pathName,
|
---|
| 15 | method,
|
---|
| 16 | operation
|
---|
| 17 | }) => {
|
---|
| 18 | if (!operation || typeof operation !== 'object') {
|
---|
| 19 | return false;
|
---|
| 20 | }
|
---|
| 21 | const rawOperationId = operation.operationId; // straight from the source
|
---|
| 22 | const operationId = (0, _opId.default)(operation, pathName, method);
|
---|
| 23 | const legacyOperationId = (0, _legacy.default)(pathName, method);
|
---|
| 24 | return [operationId, legacyOperationId, rawOperationId].some(val => val && val === id);
|
---|
| 25 | });
|
---|
| 26 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.