This commit is contained in:
Anna Bodnia
2017-04-19 11:28:35 +03:00
13 changed files with 137 additions and 62 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;AAu/FA;AA6+FA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0dA;AAkoJA;AAyiCA;;;;;AAskCA;AA+4IA;AAs1FA;AAk3GA;AAsoEA;AAi+CA;AA+/CA;AA+rCA;AAm4EA;AAi7HA;;;;;;;;;;;;;;AA0vGA;AAyoIA;AAiuJA;AA8kHA;AAonGA;AAukEA;AA02DA;AA+2EA;AAm6GA;;;;;;AA4yEA;AA24FA;;;;;AAy3CA;AA2qFA;AAw2CA;AA2kCA;AAq/CA;AAwwEA;AA48FA;;;;;;;;;AA81BA;AA2zIA;AAi4DA;AAqlDA;;;;;;AA4kCA;AA8iHA;AAipGA","sourceRoot":""}
{"version":3,"file":"swagger-ui-bundle.js","sources":["webpack:///swagger-ui-bundle.js"],"mappings":"AAAA;AAu/FA;AA6+FA;;;;;;;;;;;;;;;;;;;;;;;;;;AA0dA;;;;;;AAoIA;AAk7FA;AAmtCA;;;;;AA0uIA;AA66IA;AA47FA;AAyrGA;AA8hFA;AA6rFA;AAm9CA;AA4hDA;AA0rCA;AA47EA;AA+yHA;;;;;;;;;;;;;;AAmvIA;AA4mIA;AAquJA;AAwsHA;AAinGA;AAmiEA;AAy4DA;AAm2DA;AAytBA;;;;;;AA68EA;AAm0FA;;;;;AA23CA;AA2qFA;AAw2CA;AA2kCA;AAq/CA;AA6kFA;AA81FA;;;;;;;;;AAo4CA;AA2zIA;AAi4DA;AAqlDA","sourceRoot":""}

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{"version":3,"file":"swagger-ui-standalone-preset.js","sources":["webpack:///swagger-ui-standalone-preset.js"],"mappings":"AAAA;;;;;AA6PA;AAyiGA","sourceRoot":""}
{"version":3,"file":"swagger-ui-standalone-preset.js","sources":["webpack:///swagger-ui-standalone-preset.js"],"mappings":"AAAA;;;;;AA4QA;AAitGA","sourceRoot":""}

2
dist/swagger-ui.css vendored

File diff suppressed because one or more lines are too long

14
dist/swagger-ui.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -67,7 +67,7 @@
"reselect": "2.5.3",
"serialize-error": "2.0.0",
"shallowequal": "0.2.2",
"swagger-client": "^3.0.5",
"swagger-client": "^3.0.6",
"url-parse": "^1.1.8",
"whatwg-fetch": "0.11.1",
"worker-loader": "^0.7.1",

View File

@@ -97,7 +97,11 @@ export default {
},
[UPDATE_OPERATION_VALUE]: (state, { payload: { path, value, key } }) => {
return state.setIn(["resolved", "paths", ...path, key], fromJS(value))
let operationPath = ["resolved", "paths", ...path]
if(!state.getIn(operationPath)) {
return state
}
return state.setIn([...operationPath, key], fromJS(value))
},
[CLEAR_RESPONSE]: (state, { payload: { path, method } } ) =>{

View File

@@ -299,7 +299,7 @@ export const operationScheme = ( state, path, method ) => {
let matchResult = url.match(/^([a-z][a-z0-9+\-.]*):/)
let urlScheme = Array.isArray(matchResult) ? matchResult[1] : null
return state.getIn(["scheme", path, method]) || state.getIn(["scheme", "_defaultScheme"]) || urlScheme || "http"
return state.getIn(["scheme", path, method]) || state.getIn(["scheme", "_defaultScheme"]) || urlScheme || ""
}
export const canExecuteScheme = ( state, path, method ) => {

View File

@@ -0,0 +1,72 @@
/* eslint-env mocha */
import expect from "expect"
import { fromJS } from "immutable"
import reducer from "corePlugins/spec/reducers"
describe("spec plugin - reducer", function(){
describe("update operation value", function() {
it("should update the operation at the specified key", () => {
const updateOperationValue = reducer["spec_update_operation_value"]
const state = fromJS({
resolved: {
"paths": {
"/pet": {
"post": {
"description": "my operation"
}
}
}
}
})
let result = updateOperationValue(state, {
payload: {
path: ["/pet", "post"],
value: "application/json",
key: "consumes_value"
}
})
let expectedResult = {
resolved: {
"paths": {
"/pet": {
"post": {
"description": "my operation",
"consumes_value": "application/json"
}
}
}
}
}
expect(result.toJS()).toEqual(expectedResult)
})
it("shouldn't throw an error if we try to update the consumes_value of a null operation", () => {
const updateOperationValue = reducer["spec_update_operation_value"]
const state = fromJS({
resolved: {
"paths": {
"/pet": {
"post": null
}
}
}
})
let result = updateOperationValue(state, {
payload: {
path: ["/pet", "post"],
value: "application/json",
key: "consumes_value"
}
})
expect(result.toJS()).toEqual(state.toJS())
})
})
})