Pydantic V2 uses $defs key in its schema. This adds support for the new key while still working with the old definitions key.
Credit to https://github.com/kkirsche/apispec-pydantic-plugin and I think their repo should be integrated with this repo as it provides a more up-to-date Pydantic plugin for APISpec. But while that happens, it would be great if this fix could go forward to make it possible for the package to be used with Pydantic V2.
Additionally, this also fixes the tests not running. Pydantic does not allow calling the schema on the BaseModel directly, only on subclasses.
Solves https://github.com/TestBoxLab/chalice-spec/issues/18
Pydantic V2 uses
$defs
key in its schema. This adds support for the new key while still working with the olddefinitions
key.Credit to https://github.com/kkirsche/apispec-pydantic-plugin and I think their repo should be integrated with this repo as it provides a more up-to-date Pydantic plugin for APISpec. But while that happens, it would be great if this fix could go forward to make it possible for the package to be used with Pydantic V2.
Additionally, this also fixes the tests not running. Pydantic does not allow calling the
schema
on theBaseModel
directly, only on subclasses.