Skip to content

Commit

Permalink
WIP: Handle oneOf variations in the UI. RE: temando#32
Browse files Browse the repository at this point in the history
  • Loading branch information
Brendan Abbott committed Jun 6, 2017
1 parent 1857e91 commit 63b2307
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/components/BodyContent/BodyContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ export default class BodyContent extends Component {
return null
}

// Peek at first item of `schema` to see if it's an array of possible
// schemas (eg. oneOf).
if (Array.isArray(schema[0])) {
return schema.map(
(schemaVariation, i) => <BodySchema key={i} properties={schemaVariation} styleVariation='odd' />
)
}

return (
<BodySchema properties={schema} styleVariation='odd' />
)
Expand Down
4 changes: 2 additions & 2 deletions src/handlers/BaseHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class BaseHandler extends Component {

render () {
const { parsedDefinition: definition, location } = this.props
const specUrl = this.props.location.query.url
const specUrl = location.query.url

return (
<DocumentTitle title='Open API v3 renderer'>
<DocumentTitle title={definition ? definition.title : 'Open API v3 renderer'}>
<div className='main'>
{!definition && "Welcome to Temando's new Open API Renderer. Watch this space!"}
{definition && <Page definition={definition} location={location} specUrl={specUrl} />}
Expand Down

0 comments on commit 63b2307

Please sign in to comment.