Hi Ivan,

Sure, openapi schema supports oneOf([1]) - but not all json clients so take
care.
Personally I would either propose you to merge the models in one or -
better - not use multiple shapes even if it is not required.
The main issue is that doing so you easily break you caller error handling.
Js guys will workaround it quickly but others can suffer from it.

[1]
https://github.com/eclipse/microprofile-open-api/blob/793faad902599e9900ac370ce3fbaf7d0bffa6a8/api/src/main/java/org/eclipse/microprofile/openapi/annotations/media/Schema.java#L65

Le ven. 8 janv. 2021 à 21:39, Cesar Hernandez <cesargu...@gmail.com> a
écrit :

> Hi Ivan,
>
> What I recall is that oneOf is not part of Swagger version 2. But I
> haven't try it yet with the maven plugin you mention.
>
> El vie, 8 ene 2021 a las 7:08, Ivan Junckes Filho (<ivanjunc...@gmail.com>)
> escribió:
>
>> Hello guys, I would like to know if there is a way with
>> geronimo-openapi-plugin to generate the documentation for different classes
>> in the same status code. I didn't tried different ways, but couldn't make
>> it work. Any advise on this? Is this supported?
>>
>> @APIResponse(
>>     name = "badRequest",
>>     responseCode = "400",
>>     description = "Error.",
>>     content = @Content(
>>         mediaType = APPLICATION_JSON,
>>         schema = @Schema(oneOf = {Error.class, AnotherError.class}))
>> )
>>
>>
>
> --
> Atentamente:
> César Hernández.
>

Reply via email to