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

Support inline oneOf discriminated properties #27

Merged
merged 3 commits into from
Jan 18, 2024
Merged

Conversation

glopesdev
Copy link
Member

Pydantic exported schemas do not commonly support allOf inheritance (see pydantic/pydantic#478) and regularly emit inline property schemas comprised of a discriminator with custom mappings and a oneOf constraint.

Following support for oneOf introduced in #23 this PR extends this support to inline discriminated schema properties by converting the original schema into an inheritance tree using allOf.

The main current limitation is for definitions participating in multiple distinct discriminated unions: in this case the first discriminator will be used as the root of the inheritance and no multiple inheritance is allowed.

Fixes #25

@glopesdev glopesdev added the feature New planned feature label Jan 18, 2024
@glopesdev glopesdev merged commit 2636c6e into main Jan 18, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New planned feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OneOf discriminated union fails to convert
1 participant