Closed gorilla-seb closed 6 months ago
Hey @gorilla-seb - thanks for raising! I think this indeed would better be fixed in Pydantic itself - seems like there is some work already on this in https://github.com/pydantic/pydantic/issues/6304. Going to close this one out for now as that seems like the fix to wait for here 😃
When using generic models that override
model_generic_name
to generate a custom name for their generated concrete classes, the generated schema is invalid: the$ref
uses the custom name, but schema does not. Script to reproduce:Result:
This may be related to https://github.com/pydantic/pydantic/issues/7376 . I've added a quick and dirty workaround here: https://github.com/gorilla-seb/openapi-pydantic/commit/099cbbc7bc6d3e6687cac4b3c74f00961e02d65f