Display object model extensions correctly

This commit is contained in:
Kyle Shockey
2017-11-23 12:28:37 -06:00
parent b42e2a7045
commit c70e0f8c38
2 changed files with 27 additions and 1 deletions

View File

@@ -26,6 +26,8 @@ export default class ObjectModel extends Component {
return null
}
const { showExtensions } = getConfigs()
let description = schema.get("description")
let properties = schema.get("properties")
let additionalProperties = schema.get("additionalProperties")
@@ -99,6 +101,30 @@ export default class ObjectModel extends Component {
</tr>)
}).toArray()
}
{
// empty row befor extensions...
!showExtensions ? null : <tr>&nbsp;</tr>
}
{
!showExtensions ? null :
schema.entrySeq().map(
([key, value]) => {
if(key.slice(0,2) !== "x-") {
return
}
const normalizedValue = !value ? null : value.toJS ? value.toJS() : value
return (<tr key={key} style={{ color: "#777" }}>
<td>
{ key }
</td>
<td style={{ verticalAlign: "top" }}>
{ JSON.stringify(normalizedValue) }
</td>
</tr>)
}).toArray()
}
{
!additionalProperties || !additionalProperties.size ? null
: <tr>