UNPKG

@redocly/respect-core

Version:
22 lines 850 B
import { getOperationById } from './get-operation-by-id.js'; import { getOperationByPath } from './get-operation-by-path.js'; export function getOperationFromDescription(path, method, descriptionPaths) { return descriptionPaths?.[path]?.[method]; } export function getOperationFromDescriptionBySource(source, ctx) { if (!source.operationId && !source.operationPath) { return undefined; } const { $sourceDescriptions, sourceDescriptions } = ctx; const { operationId, operationPath } = source; if (operationId) { return getOperationById(operationId, $sourceDescriptions); } else if (operationPath) { return getOperationByPath(operationPath, { $sourceDescriptions, sourceDescriptions }); } else { return undefined; } } //# sourceMappingURL=get-operation-from-description.js.map