Use explicit declared serializer field label as oas title#286
Use explicit declared serializer field label as oas title#286wonderbeyond wants to merge 1 commit intotfranzel:masterfrom
Conversation
|
this looks like it is very similar to #191. please read through it first so we are on the same page. |
Yes, I share similar idea with #191. However I were not caring about filter parameters, and I think filters should be treated much differently with models and serializers. (about this idea, also refer #234 (comment)) @tfranzel below is your comment at page #191:
You want a way to find out if |
|
@wonderbeyond, this is just as i suspected. as you see, a lot of tests are failing because the title gets added everywhere. This is exactly the same duplication problem, where name and title are just copies. this add alot noise to the schema with no additional info. |
I think these noises can be fixed in drf-spectacular's own code scope, though I've not read through enough code and can not help more. My intention is to find only explicit declared serializer field labels. I'm so sorry that I'm busy currently and have no spare time to give more comments... |
|
@wonderbeyond sry for the long wait. |
NOTE: every serializer field has a non-empty label, when not declared it's derived from the field name. I think only explicitly declared labels are necessary to go into the OAS schema. So I read the label from
field._kwargs, notfield.label.