Peace::Swagger - OpenAPI definitions for the Peace API.
my $swagger = Peace::Swagger->new;
my $spec = $swagger->schema;
This module aims to help in the programmatic description of all API endpoints in a way that makes possible to reuse those schemas in the code and in the documentation.
Peace::Swagger implements the following instance methods:
my $swagger = Peace::Swagger->new;
Instances a Peace::Swagger.
Peace::Swagger implements the following methods:
my $schema = $swagger->schema;
Returns the complete openapi schema.
$swagger->validate_request(json => $json, spec => $spec);
Validates the spec for a specific endpoint say developer_post against the json got from the user and dies if the check is unsuccesful.
my $developer_schema = $swagger->developer;
Returns the schemas associated with the Peace::Model::Developer object.
my $developer_post = $swagger->developer_post
Returns the schema of the post request to the /developer enpoint.