Open javac9 opened 1 month ago
You can create a shared model like OneOfBarBaz and $ref it under schema. Or you can use one of the mapping described in https://openapi-generator.tech/docs/customization/ Probably type-mappings or schema-mapppings (typeMappings/schemaMappings in the maven plugin) You might want to use the verbose option to know the name used internally
Is your feature request related to a problem? Please describe.
I'm using server-side JAXRS-SPEC generator (7.6.0)
Let's consider some example endpoint, involving a base class
Foo
with two childrenBar
andBaz
:Since the
GET
method might return an object either of typeBar
orBaz
, the generated return type namedGetFooDefaultResponse
contains all attributes of the parent and both (sub)type classes from which one can extract appropriate attributes for desired type.Now, for the
POST
method, therequestBody
is specified in a way that completely corresponds to thedefault response
of theGET
above, so it gets generated like this:I find this problematic for several reasons:
requestBody
(according to my current level of knowledge, the motivation behind this is to re-use the type already given within theGET
method?)POST
is namedCreateFooDefaultResponse
and is identical to theGetFooDefaultResponse
in structureDescribe the solution you'd like
A solution to the problem might be some of the following:
allOf
which should be a strong indication to the generator that they inherit fromFoo
cast
able/convertible between themselves (generate utility converter methods, or similar)Describe alternatives you've considered