Improvement: Hash-keyed Try-It-Out parameter value storage (#4670)
* allow param update by identity + hashed value storage * add specActions.changeParamByIdentity * add identity-based lookup support in spec selectors * migrate `changeParam` usage to `changeParamByIdentity` * migrate usage of `parameterWithMeta` to `parameterWithMetaByIdentity` * update invocations of `changeParamByIdentity` to match fn signature * use OrderedMap throughout hash-based selectors for consistency * normalize usage of ParameterRow `onChange` * migrate bug 4557 tests to reflect new ParameterRow interface * remove exclusive test blocks * linter fixes * copy Parameters changes into OAS3 wrapper * use rawParam for meta lookups in ParameterRow
This commit is contained in:
@@ -46,11 +46,10 @@ export default class ParamBody extends PureComponent {
|
||||
}
|
||||
|
||||
updateValues = (props) => {
|
||||
let { specSelectors, pathMethod, param, isExecute, consumesValue="" } = props
|
||||
let parameter = (specSelectors ? specSelectors.parameterWithMeta(pathMethod, param.get("name"), param.get("in")) : fromJS({})) || param
|
||||
let { param, isExecute, consumesValue="" } = props
|
||||
let isXml = /xml/i.test(consumesValue)
|
||||
let isJson = /json/i.test(consumesValue)
|
||||
let paramValue = isXml ? parameter.get("value_xml") : parameter.get("value")
|
||||
let paramValue = isXml ? param.get("value_xml") : param.get("value")
|
||||
|
||||
if ( paramValue !== undefined ) {
|
||||
let val = !paramValue && isJson ? "{}" : paramValue
|
||||
@@ -79,7 +78,7 @@ export default class ParamBody extends PureComponent {
|
||||
this._onChange(value, isXml)
|
||||
}
|
||||
|
||||
_onChange = (val, isXml) => { (this.props.onChange || NOOP)(this.props.param, val, isXml) }
|
||||
_onChange = (val, isXml) => { (this.props.onChange || NOOP)(val, isXml) }
|
||||
|
||||
handleOnChange = e => {
|
||||
const {consumesValue} = this.props
|
||||
@@ -107,7 +106,7 @@ export default class ParamBody extends PureComponent {
|
||||
const HighlightCode = getComponent("highlightCode")
|
||||
const ContentType = getComponent("contentType")
|
||||
// for domains where specSelectors not passed
|
||||
let parameter = specSelectors ? specSelectors.parameterWithMeta(pathMethod, param.get("name"), param.get("in")) : param
|
||||
let parameter = specSelectors ? specSelectors.parameterWithMetaByIdentity(pathMethod, param) : param
|
||||
let errors = parameter.get("errors", List())
|
||||
let consumesValue = specSelectors.contentTypeValues(pathMethod).get("requestContentType")
|
||||
let consumes = this.props.consumes && this.props.consumes.size ? this.props.consumes : ParamBody.defaultProp.consumes
|
||||
|
||||
Reference in New Issue
Block a user