-
Notifications
You must be signed in to change notification settings - Fork 3
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
Convert to use pydantic #70
Conversation
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #70 +/- ##
==========================================
- Coverage 88.55% 88.55% -0.01%
==========================================
Files 22 23 +1
Lines 1363 1328 -35
==========================================
- Hits 1207 1176 -31
+ Misses 156 152 -4 ☔ View full report in Codecov by Sentry. |
fc9c408
to
3e228d0
Compare
Here it is @gilesknap |
One thing that I don't like about this is that the I did quite a lot of searching and I think this is currently an unsolved problem in pydantic v2. It is quite a lot of extra work for the user to make sure the discriminator is included in the serialized output so that the code knows what specific type to instantiate when deserializing. Maybe there will be a better way in future. |
I also see this problem in ibek. It makes the yaml more verbose that necessary but is not an absolute disaster. |
I'm not sure I can do a meaningful review of this code without spending a week or so getting my head into it. I will instead, try out this version against ibek and see if the example usage that I have still works. Will try to get that done this afternoon 15 Jan. |
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.
I tried this out in an ioc-adsimdetector example. I noticed that ibek's call to the constructor of IndexEntry needed to have its positional arguments made into keyword.
I then verified that it ran OK and generated the same bob files as the previous version.
So I think it's good to go.
Fixes #65
Closes #9 as not needed