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 for complex enums using OaSchema derive macro #8

Merged
merged 15 commits into from
Dec 3, 2023

Conversation

thorjelly
Copy link
Contributor

Allows the OaSchema derive macro to work with complex enums, AKA tagged unions, by using the openapi oneOf keyword. This supports all serde tag types; external, internal, adjacent, and untagged. This should support variants of all kinds, including newtype variants, struct variants, tuple variants, and unit variants.

Depends on PR #7

@kurtbuilds kurtbuilds changed the base branch from master to kw/thor-fork December 3, 2023 19:07
@kurtbuilds kurtbuilds changed the base branch from kw/thor-fork to master December 3, 2023 19:08
@kurtbuilds
Copy link
Owner

I had to make a few modifications with recent library changes, but all the tests are passing.

One note, is there's now an #[oasgen(inline)] configuration, which specifies whether the schema will be a $ref or will be inlined. I expanded the complex enum test to have inline and non-inline variants for all enum types (external, adjacent, internal, untagged).

@kurtbuilds kurtbuilds merged commit 87b616e into kurtbuilds:master Dec 3, 2023
1 check passed
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.

2 participants