add specPath to parameters/requstBody
This commit is contained in:
@@ -10,6 +10,7 @@ const RequestBody = ({
|
|||||||
specSelectors,
|
specSelectors,
|
||||||
contentType,
|
contentType,
|
||||||
isExecute,
|
isExecute,
|
||||||
|
specPath,
|
||||||
onChange
|
onChange
|
||||||
}) => {
|
}) => {
|
||||||
const Markdown = getComponent("Markdown")
|
const Markdown = getComponent("Markdown")
|
||||||
@@ -33,6 +34,7 @@ const RequestBody = ({
|
|||||||
expandDepth={1}
|
expandDepth={1}
|
||||||
isExecute={isExecute}
|
isExecute={isExecute}
|
||||||
schema={mediaTypeValue.get("schema")}
|
schema={mediaTypeValue.get("schema")}
|
||||||
|
specPath={[...specPath, "content", contentType]}
|
||||||
example={<RequestBodyEditor
|
example={<RequestBodyEditor
|
||||||
requestBody={requestBody}
|
requestBody={requestBody}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
@@ -52,7 +54,8 @@ RequestBody.propTypes = {
|
|||||||
specSelectors: PropTypes.object.isRequired,
|
specSelectors: PropTypes.object.isRequired,
|
||||||
contentType: PropTypes.string.isRequired,
|
contentType: PropTypes.string.isRequired,
|
||||||
isExecute: PropTypes.bool.isRequired,
|
isExecute: PropTypes.bool.isRequired,
|
||||||
onChange: PropTypes.func.isRequired
|
onChange: PropTypes.func.isRequired,
|
||||||
|
specPath: PropTypes.array.isRequired
|
||||||
}
|
}
|
||||||
|
|
||||||
export default RequestBody
|
export default RequestBody
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ class Parameters extends Component {
|
|||||||
fn: PropTypes.object.isRequired,
|
fn: PropTypes.object.isRequired,
|
||||||
tryItOutEnabled: PropTypes.bool,
|
tryItOutEnabled: PropTypes.bool,
|
||||||
allowTryItOut: PropTypes.bool,
|
allowTryItOut: PropTypes.bool,
|
||||||
|
specPath: PropTypes.array.isRequired,
|
||||||
onTryoutClick: PropTypes.func,
|
onTryoutClick: PropTypes.func,
|
||||||
onCancelClick: PropTypes.func,
|
onCancelClick: PropTypes.func,
|
||||||
onChangeKey: PropTypes.array,
|
onChangeKey: PropTypes.array,
|
||||||
@@ -90,6 +91,7 @@ class Parameters extends Component {
|
|||||||
oas3Actions,
|
oas3Actions,
|
||||||
oas3Selectors,
|
oas3Selectors,
|
||||||
pathMethod,
|
pathMethod,
|
||||||
|
specPath,
|
||||||
operation
|
operation
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
@@ -103,6 +105,8 @@ class Parameters extends Component {
|
|||||||
const { isOAS3 } = specSelectors
|
const { isOAS3 } = specSelectors
|
||||||
|
|
||||||
const requestBody = operation.get("requestBody")
|
const requestBody = operation.get("requestBody")
|
||||||
|
const requestBodySpecPath = [...specPath.slice(0, -1), "requestBody"] // remove the "parameters" part
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="opblock-section">
|
<div className="opblock-section">
|
||||||
<div className="opblock-section-header">
|
<div className="opblock-section-header">
|
||||||
@@ -134,9 +138,10 @@ class Parameters extends Component {
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{
|
{
|
||||||
eachMap(parameters, (parameter) => (
|
eachMap(parameters, (parameter, i) => (
|
||||||
<ParameterRow fn={ fn }
|
<ParameterRow fn={ fn }
|
||||||
getComponent={ getComponent }
|
getComponent={ getComponent }
|
||||||
|
specPath={[...specPath, i]}
|
||||||
param={ parameter }
|
param={ parameter }
|
||||||
key={ parameter.get( "name" ) }
|
key={ parameter.get( "name" ) }
|
||||||
onChange={ this.onChange }
|
onChange={ this.onChange }
|
||||||
@@ -172,6 +177,7 @@ class Parameters extends Component {
|
|||||||
</div>
|
</div>
|
||||||
<div className="opblock-description-wrapper">
|
<div className="opblock-description-wrapper">
|
||||||
<RequestBody
|
<RequestBody
|
||||||
|
specPath={requestBodySpecPath}
|
||||||
requestBody={requestBody}
|
requestBody={requestBody}
|
||||||
isExecute={isExecute}
|
isExecute={isExecute}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user