mike-oakley / openapi-pydantic

Pydantic OpenAPI schema implementation
Other
55 stars 9 forks source link

Pydantic 2 #16

Closed hathawsh closed 1 year ago

hathawsh commented 1 year ago

I ported the original project to Pydantic 2: https://github.com/kuimono/openapi-schema-pydantic/pull/33

My patch was quick and simple, allowing me to make progress with Pydantic 2. However, for the health of this project (openapi-pydantic), I think it would be better to figure out how to support both Pydantic 1 and 2 in a single code base. Do you agree? If so, I can get started. I'll take what I learned from my Pydantic 2 port and re-do the port with dual-version compatibility in mind.

mike-oakley commented 1 year ago

yeah definitely aligned with you here - i'm also keen for Pydantic 2 but we'd probably need to keep backwards compatibility with v1 to begin with - not sure what the best way to do that is without duplicating the whole codebase though 🤔 I saw they kept a v1 compatibility shim which would allow updating to v2 but still using v1 models, but not sure how helpful that would be

hathawsh commented 1 year ago

Unfortunately, the pydantic.v1 package appears to be just a copy of Pydantic version 1. I don't think I would use pydantic.v1 for anything.

I think I could write a small compatibility shim that would make this project compatible with both versions of Pydantic. I'll dig into it soon.