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

anyOf support #179

Open
Geksanit opened this issue Dec 28, 2023 · 2 comments · May be fixed by #181
Open

anyOf support #179

Geksanit opened this issue Dec 28, 2023 · 2 comments · May be fixed by #181

Comments

@Geksanit
Copy link
Contributor

I suggest adding support anyOf to codegen.
the difference between anyOf and oneOf is discussed here: https://stackoverflow.com/a/56039838

@kokovtsev
Copy link
Contributor

That SO answer might be incorrect about mixed element types in arrays.

It appears that the difference between oneOf/anyOf only affects the validation:

  • anyOf allows inputs that conform to multiple anyOf members;
  • oneOf requires that the input object matches exactly one union member. After a match is found, we should check that the input does not match any other options.

The generated type would be a union type in both cases.

In fact, we do not do this "exactly one" check, so our implementation of oneOf actually behaves like anyOf.

@kokovtsev
Copy link
Contributor

kokovtsev commented Jan 10, 2024

@Geksanit please review some work-in-progress in #181, if you're ok with the approach I will apply the same to OpenAPI 2.0 and AsyncAPI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants