-
Notifications
You must be signed in to change notification settings - Fork 260
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
Enum key/value description #952
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -723,7 +723,10 @@ def _map_serializer_field(self, field, direction, bypass_extensions=False): | |
return append_meta(build_array_type(build_choice_field(field)), meta) | ||
|
||
if isinstance(field, serializers.ChoiceField): | ||
return append_meta(build_choice_field(field), meta) | ||
schema = build_choice_field(field) | ||
if 'description' in meta: | ||
meta['description'] = meta['description'] + '\n\n' + schema.pop('description') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This generates a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tfranzel this is breaking our current build, because we set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Damn, can't seem do a release without a
would lead to a None str concat There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will wait for the release until tonight to see whether something else will come up. |
||
return append_meta(schema, meta) | ||
|
||
if isinstance(field, serializers.ListField): | ||
if isinstance(field.child, _UnvalidatedField): | ||
|
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.
Apology for commenting on merging MR, @tfranzel .
Just a question about these changes...
We have a serializer with field (choices) and it has
help_text
. Unfortunately this help text is not preserved in the description of the enum due to this line. How we can preserve this description along with choices?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.
@sshishov, the
help_text
should still be there in the serializer component (NOT the enum component as it belongs to the field). This could otherwise lead confusing descriptions actually belonging somewhere else.If that is not the case, please open new issue with a reproduction and full example. thx