NAME
Swagger::Schema - Object access to Swagger / OpenAPI schema files
SYNOPSIS
use
File::Slurp;
my
$data
= read_file(
$swagger_file
);
my
$schema
= Swagger::Schema->MooseX::DataModel::new_from_json(
$data
);
# use the object model
say
"This API consists of:"
;
foreach
my
$path
(
sort
keys
%{
$schema
->paths }){
foreach
my
$http_verb
(
sort
keys
%{
$schema
->paths->{
$path
} }) {
say
"$http_verb on $path"
;
}
}
DESCRIPTION
Get programmatic access to a Swagger / OpenAPI file (version 2).
If you're looking for OpenAPI 3 support, take a look at: Swagger::Schema::V3
OBJECT MODEL
The object model is defined with MooseX::DataModel. Take a look at the lib/Swagger/Schema.pm
file or the swagger spec https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md to know what you can find inside the objects
SEE ALSO
https://github.com/OAI/OpenAPI-Specification
AUTHOR
Jose Luis Martinez
CAPSiDE
jlmartinez
@capside
.com
THANKS
Andrew Solomon for contributions to the V3 Swagger code
BUGS and SOURCE
The source code is located here: https://github.com/pplu/swagger-schema-perl
Please report bugs to: https://github.com/pplu/swagger-schema-perl/issues
COPYRIGHT and LICENSE
Copyright (c) 2015 by CAPSiDE
This code is distributed under the Apache 2 License. The full text of the license can be found in the LICENSE file included with this module.