Package org.apache.juneau.rest.server.docs
@Rest(mixins=...) resources that publish Swagger v2
and OpenAPI 3.1 spec endpoints with Swagger-UI and Redoc HTML mounts.
Four sibling mixins compose into the host @Rest-annotated resource. Each mixin owns its
own URL prefix (or single endpoint) and is independently mountable; transitive resolution lets a
UI mixin pull in its corresponding spec mixin automatically.
SwaggerMixin— spec endpoint at/api, Swagger v2 + Swagger-UI swap.SwaggerUiMixin— HTML-first mount at/swagger, transitively pulls inSwaggerMixin.OpenApiMixin— spec endpoints at/openapi,/openapi.json, and/openapi.yaml; OpenAPI 3.1 + Redoc swap on the content-negotiated/openapimount.RedocMixin— HTML-first mount at/redoc, transitively pulls inOpenApiMixin.
Composition examples:
The two UI mixins (SwaggerUiMixin and
RedocMixin) declare @Rest(defaultAccept="text/html")
so that bare browser requests (no Accept header, or Accept: */*) render the
HTML view rather than the serializer-default media type. The two spec mixins use Juneau's standard
content negotiation unchanged.
The OpenAPI .json and .yaml variants are format-pinned — they ignore the
request Accept header and always return the file extension's wire format. This is
implemented by explicit serializer dispatch inside the mixin, not by content negotiation, so the
pin is robust against Accept: text/html or any other request media type.
See Also:
- Since:
- 10.0.0
-
ClassesClassDescriptionMixin that publishes the OpenAPI 3.1 spec endpoints for a resource.Mixin that publishes the Redoc HTML view at
/redocfor the OpenAPI 3.1 spec.Mixin that publishes the Swagger v2 spec endpoint at/api/*.Mixin that publishes the Swagger-UI HTML view at/swagger.