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
Migrate to Pydantic 2.x #408
Conversation
14be259
to
f50d82f
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #408 +/- ##
==========================================
- Coverage 72.88% 71.34% -1.54%
==========================================
Files 189 191 +2
Lines 9486 9588 +102
Branches 1576 1590 +14
==========================================
- Hits 6914 6841 -73
- Misses 2369 2541 +172
- Partials 203 206 +3 ☔ View full report in Codecov by Sentry. |
f50d82f
to
ba17d78
Compare
0931a99
to
a4aff80
Compare
8b18ea9
to
d5fc39c
Compare
test/unit_tests/fixtures/products/product_blocks/product_sub_block_two.py
Outdated
Show resolved
Hide resolved
test/unit_tests/fixtures/products/product_types/product_type_list_union.py
Outdated
Show resolved
Hide resolved
test/unit_tests/fixtures/products/product_types/product_type_list_union_overlap.py
Outdated
Show resolved
Hide resolved
Signed-off-by: Mark90 <mark_moes@live.nl>
a729cba
to
bf670a4
Compare
…et_properties - Instead of serializable_property use pydantic.computed_fields - Instead of DomainModel.get_properties() use pydantic's BaseModel.model_computed_fields
Needed to make pydantic 2.x serialize ipaddress types
b654104
to
989271a
Compare
from orchestrator.types import filter_nonetype, get_origin_and_args, is_union_type | ||
|
||
|
||
def _to_product_block_field_type_iterable(product_block_field_type: Union[type, Tuple[type]]) -> Iterable[type]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why marked as private function?
@@ -43,14 +43,15 @@ dependencies = [ | |||
"click==8.*", | |||
"deprecated", | |||
"deepmerge==0.1.0", | |||
"fastapi~=0.99.1", | |||
"fastapi~=0.103.2", | |||
"fastapi-etag==0.4.0", | |||
"more-itertools~=9.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can update to 10.1.0 without breaking anything
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets go!
Signed-off-by: Mark90 <mark_moes@live.nl>
Breaking changes
build_extendend_domain_model()
-> usebuild_extended_domain_model()
insteadSubscriptionInstanceList
-> use an annotated list instead (TODO link to migration guide)@serializable_property
-> use@computed_field
insteadDomainModel.get_properties
-> useBaseModel.model_computed_fields()
insteadDeprecations
VlanRanges
which is now in nwa-stdlibInternal changes
ModelMetaClass
base.py
Database.database_scope
to release the DB session in case of an errorTodo
pydantic.v1.EnumMemberError
andpydantic.v1.typing.is_union
closes #327