fix(try-it-out): pass Parameter validation messages around in props for OAS3 (#4162)

* default to empty `ImmutableMap` when grabbing op metadata

* pass `errors` into JsonSchema components

* Account for Immutable data structure in JavaScriptonSchema...

...and create empty Lists instead of Maps by default.

* Pass ImmutableList through to JsonSchema child components
This commit is contained in:
kyle
2018-01-25 20:14:35 -08:00
committed by GitHub
parent 2f236982f8
commit 1e1b7f6063
3 changed files with 25 additions and 18 deletions

View File

@@ -52,7 +52,7 @@ export default {
},
[VALIDATE_PARAMS]: ( state, { payload: { pathMethod, isOAS3 } } ) => {
let meta = state.getIn( [ "meta", "paths", ...pathMethod ] )
let meta = state.getIn( [ "meta", "paths", ...pathMethod ], fromJS({}) )
let isXml = /xml/i.test(meta.get("consumes_value"))
return state.updateIn( [ "resolved", "paths", ...pathMethod, "parameters" ], fromJS([]), parameters => {
@@ -68,7 +68,7 @@ export default {
return state.updateIn( [ "resolved", "paths", ...pathMethod, "parameters" ], fromJS([]), parameters => {
return parameters.withMutations( parameters => {
for ( let i = 0, len = parameters.count(); i < len; i++ ) {
parameters.setIn([i, "errors"], fromJS({}))
parameters.setIn([i, "errors"], fromJS([]))
}
})
})