add guards to specSelectors
This commit is contained in:
@@ -278,6 +278,7 @@ export const hasHost = createSelector(
|
|||||||
|
|
||||||
// Get the parameter values, that the user filled out
|
// Get the parameter values, that the user filled out
|
||||||
export function parameterValues(state, pathMethod, isXml) {
|
export function parameterValues(state, pathMethod, isXml) {
|
||||||
|
pathMethod = pathMethod || []
|
||||||
let params = spec(state).getIn(["paths", ...pathMethod, "parameters"], fromJS([]))
|
let params = spec(state).getIn(["paths", ...pathMethod, "parameters"], fromJS([]))
|
||||||
return params.reduce( (hash, p) => {
|
return params.reduce( (hash, p) => {
|
||||||
let value = isXml && p.get("in") === "body" ? p.get("value_xml") : p.get("value")
|
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
|
// Get the consumes/produces value that the user selected
|
||||||
export function contentTypeValues(state, pathMethod) {
|
export function contentTypeValues(state, pathMethod) {
|
||||||
|
pathMethod = pathMethod || []
|
||||||
let op = spec(state).getIn(["paths", ...pathMethod], fromJS({}))
|
let op = spec(state).getIn(["paths", ...pathMethod], fromJS({}))
|
||||||
const parameters = op.get("parameters") || new List()
|
const parameters = op.get("parameters") || new List()
|
||||||
|
|
||||||
@@ -319,6 +321,7 @@ export function contentTypeValues(state, pathMethod) {
|
|||||||
|
|
||||||
// Get the consumes/produces by path
|
// Get the consumes/produces by path
|
||||||
export function operationConsumes(state, pathMethod) {
|
export function operationConsumes(state, pathMethod) {
|
||||||
|
pathMethod = pathMethod || []
|
||||||
return spec(state).getIn(["paths", ...pathMethod, "consumes"], fromJS({}))
|
return spec(state).getIn(["paths", ...pathMethod, "consumes"], fromJS({}))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,6 +338,7 @@ export const canExecuteScheme = ( state, path, method ) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const validateBeforeExecute = ( state, pathMethod ) => {
|
export const validateBeforeExecute = ( state, pathMethod ) => {
|
||||||
|
pathMethod = pathMethod || []
|
||||||
let params = spec(state).getIn(["paths", ...pathMethod, "parameters"], fromJS([]))
|
let params = spec(state).getIn(["paths", ...pathMethod, "parameters"], fromJS([]))
|
||||||
let isValid = true
|
let isValid = true
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user