openapi-codegen-ts
openapi-codegen-ts copied to clipboard
[CHK-1807] feat: allow object properties to be defined with `oneOf`
Description
- added checking for
oneOfwhen defining object properties
Motivation and Context
This PR implements defining object properties with oneOf.
Property definition with oneOf is permitted by the OpenAPI spec but currently fails with an error during generation (note that this is a different case from a separate schema defined with oneOf).
Note that this PR:
- does not add support for
discriminator(which has more requirements, for example it cannot be used with inline schemas). Code generation doesn't fail withdiscriminatorbut no schema checking is made and no special type information about the discriminator is propagated to the generated code. - does not add support for defining object properties with
allOforanyOf(should we add it in this PR or in another one? I don't like very much supportingoneOffor properties but not the others)
How Has This Been Tested?
Manual inspection of generated snapshots used for testing
Screenshots (if appropriate):
Types of changes
- [ ] Chore (improvement with no change in the behaviour)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
Checklist:
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.