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/containers/OperationContainer.jsx b/src/core/containers/OperationContainer.jsx index 510f52e4..4f224855 100644 --- a/src/core/containers/OperationContainer.jsx +++ b/src/core/containers/OperationContainer.jsx @@ -57,6 +57,8 @@ export default class OperationContainer extends PureComponent { const operationId = op.getIn(["operation", "operationId"]) || op.getIn(["operation", "__originalOperationId"]) || opId(op.get("operation"), props.path, props.method) || op.get("id") const isShownKey = ["operations", props.tag, operationId] const isDeepLinkingEnabled = deepLinking && deepLinking !== "false" + const allowTryItOut = typeof props.allowTryItOut === "undefined" ? + props.specSelectors.allowTryItOutFor(props.path, props.method) : props.allowTryItOut return { operationId, @@ -64,9 +66,9 @@ export default class OperationContainer extends PureComponent { showSummary, displayOperationId, displayRequestDuration, + allowTryItOut, isShown: layoutSelectors.isShown(isShownKey, docExpansion === "full" ), jumpToKey: `paths.${props.path}.${props.method}`, - allowTryItOut: props.specSelectors.allowTryItOutFor(props.path, props.method), response: props.specSelectors.responseFor(props.path, props.method), request: props.specSelectors.requestFor(props.path, props.method) } diff --git a/src/core/plugins/oas3/components/callbacks.jsx b/src/core/plugins/oas3/components/callbacks.jsx index 9290c6fe..43437375 100644 --- a/src/core/plugins/oas3/components/callbacks.jsx +++ b/src/core/plugins/oas3/components/callbacks.jsx @@ -1,10 +1,12 @@ import React from "react" import PropTypes from "prop-types" +import ImPropTypes from "react-immutable-proptypes" +import { fromJS } from "immutable" const Callbacks = (props) => { let { callbacks, getComponent } = props // const Markdown = getComponent("Markdown") - const Operation = getComponent("operation", true) + const OperationContainer = getComponent("OperationContainer", true) if(!callbacks) { return No callbacks @@ -16,24 +18,22 @@ const Callbacks = (props) => { { callback.map((pathItem, pathItemName) => { return
{JSON.stringify(operation)}
+ />
}) }
{JSON.stringify(callback)}
- //