Skip to content

Commit c70e0f8

Browse files
committed
Display object model extensions correctly
1 parent b42e2a7 commit c70e0f8

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

src/core/components/object-model.jsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ export default class ObjectModel extends Component {
2626
return null
2727
}
2828

29+
const { showExtensions } = getConfigs()
30+
2931
let description = schema.get("description")
3032
let properties = schema.get("properties")
3133
let additionalProperties = schema.get("additionalProperties")
@@ -99,6 +101,30 @@ export default class ObjectModel extends Component {
99101
</tr>)
100102
}).toArray()
101103
}
104+
{
105+
// empty row befor extensions...
106+
!showExtensions ? null : <tr>&nbsp;</tr>
107+
}
108+
{
109+
!showExtensions ? null :
110+
schema.entrySeq().map(
111+
([key, value]) => {
112+
if(key.slice(0,2) !== "x-") {
113+
return
114+
}
115+
116+
const normalizedValue = !value ? null : value.toJS ? value.toJS() : value
117+
118+
return (<tr key={key} style={{ color: "#777" }}>
119+
<td>
120+
{ key }
121+
</td>
122+
<td style={{ verticalAlign: "top" }}>
123+
{ JSON.stringify(normalizedValue) }
124+
</td>
125+
</tr>)
126+
}).toArray()
127+
}
102128
{
103129
!additionalProperties || !additionalProperties.size ? null
104130
: <tr>

src/style/_table.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ table
1919

2020
&:first-of-type
2121
{
22-
width: 124px;
22+
width: 174px;
2323
padding: 0 0 0 2em;
2424
}
2525
}

0 commit comments

Comments
 (0)