Merge branch 'master' into support/editor-validation-refactor

This commit is contained in:
kyle
2017-12-23 00:18:26 -06:00
committed by GitHub
3 changed files with 10 additions and 3 deletions

View File

@@ -72,10 +72,10 @@ export const servers = onlyOAS3(createSelector(
export const isOAS3 = (ori, system) => () => { export const isOAS3 = (ori, system) => () => {
const spec = system.getSystem().specSelectors.specJson() const spec = system.getSystem().specSelectors.specJson()
return isOAS3Helper(spec) return isOAS3Helper(Map.isMap(spec) ? spec : Map())
} }
export const isSwagger2 = (ori, system) => () => { export const isSwagger2 = (ori, system) => () => {
const spec = system.getSystem().specSelectors.specJson() const spec = system.getSystem().specSelectors.specJson()
return isSwagger2Helper(spec) return isSwagger2Helper(Map.isMap(spec) ? spec : Map())
} }

View File

@@ -68,7 +68,7 @@ export const parseToJson = (str) => ({specActions, specSelectors, errActions}) =
line: e.mark && e.mark.line ? e.mark.line + 1 : undefined line: e.mark && e.mark.line ? e.mark.line + 1 : undefined
}) })
} }
if(json) { if(json && typeof json === "object") {
return specActions.updateJsonSpec(json) return specActions.updateJsonSpec(json)
} }
return {} return {}

View File

@@ -4,6 +4,10 @@ import { fromJS, Set, Map, OrderedMap, List } from "immutable"
const DEFAULT_TAG = "default" const DEFAULT_TAG = "default"
const OPERATION_METHODS = [
"get", "put", "post", "delete", "options", "head", "patch", "trace"
]
const state = state => { const state = state => {
return state || Map() return state || Map()
} }
@@ -95,6 +99,9 @@ export const operations = createSelector(
return {} return {}
} }
path.forEach((operation, method) => { path.forEach((operation, method) => {
if(OPERATION_METHODS.indexOf(method) < 0) {
return
}
list = list.push(fromJS({ list = list.push(fromJS({
path: pathName, path: pathName,
method, method,