fix(spec): set multi-value parameters as an immutable list (#9567)
Refs #9566
This commit is contained in:
@@ -62,7 +62,7 @@ export default {
|
|||||||
|
|
||||||
return state.setIn(
|
return state.setIn(
|
||||||
["meta", "paths", ...pathMethod, "parameters", paramKey, valueKey],
|
["meta", "paths", ...pathMethod, "parameters", paramKey, valueKey],
|
||||||
value
|
fromJS(value)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
import { fromJS } from "immutable"
|
import { fromJS, List } from "immutable"
|
||||||
import reducer from "core/plugins/spec/reducers"
|
import reducer from "core/plugins/spec/reducers"
|
||||||
|
|
||||||
describe("spec plugin - reducer", function(){
|
describe("spec plugin - reducer", function(){
|
||||||
@@ -149,6 +149,7 @@ describe("spec plugin - reducer", function(){
|
|||||||
const response = result.getIn(["meta", "paths", path, method, "parameters", "body.myBody", "value"])
|
const response = result.getIn(["meta", "paths", path, method, "parameters", "body.myBody", "value"])
|
||||||
expect(response).toEqual(`{ "a": 123 }`)
|
expect(response).toEqual(`{ "a": 123 }`)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should store parameter values by identity", () => {
|
it("should store parameter values by identity", () => {
|
||||||
const updateParam = reducer["spec_update_param"]
|
const updateParam = reducer["spec_update_param"]
|
||||||
|
|
||||||
@@ -176,6 +177,27 @@ describe("spec plugin - reducer", function(){
|
|||||||
const value = result.getIn(["meta", "paths", path, method, "parameters", `body.myBody.hash-${param.hashCode()}`, "value"])
|
const value = result.getIn(["meta", "paths", path, method, "parameters", `body.myBody.hash-${param.hashCode()}`, "value"])
|
||||||
expect(value).toEqual(`{ "a": 123 }`)
|
expect(value).toEqual(`{ "a": 123 }`)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("should store a multi-value parameter as an immutable list", () => {
|
||||||
|
const updateParam = reducer["spec_update_param"]
|
||||||
|
|
||||||
|
const path = "/pet/post"
|
||||||
|
const method = "POST"
|
||||||
|
|
||||||
|
const state = fromJS({})
|
||||||
|
const result = updateParam(state, {
|
||||||
|
payload: {
|
||||||
|
path: [path, method],
|
||||||
|
paramName: "myBody",
|
||||||
|
paramIn: "body",
|
||||||
|
value: [ "a", "b" ],
|
||||||
|
isXml: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const response = result.getIn(["meta", "paths", path, method, "parameters", "body.myBody", "value"])
|
||||||
|
expect(List.isList(response)).toEqual(true)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
describe("SPEC_UPDATE_EMPTY_PARAM_INCLUSION", function() {
|
describe("SPEC_UPDATE_EMPTY_PARAM_INCLUSION", function() {
|
||||||
it("should store parameter values by {in}.{name}", () => {
|
it("should store parameter values by {in}.{name}", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user