Skip to content
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

Add support for Pydantic V2 x OpenAPI 3 #22

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

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