@@ -256,10 +256,11 @@ export const allowTryItOutFor = () => {
256256
257257// Get the parameter value by parameter name
258258export function getParameter ( state , pathMethod , name , inType ) {
259+ pathMethod = pathMethod || [ ]
259260 let params = spec ( state ) . getIn ( [ "paths" , ...pathMethod , "parameters" ] , fromJS ( [ ] ) )
260- return params . filter ( ( p ) => {
261+ return params . find ( ( p ) => {
261262 return Map . isMap ( p ) && p . get ( "name" ) === name && p . get ( "in" ) === inType
262- } ) . first ( )
263+ } ) || Map ( ) // Always return a map
263264}
264265
265266export const hasHost = createSelector (
@@ -272,6 +273,7 @@ export const hasHost = createSelector(
272273
273274// Get the parameter values, that the user filled out
274275export function parameterValues ( state , pathMethod , isXml ) {
276+ pathMethod = pathMethod || [ ]
275277 let params = spec ( state ) . getIn ( [ "paths" , ...pathMethod , "parameters" ] , fromJS ( [ ] ) )
276278 return params . reduce ( ( hash , p ) => {
277279 let value = isXml && p . get ( "in" ) === "body" ? p . get ( "value_xml" ) : p . get ( "value" )
@@ -295,6 +297,7 @@ export function parametersIncludeType(parameters, typeValue="") {
295297
296298// Get the consumes/produces value that the user selected
297299export function contentTypeValues ( state , pathMethod ) {
300+ pathMethod = pathMethod || [ ]
298301 let op = spec ( state ) . getIn ( [ "paths" , ...pathMethod ] , fromJS ( { } ) )
299302 const parameters = op . get ( "parameters" ) || new List ( )
300303
@@ -313,6 +316,7 @@ export function contentTypeValues(state, pathMethod) {
313316
314317// Get the consumes/produces by path
315318export function operationConsumes ( state , pathMethod ) {
319+ pathMethod = pathMethod || [ ]
316320 return spec ( state ) . getIn ( [ "paths" , ...pathMethod , "consumes" ] , fromJS ( { } ) )
317321}
318322
@@ -329,6 +333,7 @@ export const canExecuteScheme = ( state, path, method ) => {
329333}
330334
331335export const validateBeforeExecute = ( state , pathMethod ) => {
336+ pathMethod = pathMethod || [ ]
332337 let params = spec ( state ) . getIn ( [ "paths" , ...pathMethod , "parameters" ] , fromJS ( [ ] ) )
333338 let isValid = true
334339
0 commit comments