fix(oas31): detect user request body edits in OpenAPI.paths (#8500)

Affected wrapped selector was hasUserEditedBody.
This commit fixes the bug by calling the original
selector when path+method combination is not found
in OpenAPI.webhooks field.

Refs #8498
This commit is contained in:
Vladimír Gorej
2023-03-22 09:12:27 +01:00
committed by GitHub
parent 39ccc0f900
commit 5c11bb5a45
3 changed files with 5 additions and 3 deletions

View File

@@ -46,7 +46,7 @@ export const createOnlyOAS31SelectorWrapper =
if (system.getSystem().specSelectors.isOAS31()) { if (system.getSystem().specSelectors.isOAS31()) {
const selectedValue = selector(state, ...args) const selectedValue = selector(state, ...args)
return typeof selectedValue === "function" return typeof selectedValue === "function"
? selectedValue(system) ? selectedValue(oriSelector, system)
: selectedValue : selectedValue
} else { } else {
return oriSelector(...args) return oriSelector(...args)

View File

@@ -4,12 +4,14 @@
import { createOnlyOAS31SelectorWrapper } from "../fn" import { createOnlyOAS31SelectorWrapper } from "../fn"
export const hasUserEditedBody = createOnlyOAS31SelectorWrapper( export const hasUserEditedBody = createOnlyOAS31SelectorWrapper(
(state, path, method) => (system) => { (state, path, method) => (oriSelector, system) => {
const webhooks = system.specSelectors.webhooks() const webhooks = system.specSelectors.webhooks()
if (webhooks.hasIn([path, method])) { if (webhooks.hasIn([path, method])) {
// try it out functionality is disabled for webhooks // try it out functionality is disabled for webhooks
return false return false
} }
return oriSelector(path, method)
} }
) )

View File

@@ -12,7 +12,7 @@ export const isOAS3 =
} }
export const selectLicenseUrl = createOnlyOAS31SelectorWrapper( export const selectLicenseUrl = createOnlyOAS31SelectorWrapper(
() => (system) => { () => (oriSelector, system) => {
return system.oas31Selectors.selectLicenseUrl() return system.oas31Selectors.selectLicenseUrl()
} }
) )