NAME

Peace::Swagger - OpenAPI definitions for the Peace API.

SYNOPSIS

my $swagger = Peace::Swagger->new;

my $spec = $swagger->schema;

DESCRIPTION

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.

INSTANCE METHODS

Peace::Swagger implements the following instance methods:

new

my $swagger = Peace::Swagger->new;

Instances a Peace::Swagger.

METHODS

Peace::Swagger implements the following methods:

schema

my $schema = $swagger->schema;

Returns the complete openapi schema.

validate_request

$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.

developer

my $developer_schema = $swagger->developer;

Returns the schemas associated with the Peace::Model::Developer object.

developer_post

my $developer_post = $swagger->developer_post

Returns the schema of the post request to the /developer enpoint.