Merge pull request #2846 from bodnia/fix-2800

fix #2800
This commit is contained in:
Anna
2017-04-04 12:40:04 +03:00
committed by GitHub
3 changed files with 14 additions and 6 deletions

8
dist/swagger-ui.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;AAsoGA;AAy4HA;AA+7FA;AA2mCA;AAw/BA;AA2hCA;AAs5BA","sourceRoot":""} {"version":3,"file":"swagger-ui.js","sources":["webpack:///swagger-ui.js"],"mappings":"AAAA;AAsoGA;AAy4HA;AA+7FA;AA2mCA;AAkgCA;AAshCA;AAm5BA","sourceRoot":""}

View File

@@ -5,9 +5,17 @@ import { getSampleSchema } from "core/utils"
const getExampleComponent = ( sampleResponse, examples, HighlightCode ) => { const getExampleComponent = ( sampleResponse, examples, HighlightCode ) => {
if ( examples && examples.size ) { if ( examples && examples.size ) {
return examples.entrySeq().map( ([ key, example ]) => { return examples.entrySeq().map( ([ key, example ]) => {
let exampleValue
try {
exampleValue = example && example.toJS ? example.toJS() : example
exampleValue = JSON.stringify(exampleValue)
}
catch(e) {
exampleValue = String(example)
}
return (<div key={ key }> return (<div key={ key }>
<h5>{ key }</h5> <h5>{ key }</h5>
<HighlightCode className="example" value={ example } /> <HighlightCode className="example" value={ exampleValue } />
</div>) </div>)
}).toArray() }).toArray()
} }