refactor(oas31): disable try it out mechanism explicitly for webhooks (#8485)

Refs #8474
This commit is contained in:
Vladimír Gorej
2023-03-20 09:44:22 +01:00
committed by GitHub
parent d7099793a4
commit d837b2b511
5 changed files with 54 additions and 26 deletions

View File

@@ -11,7 +11,7 @@ export const isOAS31 = (jsSpec) => {
}
/**
* Creates selector that returns value of the original
* Creates selector that returns value of the passed
* selector when spec is OpenAPI 3.1.0., null otherwise.
*
* @param selector
@@ -31,6 +31,26 @@ export const createOnlyOAS31Selector =
}
}
/**
* Creates selector wrapper that returns value of the passed
* selector when spec is OpenAPI 3.1.0., calls original selector otherwise.
*
*
* @param selector
* @returns {function(*, *): function(*, ...[*]): (*)}
*/
export const createOnlyOAS31SelectorWrapper =
(selector) =>
(oriSelector, system) =>
(state, ...args) => {
if (system.getSystem().specSelectors.isOAS31()) {
const result = selector(state, ...args)
return typeof result === "function" ? result(system) : result
} else {
return oriSelector(...args)
}
}
/**
* Creates selector that provides system as the
* second argument. This allows to create memoized