Peace/doc/lib/Peace/Swagger.pm.html

91 lines
2.5 KiB
HTML

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Peace::Swagger - OpenAPI definitions for the Peace API.</title>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<link href="mailto:Alpine@build-edge-aarch64.nonet" rev="made" />
</head>
<body>
<ul id="index">
<li><a href="#NAME">NAME</a></li>
<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
<li><a href="#DESCRIPTION">DESCRIPTION</a></li>
<li><a href="#INSTANCE-METHODS">INSTANCE METHODS</a>
<ul>
<li><a href="#new">new</a></li>
</ul>
</li>
<li><a href="#METHODS">METHODS</a>
<ul>
<li><a href="#schema">schema</a></li>
<li><a href="#validate_request">validate_request</a></li>
<li><a href="#developer">developer</a></li>
<li><a href="#developer_post">developer_post</a></li>
</ul>
</li>
</ul>
<h1 id="NAME">NAME</h1>
<p>Peace::Swagger - OpenAPI definitions for the Peace API.</p>
<h1 id="SYNOPSIS">SYNOPSIS</h1>
<p>my $swagger = Peace::Swagger-&gt;new;</p>
<p>my $spec = $swagger-&gt;schema;</p>
<h1 id="DESCRIPTION">DESCRIPTION</h1>
<p>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.</p>
<h1 id="INSTANCE-METHODS">INSTANCE METHODS</h1>
<p>Peace::Swagger implements the following instance methods:</p>
<h2 id="new">new</h2>
<p>my $swagger = Peace::Swagger-&gt;new;</p>
<p>Instances a Peace::Swagger.</p>
<h1 id="METHODS">METHODS</h1>
<p>Peace::Swagger implements the following methods:</p>
<h2 id="schema">schema</h2>
<pre><code>my $schema = $swagger-&gt;schema;</code></pre>
<p>Returns the complete openapi schema.</p>
<h2 id="validate_request">validate_request</h2>
<pre><code>$swagger-&gt;validate_request(json =&gt; $json, spec =&gt; $spec);</code></pre>
<p>Validates the spec for a specific endpoint say developer_post against the json got from the user and dies if the check is unsuccesful.</p>
<h2 id="developer">developer</h2>
<pre><code>my $developer_schema = $swagger-&gt;developer;</code></pre>
<p>Returns the schemas associated with the <a href="Model/Developer.pm.html">Peace::Model::Developer</a> object.</p>
<h2 id="developer_post">developer_post</h2>
<pre><code>my $developer_post = $swagger-&gt;developer_post</code></pre>
<p>Returns the schema of the post request to the /developer enpoint.</p>
</body>
</html>