-
Notifications
You must be signed in to change notification settings - Fork 1
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
Prepare for pydanticv2 #20
base: main
Are you sure you want to change the base?
Conversation
ruscoder
commented
Sep 6, 2024
•
edited
Loading
edited
- AnyResource is now Model with resourceType
- All Resource Models (like Patient) inherit AnyResource as the first parent class. BaseModel is the second one - it restricts "extra" to forbid
- BaseModel (that is used by all models) has a validator for all fields that transform AnyResource to the particular instance (with proper validation for lists)
- primitive types have suffix Type
There's a dirty hack with primitive types - I add Type and then remove Type for unions - it needs to be re-written in a better way. But I'm afraid it will require to change our meta models to add real type and aliased type |
I had to add a custom serializer and validator for BaseModel that we use for all resources to handle AnyResource validation/serialization. Also, there's a bit tight connection to the pydantic internals due to enumerating all fields for |