MOAR rendering (improve media type detection; render object model
nullables)
This commit is contained in:
@@ -34,9 +34,10 @@ class ObjectModel extends Component {
|
|||||||
|
|
||||||
render(){
|
render(){
|
||||||
let { schema, name, isRef, getComponent, depth, deprecated, ...props } = this.props
|
let { schema, name, isRef, getComponent, depth, deprecated, ...props } = this.props
|
||||||
let { expandDepth } = this.props
|
let { expandDepth, specSelectors } = this.props
|
||||||
const JumpToPath = getComponent("JumpToPath", true)
|
const JumpToPath = getComponent("JumpToPath", true)
|
||||||
let description = schema.get("description")
|
let description = schema.get("description")
|
||||||
|
let nullable = schema.get("nullable")
|
||||||
let properties = schema.get("properties")
|
let properties = schema.get("properties")
|
||||||
let additionalProperties = schema.get("additionalProperties")
|
let additionalProperties = schema.get("additionalProperties")
|
||||||
let title = schema.get("title") || name
|
let title = schema.get("title") || name
|
||||||
@@ -70,6 +71,12 @@ class ObjectModel extends Component {
|
|||||||
<td>{ description }</td>
|
<td>{ description }</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
(!specSelectors.isOAS3() || !nullable) ? null : <tr style={{ color: "#999", fontStyle: "italic" }}>
|
||||||
|
<td>nullable</td>
|
||||||
|
<td>{ nullable }</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
{
|
{
|
||||||
!(properties && properties.size) ? null : properties.entrySeq().map(
|
!(properties && properties.size) ? null : properties.entrySeq().map(
|
||||||
([key, value]) => {
|
([key, value]) => {
|
||||||
|
|||||||
@@ -67,7 +67,14 @@ export default class Response extends React.Component {
|
|||||||
const Markdown = getComponent( "Markdown" )
|
const Markdown = getComponent( "Markdown" )
|
||||||
const OperationLink = getComponent("operationLink")
|
const OperationLink = getComponent("operationLink")
|
||||||
|
|
||||||
let sampleResponse = schema ? getSampleSchema(schema, contentType, { includeReadOnly: true }) : null
|
var sampleResponse
|
||||||
|
|
||||||
|
if(specSelectors.isOAS3()) {
|
||||||
|
let oas3SchemaForContentType = response.getIn(["content", contentType, "schema"])
|
||||||
|
sampleResponse = oas3SchemaForContentType ? getSampleSchema(oas3SchemaForContentType, contentType, { includeReadOnly: true }) : null
|
||||||
|
} else {
|
||||||
|
sampleResponse = schema ? getSampleSchema(schema, contentType, { includeReadOnly: true }) : null
|
||||||
|
}
|
||||||
let example = getExampleComponent( sampleResponse, examples, HighlightCode )
|
let example = getExampleComponent( sampleResponse, examples, HighlightCode )
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user