fix(try-it-out): reset of oas3 requestBody should use default values (#8265)
Co-authored-by: Mathias Spanhove <mathias.spanhove@katoennatie.com>
This commit is contained in:
@@ -17,6 +17,7 @@ export default class Operation extends PureComponent {
|
||||
|
||||
toggleShown: PropTypes.func.isRequired,
|
||||
onTryoutClick: PropTypes.func.isRequired,
|
||||
onResetClick: PropTypes.func.isRequired,
|
||||
onCancelClick: PropTypes.func.isRequired,
|
||||
onExecute: PropTypes.func.isRequired,
|
||||
|
||||
@@ -48,6 +49,7 @@ export default class Operation extends PureComponent {
|
||||
request,
|
||||
toggleShown,
|
||||
onTryoutClick,
|
||||
onResetClick,
|
||||
onCancelClick,
|
||||
onExecute,
|
||||
fn,
|
||||
@@ -152,6 +154,7 @@ export default class Operation extends PureComponent {
|
||||
operation={operation}
|
||||
onChangeKey={onChangeKey}
|
||||
onTryoutClick = { onTryoutClick }
|
||||
onResetClick = { onResetClick }
|
||||
onCancelClick = { onCancelClick }
|
||||
tryItOutEnabled = { tryItOutEnabled }
|
||||
allowTryItOut={allowTryItOut}
|
||||
|
||||
@@ -25,6 +25,7 @@ export default class Parameters extends Component {
|
||||
tryItOutEnabled: PropTypes.bool,
|
||||
allowTryItOut: PropTypes.bool,
|
||||
onTryoutClick: PropTypes.func,
|
||||
onResetClick: PropTypes.func,
|
||||
onCancelClick: PropTypes.func,
|
||||
onChangeKey: PropTypes.array,
|
||||
pathMethod: PropTypes.array.isRequired,
|
||||
@@ -73,7 +74,7 @@ export default class Parameters extends Component {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onChangeMediaType = ({ value, pathMethod }) => {
|
||||
let { specActions, oas3Selectors, oas3Actions } = this.props
|
||||
const userHasEditedBody = oas3Selectors.hasUserEditedBody(...pathMethod)
|
||||
@@ -94,6 +95,7 @@ export default class Parameters extends Component {
|
||||
|
||||
let {
|
||||
onTryoutClick,
|
||||
onResetClick,
|
||||
parameters,
|
||||
allowTryItOut,
|
||||
tryItOutEnabled,
|
||||
@@ -161,7 +163,7 @@ export default class Parameters extends Component {
|
||||
enabled={tryItOutEnabled}
|
||||
onCancelClick={this.props.onCancelClick}
|
||||
onTryoutClick={onTryoutClick}
|
||||
onResetClick={() => oas3Actions.setRequestBodyValue({ value: undefined, pathMethod })}/>
|
||||
onResetClick={() => onResetClick(pathMethod)}/>
|
||||
) : null}
|
||||
</div>
|
||||
{this.state.parametersVisible ? <div className="parameters-container">
|
||||
@@ -220,7 +222,7 @@ export default class Parameters extends Component {
|
||||
onChange={(value) => {
|
||||
this.onChangeMediaType({ value, pathMethod })
|
||||
}}
|
||||
className="body-param-content-type"
|
||||
className="body-param-content-type"
|
||||
ariaLabel="Request content type" />
|
||||
</label>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user