From 5db6a1d0c9ba293917f0778855692104485846f2 Mon Sep 17 00:00:00 2001 From: Josh Ponelat Date: Tue, 24 Oct 2017 12:43:27 +0200 Subject: [PATCH] add guards to specSelectors --- src/core/plugins/spec/selectors.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/plugins/spec/selectors.js b/src/core/plugins/spec/selectors.js index ff3061ff..bed2eb38 100644 --- a/src/core/plugins/spec/selectors.js +++ b/src/core/plugins/spec/selectors.js @@ -278,6 +278,7 @@ export const hasHost = createSelector( // Get the parameter values, that the user filled out export function parameterValues(state, pathMethod, isXml) { + pathMethod = pathMethod || [] let params = spec(state).getIn(["paths", ...pathMethod, "parameters"], fromJS([])) return params.reduce( (hash, p) => { let value = isXml && p.get("in") === "body" ? p.get("value_xml") : p.get("value") @@ -301,6 +302,7 @@ export function parametersIncludeType(parameters, typeValue="") { // Get the consumes/produces value that the user selected export function contentTypeValues(state, pathMethod) { + pathMethod = pathMethod || [] let op = spec(state).getIn(["paths", ...pathMethod], fromJS({})) const parameters = op.get("parameters") || new List() @@ -319,6 +321,7 @@ export function contentTypeValues(state, pathMethod) { // Get the consumes/produces by path export function operationConsumes(state, pathMethod) { + pathMethod = pathMethod || [] return spec(state).getIn(["paths", ...pathMethod, "consumes"], fromJS({})) } @@ -335,6 +338,7 @@ export const canExecuteScheme = ( state, path, method ) => { } export const validateBeforeExecute = ( state, pathMethod ) => { + pathMethod = pathMethod || [] let params = spec(state).getIn(["paths", ...pathMethod, "parameters"], fromJS([])) let isValid = true