Fix Field deprecation warning resulting from building models with formatted strings #50
Reference in New Issue
Block a user
Delete Branch "string_format"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When building a data model using
SchemaConverter.build()from a JSON schema with a string field having a format this warning is generated:This is a result of the "format" keyword being passed to Pydantic's
Field(). This is a deprecated string constraint and no longer shown as possible in Pydantic's documentation.To resolve this issue, the format property can instead be passed using the
json_schema_extrakeyword - part of Pydantic's support for customising the JSON schema.The warning can be generated by either running the tests or using the following example code:
After this is PR is applied no other behaviour should change other than the warning is no longer generated.
This PR is a partial revert of
fbbff0b.Codecov Report
✅ All modified and coverable lines are covered by tests.
📢 Thoughts on this report? Let us know!
Thanks @fredsonnenwald, i swore that i solved that issue, i'll pull this branch locally to test it but this simple fix seems solid to merge!
Yeah... You were right i reverted the code by mistake, merging and releasing a post release for this