drf-standardized-errors icon indicating copy to clipboard operation
drf-standardized-errors copied to clipboard

fix-schema-generation-for-list-dict-fields

Open ghazi-git opened this issue 1 year ago • 0 comments

Use a pattern to correctly describe the attr value in validation errors in all cases.

Specifically, this fixes the incorrect description of the attr value for list serializers and list/dict fields. Taking the example of a list serializer with 1 field named my_field. The validation errors for this field will have the attr value set as 0.my_field, 1.my_field, ...

  • Previously, the attr value was described with an enum having a single value INDEX.my_field.
  • Now, it shows up as a string with the pattern \d+\.my_field and this pattern correctly described the actual attr value returned by the API 0.my_field, 1.my_field, ...

ghazi-git avatar Jul 25 '24 18:07 ghazi-git