Skip to content

Conversation

@BPLint
Copy link

@BPLint BPLint commented Oct 23, 2024

This PR corrects the field definition of "remote_fields" in the Pydantic models, which was causing validation errors. Previously, the omission of = None at the end of the field definition inadvertently made the field required, despite it being nullable. Since the remote_fields field is not present in every API response and should be both optional and nullable, this update properly adjusts its definition.

Changes:

  • Updated the remote_fields field in the Pydantic models to include = None, ensuring it is treated as an optional field that can be None when not present in the API response.

Context:
This change resolves validation errors encountered during the parsing of API responses where remote_fields was missing, and the Pydantic models incorrectly treated it as a required field.

Testing:

  • Verified that the models now properly handle cases where remote_fields is omitted or returns an empty array.
  • Confirmed that responses with or without this field pass validation without errors.

Reference:
https://docs.pydantic.dev/latest/migration/#required-optional-and-nullable-fields
Field definition F4 (required, nullable) is correct here.
See also:
#98

@BPLint BPLint requested a review from a team as a code owner October 23, 2024 20:24
@BPLint BPLint requested a review from rmkonnur October 23, 2024 20:24
@BPLint BPLint marked this pull request as draft October 23, 2024 20:24
@BPLint BPLint changed the title Updated typing on remote_fields in Pydantic models to make it an opti… Fix remote_fields Definition in Pydantic Models to Make Field Optional and Nullable Oct 23, 2024
@BPLint BPLint marked this pull request as ready for review October 23, 2024 20:35
@dsinghvi dsinghvi closed this Apr 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants