Basic request body
This commit is contained in:
@@ -217,7 +217,7 @@ class Model extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
let { schema, required, name, isRef } = this.props
|
let { schema, required, name, isRef, getComponent } = this.props
|
||||||
let $$ref = schema && schema.get("$$ref")
|
let $$ref = schema && schema.get("$$ref")
|
||||||
let modelName = $$ref && this.getModelName( $$ref )
|
let modelName = $$ref && this.getModelName( $$ref )
|
||||||
let modelSchema, type
|
let modelSchema, type
|
||||||
|
|||||||
@@ -189,6 +189,7 @@ export default class Operation extends React.Component {
|
|||||||
}
|
}
|
||||||
<Parameters
|
<Parameters
|
||||||
parameters={parameters}
|
parameters={parameters}
|
||||||
|
operation={operation}
|
||||||
onChangeKey={onChangeKey}
|
onChangeKey={onChangeKey}
|
||||||
onTryoutClick = { this.onTryoutClick }
|
onTryoutClick = { this.onTryoutClick }
|
||||||
onCancelClick = { this.onCancelClick }
|
onCancelClick = { this.onCancelClick }
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export function OAS3ComponentWrapFactory(Component) {
|
|||||||
const spec = system.specSelectors.specJson().toJS()
|
const spec = system.specSelectors.specJson().toJS()
|
||||||
|
|
||||||
if(isOAS3(spec)) {
|
if(isOAS3(spec)) {
|
||||||
return <Component {...props}></Component>
|
return <Component {...props} Ori={Ori}></Component>
|
||||||
} else {
|
} else {
|
||||||
return <Ori {...props}></Ori>
|
return <Ori {...props}></Ori>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import Markdown from "./markdown"
|
import Markdown from "./markdown"
|
||||||
|
import parameters from "./parameters"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
Markdown
|
Markdown,
|
||||||
|
parameters
|
||||||
}
|
}
|
||||||
|
|||||||
45
src/core/plugins/oas3/wrap-components/parameters.jsx
Normal file
45
src/core/plugins/oas3/wrap-components/parameters.jsx
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
import React from "react"
|
||||||
|
import Im, { OrderedMap } from "immutable"
|
||||||
|
import { OAS3ComponentWrapFactory } from "../helpers"
|
||||||
|
|
||||||
|
const mapRequestBody = (iterable, fn) => iterable.entries().filter(Im.Map.isMap).map((val) => {
|
||||||
|
return fn(val.get(0), val.get(1))
|
||||||
|
})
|
||||||
|
|
||||||
|
export default OAS3ComponentWrapFactory((props) => {
|
||||||
|
const { Ori, operation, getComponent, specSelectors } = props
|
||||||
|
|
||||||
|
const Model = getComponent("model")
|
||||||
|
|
||||||
|
const requestBody = operation.get("requestBody")
|
||||||
|
const requestBodyDescription = (requestBody && requestBody.get("description")) || null
|
||||||
|
const requestBodyContent = (requestBody && requestBody.get("content")) || new OrderedMap()
|
||||||
|
return <div>
|
||||||
|
<Ori {...props}></Ori>
|
||||||
|
{
|
||||||
|
requestBody &&
|
||||||
|
<div className="opblock-section">
|
||||||
|
<div className="opblock-section-header">
|
||||||
|
<h4 className="opblock-title">Request body</h4>
|
||||||
|
</div>
|
||||||
|
<div className="opblock-description-wrapper">
|
||||||
|
{ requestBodyDescription &&
|
||||||
|
<p>{requestBodyDescription}</p>
|
||||||
|
}
|
||||||
|
{ !requestBodyContent.count() ? <p>No content</p> :
|
||||||
|
requestBodyContent.map((mediaTypeValue, key) => (
|
||||||
|
<div>
|
||||||
|
<h4>{key}</h4>
|
||||||
|
<Model
|
||||||
|
getComponent={ getComponent }
|
||||||
|
specSelectors={ specSelectors }
|
||||||
|
expandDepth={1}
|
||||||
|
schema={mediaTypeValue.get("schema")} />
|
||||||
|
</div>
|
||||||
|
)).toArray()
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user