-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Fixes #218: Allow rendering description from schema for all fields. #263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/components/fields/SchemaField.js
Outdated
return ( | ||
<div className={classList}> | ||
{displayLabel && label ? getLabel(label, required, id) : null} | ||
<DescriptionField id={ `${id}__description` } description={ description } /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: {
(no space within curly brackets)${id}__description
}
Would you mind adding a few tests? Thanks! |
Done. |
test/SchemaField_test.js
Outdated
const schema = { | ||
type: "object", | ||
properties: { | ||
foo: {type: "string",description:"A Foo field"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: missing space after comma
Thanks for highlighting the styling issues. Resolved now. |
test/SchemaField_test.js
Outdated
const schema = { | ||
type: "object", | ||
properties: { | ||
foo: {"$ref": "#/definitions/foo"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: $ref
(no quotes) works too
If you know about what the rules to add are, please add them :) |
Will do. As another pull request. |
test/SchemaField_test.js
Outdated
|
||
it("should render description if available from a referenced schema", () => { | ||
// Overriding. | ||
const schema = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised you can reassign a const
here. You should probably name this specific schema differently instead.
Side note, please avoid squashing and keep your commits atomic on the PR so I can review them individually. Squashing is enabled for this repo so a single commit will eventually land anyway :) |
Noted. It's just that I didn't want the intermediate commits on my fork either. But seeing that you have left comments on them, I guess I shouldn't be squashing them. Got it. |
When you have a spare moment later, can restart the Travis build? It failed because of issues with |
Jobs restarted. Edit: restarted again. Edit: npm's broken today it seems. |
bar: {type: "string"} | ||
} | ||
}; | ||
it("should render description if available from the schema", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: insert blank line above this line
Strange issue with travis it seems, where fetching this url https://registry.npmjs.org/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.8.0.tgz fails with a
|
Perfect, I'm landing this. Again, thanks for contributing! |
Released in v0.36.0. |
Helps with #218