-
Notifications
You must be signed in to change notification settings - Fork 10
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
Allow dictionary representation of Dandiset
to have extra attributes
#218
Conversation
So that the extra attributes passed to constructing a `Dandiset` object will be included in its dictionary representation produced by `BaseModel.model_dump()`
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #218 +/- ##
==========================================
- Coverage 97.66% 91.99% -5.67%
==========================================
Files 18 18
Lines 1798 1799 +1
==========================================
- Hits 1756 1655 -101
- Misses 42 144 +102
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
could you please elaborate/point to what you mean since I find no model_construct in dandi-archive codebase and if there is some custom use like that I wonder if that is something we should aim to avoid. |
Here is the reason why this PR is needed. Before the deprecation of the |
The two deprecated methods in this line is the cause of the problem.
|
If the JSON Schema has changed, we need to bump the schema version. |
we would need to release again , so labeling accordingly |
The JSON schemata for `Dandiset` and `PublishedDandiset` now contain the additional key of "additionalProperties" with the value of "true"
Once #221 is merged to master. This PR should be ready for merge. |
@yarikoptic This one is ready to merge. |
ok, let's see where it would get us |
This PR allows the dictionary representation of
Dandiset
to have extra attributes.ATM, packages such as dandi-archive construct
Dandiset
objects usingDandiset.model_construct()
to allow extra attributes to be passed to the resultingDandiset
objects. While extra attributes can be passed to the resultingDandiset
objects this way, the dictionary representations of theseDandiset
objects will not contain the extra attributes unlessDandiset
is explicitly configured to allow extra attributes.dandi-archive requires extra attributes passed in constructing a
Dandiset
object to be present in the dictionary representation of the object. This change in this PR explicitly configuresDandiset
to allow extra attributes to meet this requirement, and meeting this requirement will eliminate some of the failures encountered in dandi/dandi-archive#1823.Please note, the change in this PR will modify the JSON schemata for
Dandiset
andPublishedDandiset
slightly. Both schemata will contain the additional key of"additionalProperties"
with the value oftrue
. Please consider increase the version number of the JSON schemas to 0.6.6.Note: This PR is a follow up to #203 to make a new version of dandi-schema with Pydantic 2.0 working for dandi-archive.