You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pydantic throws an error on CommuncationDetails subclasses #19
There are a couple of things wrong. First of all, we need the discriminator in the generic ConnectionDetails object in the OpenAPI definition. Furthermore, there is an open PR to support the discriminator in the datamodel-code-gen tool (which is used by fast-api-codegen).
Activity
jorritn commentedon Nov 25, 2025
There are a couple of things wrong. First of all, we need the discriminator in the generic ConnectionDetails object in the OpenAPI definition. Furthermore, there is an open PR to support the discriminator in the datamodel-code-gen tool (which is used by fast-api-codegen).
jorritn commentedon Nov 25, 2025
Quick fix is changing the type of the communicationProtocol field of the CommuniationDetails class to:
jorritn commentedon Nov 25, 2025
I've added the discriminator to the openapi spec #22 Still need to generate the models again once the PR that fixes this in the datamodel generator datamodel-code-generator/datamodel-code-generator#2530
jorritn commentedon Feb 5, 2026
Is fixed in datamodel-code-generator version 0.37.0. We're using a recent version now.
jorritn commentedon Feb 5, 2026
After upgrading to datamodel-code-generator version 0.53.0 the validation error persists... So I've applied the quick fix again