Open Geksanit opened 11 months ago
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
.
@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
I suggest adding support
anyOf
to codegen. the difference betweenanyOf
andoneOf
is discussed here: https://stackoverflow.com/a/56039838