Skip to content

Conversation

@Ali-Toosi
Copy link

@Ali-Toosi Ali-Toosi commented Sep 26, 2024

Solves #18

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.

Pydantic V2 uses `$defs` key in its schema.
Cannot call schema directly on BaseModel in Pydantic V2
Cannot call schema directly on BaseModel in Pydantic V2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant