-
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
Update to supporting Pydantic V2 #203
Commits on Nov 4, 2023
-
Configuration menu - View commit details
-
Copy full SHA for a6f3288 - Browse repository at this point
Copy the full SHA a6f3288View commit details
Commits on Nov 14, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 4395ad4 - Browse repository at this point
Copy the full SHA 4395ad4View commit details -
Migrate to Pydantic 2.0 using bump-pydantic 0.7.0
Note: bump-pydantic is still in beta
Configuration menu - View commit details
-
Copy full SHA for 1decc23 - Browse repository at this point
Copy the full SHA 1decc23View commit details
Commits on Nov 17, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 14f742c - Browse repository at this point
Copy the full SHA 14f742cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3b4ecf3 - Browse repository at this point
Copy the full SHA 3b4ecf3View commit details
Commits on Nov 21, 2023
-
Remove
DandiBaseModel.json_dict
Replace its use with `pydantic.BaseModel.model_dump(mode='json', exclude_none=True)`
Configuration menu - View commit details
-
Copy full SHA for b211bfd - Browse repository at this point
Copy the full SHA b211bfdView commit details -
Remove
DandiBaseModel.unvalidated
Its use can be replaced with `pydantic.BaseModel.model_construct`
Configuration menu - View commit details
-
Copy full SHA for b697d76 - Browse repository at this point
Copy the full SHA b697d76View commit details
Commits on Nov 29, 2023
-
Configuration menu - View commit details
-
Copy full SHA for e0f75ce - Browse repository at this point
Copy the full SHA e0f75ceView commit details -
Configuration menu - View commit details
-
Copy full SHA for 92b5cb9 - Browse repository at this point
Copy the full SHA 92b5cb9View commit details
Commits on Nov 30, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 739db75 - Browse repository at this point
Copy the full SHA 739db75View commit details
Commits on Dec 1, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 5528c3d - Browse repository at this point
Copy the full SHA 5528c3dView commit details -
Replace the use of
BaseModel.json()
withBaseModel.model_dump_json()
Specifying the most compact separators to use in JSON serialization, `(",", ":")`, is no longer needed for they are the default separators to use for JSON serialization in Pydantic V2
Configuration menu - View commit details
-
Copy full SHA for ca3fff5 - Browse repository at this point
Copy the full SHA ca3fff5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1d85790 - Browse repository at this point
Copy the full SHA 1d85790View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5616209 - Browse repository at this point
Copy the full SHA 5616209View commit details
Commits on Dec 4, 2023
-
Configuration menu - View commit details
-
Copy full SHA for e1adfb1 - Browse repository at this point
Copy the full SHA e1adfb1View commit details -
Specify default of
None
forPropertyValue.value
This is the implicit default in Pydantic V1
Configuration menu - View commit details
-
Copy full SHA for 8c0e159 - Browse repository at this point
Copy the full SHA 8c0e159View commit details -
Configuration menu - View commit details
-
Copy full SHA for c21f918 - Browse repository at this point
Copy the full SHA c21f918View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3b5fa3a - Browse repository at this point
Copy the full SHA 3b5fa3aView commit details -
Configuration menu - View commit details
-
Copy full SHA for acef6e1 - Browse repository at this point
Copy the full SHA acef6e1View commit details -
Configuration menu - View commit details
-
Copy full SHA for c5b51bb - Browse repository at this point
Copy the full SHA c5b51bbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7fcb9be - Browse repository at this point
Copy the full SHA 7fcb9beView commit details -
Configuration menu - View commit details
-
Copy full SHA for b9604f5 - Browse repository at this point
Copy the full SHA b9604f5View commit details
Commits on Dec 5, 2023
-
Migrate the use of
BaseModel.schema
andBaseModel.schema_json
to ……`BaseModel.model_json_schema`
Configuration menu - View commit details
-
Copy full SHA for 14b0d16 - Browse repository at this point
Copy the full SHA 14b0d16View commit details
Commits on Dec 6, 2023
-
Configuration menu - View commit details
-
Copy full SHA for fe85089 - Browse repository at this point
Copy the full SHA fe85089View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1d8724f - Browse repository at this point
Copy the full SHA 1d8724fView commit details -
Correct typo in kwarg to
Field
`description` instead of `descriptions`
Configuration menu - View commit details
-
Copy full SHA for ba04133 - Browse repository at this point
Copy the full SHA ba04133View commit details -
Configuration menu - View commit details
-
Copy full SHA for 97bf307 - Browse repository at this point
Copy the full SHA 97bf307View commit details -
Replace use of
DandiBaseModel.unvalidated
with `BaseModel.model_con……struct` in tests
Configuration menu - View commit details
-
Copy full SHA for 5b2e6af - Browse repository at this point
Copy the full SHA 5b2e6afView commit details
Commits on Dec 8, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 6d95f7c - Browse repository at this point
Copy the full SHA 6d95f7cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9668104 - Browse repository at this point
Copy the full SHA 9668104View commit details -
Update signatures and usage for
post_process_json_schema
This commit modifies method signatures for `post_process_json_schema` by adding an additional parameter `model`. This parameter is also used in the method bodies to set the 'title' if it does not exist in the schema. These modifications are needed because Pydantic V2 doesn't provide the `title` in the JSON schema until the very end.
Configuration menu - View commit details
-
Copy full SHA for 57d9600 - Browse repository at this point
Copy the full SHA 57d9600View commit details -
Update Pydantic Metaclass import path
This commit changes the import path for Pydantic's ModelMetaclass. The old path, `pydantic.main.ModelMetaclass`, has been replaced by the new path, `pydantic._internal._model_construction.ModelMetaclass`.
Configuration menu - View commit details
-
Copy full SHA for 16be659 - Browse repository at this point
Copy the full SHA 16be659View commit details -
Update tests to match new schema path for definitions
The schema's definition path has changed, so this commit updates the testing assertions accordingly. The key "definitions" has been replaced with "$defs" in Pydantic V2
Configuration menu - View commit details
-
Copy full SHA for b6443ec - Browse repository at this point
Copy the full SHA b6443ecView commit details -
Update pydantic ModelMetaclass references in tests
The pydantic library's location for ModelMetaclass has changed, so the paths had to be updated in the tests.
Configuration menu - View commit details
-
Copy full SHA for 496d431 - Browse repository at this point
Copy the full SHA 496d431View commit details -
Configuration menu - View commit details
-
Copy full SHA for a976015 - Browse repository at this point
Copy the full SHA a976015View commit details -
Configuration menu - View commit details
-
Copy full SHA for 64522a6 - Browse repository at this point
Copy the full SHA 64522a6View commit details -
Configuration menu - View commit details
-
Copy full SHA for ecd98ed - Browse repository at this point
Copy the full SHA ecd98edView commit details -
Adapt to the
FieldInfo
the new class for representing a field in `g……enerate_context`
Configuration menu - View commit details
-
Copy full SHA for be176ab - Browse repository at this point
Copy the full SHA be176abView commit details -
Adapt to the
FieldInfo
the new class for representing a field in `t……est_duplicate_classes`
Configuration menu - View commit details
-
Copy full SHA for 6d945a9 - Browse repository at this point
Copy the full SHA 6d945a9View commit details -
Configuration menu - View commit details
-
Copy full SHA for fc423ae - Browse repository at this point
Copy the full SHA fc423aeView commit details -
Adapt to
FieldInfo
the new class for representing a field in `test_……properties_mismatch`
Configuration menu - View commit details
-
Copy full SHA for d251dc5 - Browse repository at this point
Copy the full SHA d251dc5View commit details -
Update dandischema/metadata.py
Get outer type using `type.get_origin()` instead of by stringifying. Co-authored-by: John T. Wodder II <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for db55273 - Browse repository at this point
Copy the full SHA db55273View commit details -
Update JSON serialization methods in zarr.py
The update modifies the JSON serialization methods used in the ZarrChecksumListing class. The code now uses `json.dumps` instead of previously used `BaseModel.model_dump_json()`. These changes ensure JSON serializations are done in the most compact manner by specifying the separators explicitly instead of depending on the default behavior of 'BaseModel.model_dump_json()'.
Configuration menu - View commit details
-
Copy full SHA for 439d07b - Browse repository at this point
Copy the full SHA 439d07bView commit details -
Configuration menu - View commit details
-
Copy full SHA for fc72189 - Browse repository at this point
Copy the full SHA fc72189View commit details -
Configuration menu - View commit details
-
Copy full SHA for ae9a09b - Browse repository at this point
Copy the full SHA ae9a09bView commit details -
Rename args in
ByteSizeJsonSchema.__get_pydantic_json_schema__()
The new names are more appropriate per the use of the arguments
Configuration menu - View commit details
-
Copy full SHA for 0b14166 - Browse repository at this point
Copy the full SHA 0b14166View commit details -
Replace logic for checking for Pydantic models in
models.py
Use `inspect.isclass` and `issubclass` instead of relying on internal metaclass
Configuration menu - View commit details
-
Copy full SHA for 7808f87 - Browse repository at this point
Copy the full SHA 7808f87View commit details -
Configuration menu - View commit details
-
Copy full SHA for e095ed7 - Browse repository at this point
Copy the full SHA e095ed7View commit details
Commits on Dec 9, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 50ee928 - Browse repository at this point
Copy the full SHA 50ee928View commit details
Commits on Dec 11, 2023
-
Use
BaseModel.__get_pydantic_json_schema__()
to modify JSON schema Use `BaseModel.__get_pydantic_json_schema__()` to modify JSON schema instead of `BaseModel.model_config["json_schema_extra"]`. This allows the automatically generated `title` attribute to be available for modification.
Configuration menu - View commit details
-
Copy full SHA for 82f802f - Browse repository at this point
Copy the full SHA 82f802fView commit details -
Add JSON schema to
Pydantic.ByteSize
through annotationAdding JSON schema to `Pydantic.ByteSize` through annotation instead of subclassing allows objects of type `Pydantic.ByteSize` to assign to a `ByteSizeJsonSchema` attribute without static type checker complain
Configuration menu - View commit details
-
Copy full SHA for ab462ec - Browse repository at this point
Copy the full SHA ab462ecView commit details -
Add JSON schema to
Pydantic.ByteSize
through annotationAdding JSON schema to `Pydantic.ByteSize` through annotation instead of subclassing allows objects of type `Pydantic.ByteSize` to assign to a `ByteSizeJsonSchema` attribute without static type checker complain
Configuration menu - View commit details
-
Copy full SHA for 0d38117 - Browse repository at this point
Copy the full SHA 0d38117View commit details
Commits on Dec 12, 2023
-
Implement
TransitionalGenerateJsonSchema
This subclass can be used to overrides the default JSON schema generation to match that of the behavior of Pydantic V1.
Configuration menu - View commit details
-
Copy full SHA for 2c9d9e3 - Browse repository at this point
Copy the full SHA 2c9d9e3View commit details -
Configuration menu - View commit details
-
Copy full SHA for ce49d6a - Browse repository at this point
Copy the full SHA ce49d6aView commit details -
Update the test so that it is adjusted to the error representation in Pydantic V2
Configuration menu - View commit details
-
Copy full SHA for 193b4a8 - Browse repository at this point
Copy the full SHA 193b4a8View commit details -
Update the test so that it is adjusted to the error representation in Pydantic V2
Configuration menu - View commit details
-
Copy full SHA for 545adb9 - Browse repository at this point
Copy the full SHA 545adb9View commit details -
Update the test so that it is adjusted to the error representation in Pydantic V2
Configuration menu - View commit details
-
Copy full SHA for 328cefa - Browse repository at this point
Copy the full SHA 328cefaView commit details -
Update `metadata.validate` so that it is adjusted to the error representation in Pydantic V2
Configuration menu - View commit details
-
Copy full SHA for 00f0e91 - Browse repository at this point
Copy the full SHA 00f0e91View commit details
Commits on Dec 13, 2023
-
Disable type check for unpacking dict as kwargs
Unpacking of a dict as kwargs doesn't play well with mypy. See the example below. ``` import json ENCODING_KWARGS = {"separators": (",", ":")} d = {"a": 1, "b": 2} content = json.dumps(d, **ENCODING_KWARGS) ```
Configuration menu - View commit details
-
Copy full SHA for a23c521 - Browse repository at this point
Copy the full SHA a23c521View commit details -
URL types in Pydantic V2 are no longer a subclass of `str`. For uses that expect a `str`, conversion to `str` is needed.
Configuration menu - View commit details
-
Copy full SHA for d508645 - Browse repository at this point
Copy the full SHA d508645View commit details -
Check for
field.json_schema_extra
being a dict`field.json_schema_extra` can be either `None` or a callable as well
Configuration menu - View commit details
-
Copy full SHA for e9579f3 - Browse repository at this point
Copy the full SHA e9579f3View commit details -
Cast
field.json_schema_extra["nskey"]
tostr
The values of `field.json_schema_extra` can be one of many types
Configuration menu - View commit details
-
Copy full SHA for 60c51ef - Browse repository at this point
Copy the full SHA 60c51efView commit details -
ignore[call-arg]
for callingBaseModel.model_construct()
`BaseModel.model_construct()` is purposely defined for use without conforming to requirements specified in the model.
Configuration menu - View commit details
-
Copy full SHA for 5733137 - Browse repository at this point
Copy the full SHA 5733137View commit details -
For `expected_errors` in `test_dantimeta_1`
Configuration menu - View commit details
-
Copy full SHA for bbee1dc - Browse repository at this point
Copy the full SHA bbee1dcView commit details -
Of `field.json_schema_extra` in `test_properties_mismatch()`
Configuration menu - View commit details
-
Copy full SHA for a0e043c - Browse repository at this point
Copy the full SHA a0e043cView commit details -
Remove unreachable code block in `test_duplicate_classes`. According to Satra, this block must be outdated.
Configuration menu - View commit details
-
Copy full SHA for 9676268 - Browse repository at this point
Copy the full SHA 9676268View commit details
Commits on Dec 14, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 1e5a224 - Browse repository at this point
Copy the full SHA 1e5a224View commit details -
Configuration menu - View commit details
-
Copy full SHA for 41f5efc - Browse repository at this point
Copy the full SHA 41f5efcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1a707e6 - Browse repository at this point
Copy the full SHA 1a707e6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2fcc005 - Browse repository at this point
Copy the full SHA 2fcc005View commit details
Commits on Dec 19, 2023
-
Revert marking of
@container
using stringificationThis solution is kept for now so that context generator can maintain the same behavior
Configuration menu - View commit details
-
Copy full SHA for 0c97b8e - Browse repository at this point
Copy the full SHA 0c97b8eView commit details
Commits on Dec 21, 2023
-
Configuration menu - View commit details
-
Copy full SHA for a104fb2 - Browse repository at this point
Copy the full SHA a104fb2View commit details
Commits on Jan 16, 2024
-
Boost dandi schema version to 0.7.0 (since exported jsonschema does h…
…ave incompatible changes)
Configuration menu - View commit details
-
Copy full SHA for bddffd8 - Browse repository at this point
Copy the full SHA bddffd8View commit details -
Configuration menu - View commit details
-
Copy full SHA for e36e003 - Browse repository at this point
Copy the full SHA e36e003View commit details -
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Configuration menu - View commit details
-
Copy full SHA for 54315ae - Browse repository at this point
Copy the full SHA 54315aeView commit details
Commits on Jan 18, 2024
-
Remove unneeded code in
TransitionalGenerateJsonSchema.nullable_schema
The logic of the result is equivalent to the one before the modification
Configuration menu - View commit details
-
Copy full SHA for 7eb7272 - Browse repository at this point
Copy the full SHA 7eb7272View commit details
Commits on Jan 19, 2024
-
Remove stub for migration to schema 0.7.0
There is no change in the data model because of the Pydantic upgrade to V2
Configuration menu - View commit details
-
Copy full SHA for 51d4c53 - Browse repository at this point
Copy the full SHA 51d4c53View commit details -
Use JSON Schema validator for Draft 2020-12 in
_validate_obj_json
For dandi JSON schema 0.7.0 or above
Configuration menu - View commit details
-
Copy full SHA for b718dc2 - Browse repository at this point
Copy the full SHA b718dc2View commit details -
Annotate two possible type of validator in
_validate_obj_json
So that mypy doesn't complain
Configuration menu - View commit details
-
Copy full SHA for 2e97166 - Browse repository at this point
Copy the full SHA 2e97166View commit details -
Change the current version of the generated schema to 0.6.5 instead
0.6.5 is more sensible since the changes in the schema are not breaking changes, and there is no change in the models and the JSON serialization of these models
Configuration menu - View commit details
-
Copy full SHA for 889c775 - Browse repository at this point
Copy the full SHA 889c775View commit details
Commits on Jan 22, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 2d48a09 - Browse repository at this point
Copy the full SHA 2d48a09View commit details