diff --git a/src/core/components/content-type.jsx b/src/core/components/content-type.jsx index 6f81f671..19d22188 100644 --- a/src/core/components/content-type.jsx +++ b/src/core/components/content-type.jsx @@ -27,6 +27,16 @@ export default class ContentType extends React.Component { } } + componentWillReceiveProps(nextProps) { + if(!nextProps.contentTypes || !nextProps.contentTypes.size) { + return + } + + if(!nextProps.contentTypes.includes(nextProps.value)) { + nextProps.onChange(nextProps.contentTypes.first()) + } + } + onChangeWrapper = e => this.props.onChange(e.target.value) render() { diff --git a/src/core/plugins/oas3/components/request-body.jsx b/src/core/plugins/oas3/components/request-body.jsx index 5b20a50c..4c13f1d6 100644 --- a/src/core/plugins/oas3/components/request-body.jsx +++ b/src/core/plugins/oas3/components/request-body.jsx @@ -22,6 +22,10 @@ const RequestBody = ({ const mediaTypeValue = requestBodyContent.get(contentType) + if(!mediaTypeValue) { + return null + } + return
{ requestBodyDescription &&