Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ghazi-git
Copy link
Owner

@ghazi-git ghazi-git commented Jul 25, 2024

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, ...

…include examples that fail the schema validation done by schemathesis
…t fields.

For example, the regex `\d+\.field1` is used in the API schema to indicate that the API will return attribute values like `0.field1`, `1.field1`. Previously, attr was incorrectly specified as an enum with the value `INDEX.field1` that represents the actual API output.

fix #76
DICT_KEY_IN_API_SCHEMA settings
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant