From 1c6f8e83271c440c6baa92eaea65700fde8822f7 Mon Sep 17 00:00:00 2001 From: Josh Ponelat Date: Tue, 24 Oct 2017 12:42:52 +0200 Subject: [PATCH] refactor specSelectors.allowTryItOutFor --- src/core/plugins/spec/selectors.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/plugins/spec/selectors.js b/src/core/plugins/spec/selectors.js index 7628c52a..ff3061ff 100644 --- a/src/core/plugins/spec/selectors.js +++ b/src/core/plugins/spec/selectors.js @@ -261,10 +261,11 @@ export const allowTryItOutFor = () => { // Get the parameter value by parameter name export function getParameter(state, pathMethod, name, inType) { + pathMethod = pathMethod || [] let params = spec(state).getIn(["paths", ...pathMethod, "parameters"], fromJS([])) - return params.filter( (p) => { + return params.find( (p) => { return Map.isMap(p) && p.get("name") === name && p.get("in") === inType - }).first() + }) || Map() // Always return a map } export const hasHost = createSelector(