How to handle inheritance using oneOf? #138
Unanswered
davidjohnstonverint
asked this question in
Q&A
Replies: 1 comment
-
that is currently not supported. :-( I have an issue that goes into the same direction: openapi-processor/openapi-processor-core#78 but I didn't need it often enough to start implementing it and so far nobody asked for it. ;-) I will check how easy it is to implement. What you could do is to use a type mapping for |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We have a problem we are trying to solve by using the
oneOf
attribute in OpenAPI in order to allow for a flexible portion of the request body. My expectation when using this was that the generated code would have a base class then sub-classes for each of the oneOf references, but I can't seem to get this to work. Is this scenario supported by the library or is there another way of achieving the same result?An example of the OpenAPI spec is below:
My expectation would be the following classes:
What I actually get is SpecificPropertiesOne and SpecificPropertiesTwo are generated but not referenced anywhere, and GenericProperties is not generated at all. And anywhere that references GenericProperties (e.g. myProperties in the Foo class) is actually just given the type Object.
Beta Was this translation helpful? Give feedback.
All reactions