Skip to content

Commit

Permalink
fix: example value is not showed if it is false
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanHotsiy committed Jan 10, 2018
1 parent 1743453 commit 9756364
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/Fields/FieldDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
);
}
Expand Down
3 changes: 1 addition & 2 deletions src/services/models/Field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9756364

Please sign in to comment.