Skip to content
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

Pydantic v2 #186

Merged
merged 12 commits into from
Jul 17, 2023
Merged

Pydantic v2 #186

merged 12 commits into from
Jul 17, 2023

Conversation

mat-sop
Copy link
Contributor

@mat-sop mat-sop commented Jul 14, 2023

This pr updates version of pydantic to ~2.0.

Changes in generated clients and models:

  • parse_obj -> model_validate
  • .dict() -> .model_dump()
  • Instead of Config class BaseModel uses model_config = ... attribute.
  • Refactored validator which handles parsing of custom scalars.
  • Upload is no longer dataclass, in v2 pydantic's .model_dump() changes dataclasses to dicts which is harder for client to detect files.
  • update_forward_refs -> model_rebuild
  • pydantic.json.pydantic_encoder -> pydantic_core.to_jsonable_python
  • Optional input fields now have explicit default None value (if schema doesn't specify another) Feature request: set default=None on optional input type fields #165

I see some potential to improve our implementation of custom scalars using some pydantic's v2 features, but this pr is already huge so it aims to sustain the same logic.

resolves #183 #165

@mat-sop mat-sop self-assigned this Jul 14, 2023
@mat-sop mat-sop linked an issue Jul 14, 2023 that may be closed by this pull request
@mat-sop mat-sop requested a review from rafalp July 14, 2023 14:35
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.

Feature request: Pydantic V2 Feature request: set default=None on optional input type fields
2 participants