Skip to content
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

component properties description support #140

Closed
gthieleb opened this issue Aug 6, 2020 · 4 comments
Closed

component properties description support #140

gthieleb opened this issue Aug 6, 2020 · 4 comments

Comments

@gthieleb
Copy link

gthieleb commented Aug 6, 2020

it would be great to have a property description generated by its serializer field.label or in case of ModelSerializer its ModelField.verbose_name attribute.

@tfranzel
Copy link
Owner

tfranzel commented Sep 20, 2020

hi @gthieleb, sry for the late reply. for field description we currently extract help_text either from the serializer field (Serializer) or model field (ModelSerializer) if it is available.

can you give an example of where verbose_name would be beneficial, because i imagine that it is usually used just as a nicer field name representation (e.g. field_email --> Email), in which case it would not really add additional information and make the schema a bit more noisy. but i could imagine having that as a fallback to help_text.

@gthieleb
Copy link
Author

gthieleb commented Sep 22, 2020

Hi tfranzel, thanks for your answer.

Like you describe I always use the verbose_name attr for a beautiful presentation of a form field label and also manage the translation of the label.

I randomly also use help_text to describe a further usage of a form field.

The main usage is to deliver this information via OpenApi spec to the frontend and avoid to maintain the label representation in multiple places.

@gthieleb
Copy link
Author

gthieleb commented Nov 4, 2020

I'll create a pull request to include generation of the title property from the verbose_name attr as described in json-schema generic keywords.

@gthieleb gthieleb closed this as completed Nov 4, 2020
@tfranzel
Copy link
Owner

tfranzel commented Nov 4, 2020

sry this fell of the waggon. i was honestly unsure where to put it initially. title did not come to mind, but it looks like the perfect place. i hope duplication (like title description and summary all being the same) won't be an issue. happy to look at a PR. thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants