feature: allowEmptyValue controls (#4788)
* add baseline tests * coerce empty strings to null when updating parameter values * add ParameterIncludeEmpty * add redux management for empty parameter value inclusion state * use name+in keying for state management instead of hash keying * update new redux method usages to name+in keying * coerce empty Immutable iterables in onChangeWrapper * OAS3 tests & support * add included empty parameters to requests before dispatching to Swagger Client * make empty inclusion interface prettier * add tests for #4587 * linter fixes * check for truthy value before reaching into property
This commit is contained in:
@@ -14,7 +14,8 @@ import Petstore from "./assets/petstore.json"
|
||||
import {
|
||||
operationWithMeta,
|
||||
parameterWithMeta,
|
||||
parameterWithMetaByIdentity
|
||||
parameterWithMetaByIdentity,
|
||||
parameterInclusionSettingFor
|
||||
} from "../../../../src/core/plugins/spec/selectors"
|
||||
|
||||
describe("spec plugin - selectors", function(){
|
||||
@@ -712,4 +713,42 @@ describe("spec plugin - selectors", function(){
|
||||
})
|
||||
})
|
||||
})
|
||||
describe("parameterInclusionSettingFor", function() {
|
||||
it("should support getting name+in param inclusion settings", function () {
|
||||
const param = fromJS({
|
||||
name: "param",
|
||||
in: "query",
|
||||
allowEmptyValue: true
|
||||
})
|
||||
|
||||
const state = fromJS({
|
||||
json: {
|
||||
paths: {
|
||||
"/": {
|
||||
"get": {
|
||||
parameters: [
|
||||
param
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
meta: {
|
||||
paths: {
|
||||
"/": {
|
||||
"get": {
|
||||
"parameter_inclusions": {
|
||||
[`param.query`]: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const result = parameterInclusionSettingFor(state, ["/", "get"], "param", "query")
|
||||
|
||||
expect(result).toEqual(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user