Revert "Merge pull request #3516 from owenconti/bug/3511-query-formData-parameters"

This reverts commit 6a7e9d2e88, reversing
changes made to eb01beedfa.
This commit is contained in:
Kyle Shockey
2017-09-23 10:51:32 -07:00
parent c8a9ddbf94
commit beeb6b608e
8 changed files with 19 additions and 23 deletions

View File

@@ -49,7 +49,7 @@ class Parameters extends Component {
onChangeKey,
} = this.props
changeParam( onChangeKey, param.get("name"), param.get("in"), value, isXml)
changeParam( onChangeKey, param.get("name"), value, isXml)
}
onChangeConsumesWrapper = ( val ) => {

View File

@@ -130,10 +130,10 @@ export const formatIntoYaml = () => ({specActions, specSelectors}) => {
}
}
export function changeParam( path, paramName, paramIn, value, isXml ){
export function changeParam( path, paramName, value, isXml ){
return {
type: UPDATE_PARAM,
payload:{ path, value, paramName, paramIn, isXml }
payload:{ path, value, paramName, isXml }
}
}
@@ -206,6 +206,7 @@ export const executeRequest = (req) =>
// if url is relative, parseUrl makes it absolute by inferring from `window.location`
req.contextUrl = parseUrl(specSelectors.url()).toString()
if(op && op.operationId) {
req.operationId = op.operationId
} else if(op && pathName && method) {

View File

@@ -40,10 +40,9 @@ export default {
},
[UPDATE_PARAM]: ( state, {payload} ) => {
let { path, paramName, paramIn, value, isXml } = payload
let { path, paramName, value, isXml } = payload
return state.updateIn( [ "resolved", "paths", ...path, "parameters" ], fromJS([]), parameters => {
const index = parameters.findIndex(p => p.get( "name" ) === paramName && p.get("in") === paramIn )
const index = parameters.findIndex(p => p.get( "name" ) === paramName )
if (!(value instanceof win.File)) {
value = fromJSOrdered( value )
}

View File

@@ -260,10 +260,10 @@ export const allowTryItOutFor = () => {
}
// Get the parameter value by parameter name
export function getParameter(state, pathMethod, name, inType) {
export function getParameter(state, pathMethod, name) {
let params = spec(state).getIn(["paths", ...pathMethod, "parameters"], fromJS([]))
return params.filter( (p) => {
return Map.isMap(p) && p.get("name") === name && p.get("in") === inType
return Map.isMap(p) && p.get("name") === name
}).first()
}
@@ -280,7 +280,7 @@ export function parameterValues(state, pathMethod, isXml) {
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")
return hash.set(`${p.get("in")}.${p.get("name")}`, value)
return hash.set(p.get("name"), value)
}, fromJS({}))
}