++ed by:
MHOWARD PAVELSR KEEDI POTATOGIM FVOX

18 PAUSE users
15 non-PAUSE users.

Jan Henning Thorsen
and 3 contributors

NAME

Mojolicious::Plugin::OpenAPI::SpecRenderer - Render OpenAPI specification

SYNOPSIS

  $app->plugin(OpenAPI => {
    plugins                        => [qw(+SpecRenderer)],
    render_specification           => 1,
    render_specification_for_paths => 1,
  });

DESCRIPTION

Mojolicious::Plugin::OpenAPI::SpecRenderer will enable Mojolicious::Plugin::OpenAPI to render the specification in both HTML and JSON format.

The human readable format focus on making the documentation printable, so you can easily share it with third parties as a PDF. If this documentation format is too basic or has missing information, then please report in suggestions for enhancements.

HELPERS

openapi.render_spec

  $c = $c->openapi->render_spec;
  $c = $c->openapi->render_spec($openapi_path);
  $c = $c->openapi->render_spec("/user/{id}");

Used to render the specification as either "html" or "json". Set the "stash" in Mojolicious variable "format" to change the format to render.

Will render the whole specification by default, but can also render documentation for a given OpenAPI path.

METHODS

register

  $doc->register($app, $openapi, \%config);

Adds the features mentioned in the "DESCRIPTION".

%config is the same as passed on to "register" in Mojolicious::Plugin::OpenAPI. The following keys are used by this plugin:

render_specification

Render the whole specification as either HTML or JSON from "/:basePath". Example if basePath in your specification is "/api":

  GET https://api.example.com/api.html
  GET https://api.example.com/api.json

Disable this feature by setting render_specification to 0.

render_specification_for_paths

Render the specification from individual routes, using the OPTIONS HTTP method. Example:

  OPTIONS https://api.example.com/api/some/path.json
  OPTIONS https://api.example.com/api/some/path.json?method=post

Disable this feature by setting render_specification_for_paths to 0.

SEE ALSO

Mojolicious::Plugin::OpenAPI