Option to generate OpenAPI schema from docstring if verbose_name not defined #8309
Unanswered
Adrian-at-CrimsonAzure
asked this question in
Ideas & Suggestions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I would love if DRF had the ability to pull docstrings for field labels on API OPTIONS. Say I have the following example model:
That would make the corresponding OPTIONS for the
/api/usersendpoint:{ "name": "User", "description": "User info", "renders": [ "application/json", "text/html" ], "parses": [ "application/json", "application/x-www-form-urlencoded", "multipart/form-data" ], "actions": { "PUT": { "company": { "type": "field", "required": false, "read_only": false, "label": "Company this user belongs to" }, "email": { "type": "email", "required": true, "read_only": false, "label": "Email address", "max_length": 254 }, "middle_name": { "type": "string", "required": false, "read_only": false, "label": "User middle name", "max_length": 255 }, "phone_number": { "type": "string", "required": false, "read_only": false, "label": "User phone number", "max_length": 50 } } } }Our model documentation is pretty comprehensive, it would be a shame to have to duplicate all of that into the verbose_name field or something.
Beta Was this translation helpful? Give feedback.
All reactions