Ivan is right. The default for MicroProfile is yaml. It would only be
json if the accept heard specifies json.  Here is the exact wording from
section 5.2

"The default format of the /openapi endpoint is YAML.

Vendors must also support the JSON format if the request contains an Accept
header with a value of application/json, in which case the response must
contain a Content-Type header with a value of application/json."

On Thu, Nov 29, 2018 at 11:03 AM Ivan Junckes Filho <ivanjunc...@gmail.com>
wrote:

> Hey Romain, take a look on:
>
>
> https://download.eclipse.org/microprofile/microprofile-open-api-1.0/microprofile-openapi-spec.html#_content_format
>
> It is clear for me there, that the default should be yaml.
>
> On Thu, Nov 29, 2018 at 2:58 PM Romain Manni-Bucau <rmannibu...@gmail.com>
> wrote:
>
> > Hello Ivan,
> >
> > this is actually not exactly the case, the impl is writer agnostic and
> > fully relies on JAXRS for that so if you have a body writer which matches
> > OpenAPI and returns yaml by default or
> > which prefer yaml over json then you will have the behavior you describe.
> >
> > To get yaml you can send the Accept header valued with yaml media type
> > like "text/yaml" for some implementations.
> >
> > Side note: the impl does not impose any body writer to be integrable in
> > any environment and does not enforce yaml as well cause it is not part of
> > the core of microprofile (and hopefully will never be) so no reason to
> > import a lib (which can be heavy and potentially with vulnerabilities +
> > work for the users to maintain it) for that.
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <https://rmannibucau.metawerx.net/> | Old Blog
> > <http://rmannibucau.wordpress.com> | Github
> > <https://github.com/rmannibucau> | LinkedIn
> > <https://www.linkedin.com/in/rmannibucau> | Book
> > <
> https://www.packtpub.com/application-development/java-ee-8-high-performance
> >
> >
> >
> > Le jeu. 29 nov. 2018 à 17:50, Ivan Junckes Filho <ivanjunc...@gmail.com>
> > a écrit :
> >
> >> Hey guys, I think I found a bug in OpenAPI implementation.
> >>
> >> The spec says:
> >> "The default format of the /openapi endpoint is YAML."
> >>
> >> But when I try to access /openapi it returns JSON by default.
> >>
> >> This is not correct.
> >>
> >> Also how can I access yaml if it is not default?
> >>
> >
>


-- 
Richard Monson-Haefel
https://twitter.com/rmonson
https://www.linkedin.com/in/monsonhaefel/

Reply via email to