fix: example value is not showed if it is false

This commit is contained in:
Roman Hotsiy 2018-01-10 18:23:53 +02:00
parent 174345399f
commit 975636411b
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
2 changed files with 2 additions and 3 deletions

View File

@ -12,7 +12,7 @@ export class FieldDetail extends React.PureComponent<FieldDetailProps> {
return (
<div>
<FieldLabel> {this.props.label} </FieldLabel>{' '}
<ExampleValue> {this.props.value} </ExampleValue>
<ExampleValue> {JSON.stringify(this.props.value)} </ExampleValue>
</div>
);
}

View File

@ -35,8 +35,7 @@ export class FieldModel {
this.schema = new SchemaModel(parser, info.schema || {}, schemaPointer, options);
this.description =
info.description === undefined ? this.schema.description || '' : info.description;
const example = info.example || this.schema.example;
this.example = example && JSON.stringify(example);
this.example = info.example || this.schema.example;
this.deprecated = info.deprecated === undefined ? !!this.schema.deprecated : info.deprecated;
parser.exitRef(infoOrRef);