fix: use specPath prop to resolve operations in OperationContainer (#4272)

* Use `parameterWithMeta` to get parameter data in <ParameterRow>

* Prefer specPath when fetching resolved subtrees in OperationContainer

* Add test for OAS3 callback rendering

* Remove debugger statement
This commit is contained in:
kyle
2018-02-28 17:50:08 -08:00
committed by GitHub
parent 22036b1fbf
commit 8777d8b9ff
6 changed files with 128 additions and 11 deletions

View File

@@ -4,7 +4,7 @@ import ImPropTypes from "react-immutable-proptypes"
import { fromJS } from "immutable"
const Callbacks = (props) => {
let { callbacks, getComponent } = props
let { callbacks, getComponent, specPath } = props
// const Markdown = getComponent("Markdown")
const OperationContainer = getComponent("OperationContainer", true)
@@ -28,6 +28,7 @@ const Callbacks = (props) => {
tag={""}
method={method}
path={pathItemName}
specPath={specPath.push(callbackName, pathItemName, method)}
allowTryItOut={false}
/>
}) }
@@ -42,8 +43,8 @@ const Callbacks = (props) => {
Callbacks.propTypes = {
getComponent: PropTypes.func.isRequired,
callbacks: ImPropTypes.iterable.isRequired
callbacks: ImPropTypes.iterable.isRequired,
specPath: ImPropTypes.list.isRequired,
}
export default Callbacks

View File

@@ -161,7 +161,10 @@ class Parameters extends Component {
</div> : "" }
{this.state.callbackVisible ? <div className="callbacks-container opblock-description-wrapper">
<Callbacks callbacks={Map(operation.get("callbacks"))} />
<Callbacks
callbacks={Map(operation.get("callbacks"))}
specPath={specPath.slice(0, -1).push("callbacks")}
/>
</div> : "" }
{
isOAS3() && requestBody && this.state.parametersVisible &&