fix(validateParam): validate JSON parameter values + support Parameter.content (#5657)
* improve(getParameterSchema): ParameterSchemaDescriptor pattern * chore: update usage of `getParameterSchema` * consider `Parameter.content` media type when validating JSON values
This commit is contained in:
@@ -41,7 +41,7 @@ export default class ParameterRow extends Component {
|
||||
let enumValue
|
||||
|
||||
if(isOAS3) {
|
||||
let schema = getParameterSchema(parameterWithMeta, { isOAS3 })
|
||||
let { schema } = getParameterSchema(parameterWithMeta, { isOAS3 })
|
||||
enumValue = schema.get("enum")
|
||||
} else {
|
||||
enumValue = parameterWithMeta ? parameterWithMeta.get("enum") : undefined
|
||||
@@ -98,7 +98,7 @@ export default class ParameterRow extends Component {
|
||||
|
||||
const paramWithMeta = specSelectors.parameterWithMetaByIdentity(pathMethod, rawParam) || Map()
|
||||
|
||||
const schema = getParameterSchema(paramWithMeta, { isOAS3: specSelectors.isOAS3() })
|
||||
const { schema } = getParameterSchema(paramWithMeta, { isOAS3: specSelectors.isOAS3() })
|
||||
|
||||
const parameterMediaType = paramWithMeta
|
||||
.get("content", Map())
|
||||
@@ -209,9 +209,10 @@ export default class ParameterRow extends Component {
|
||||
const ExamplesSelectValueRetainer = getComponent("ExamplesSelectValueRetainer")
|
||||
const Example = getComponent("Example")
|
||||
|
||||
let { schema } = getParameterSchema(param, { isOAS3 })
|
||||
let paramWithMeta = specSelectors.parameterWithMetaByIdentity(pathMethod, rawParam) || Map()
|
||||
|
||||
let format = param.get("format")
|
||||
let schema = getParameterSchema(param, { isOAS3 })
|
||||
let type = schema.get("type")
|
||||
let isFormData = inType === "formData"
|
||||
let isFormDataSupported = "FormData" in win
|
||||
|
||||
Reference in New Issue
Block a user