Updating security samples for Perl. (#5292)

This commit is contained in:
Paŭlo Ebermann
2017-04-04 08:40:58 +02:00
committed by wing328
parent f7b39a85a5
commit bebeac8ae8
20 changed files with 428 additions and 628 deletions

View File

@@ -1,57 +1,56 @@
# NAME # NAME
WWW::SwaggerClient::Role - a Moose role for the Swagger Petstore */ ' \" WWW::SwaggerClient::Role - a Moose role for the Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
# VERSION # VERSION
Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API version: 1.0.0 */ ' \" - API version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
- Package version: 1.0.0 - Package version: 1.0.0
- Build date: 2016-06-28T16:32:36.006+08:00 - Build package: io.swagger.codegen.languages.PerlClientCodegen
- Build package: class io.swagger.codegen.languages.PerlClientCodegen
## A note on Moose ## A note on Moose
This role is the only component of the library that uses Moose. See This role is the only component of the library that uses Moose. See
WWW::SwaggerClient::ApiFactory for non-Moosey usage. WWW::SwaggerClient::ApiFactory for non-Moosey usage.
# SYNOPSIS # SYNOPSIS
The Perl Swagger Codegen project builds a library of Perl modules to interact with The Perl Swagger Codegen project builds a library of Perl modules to interact with
a web service defined by a OpenAPI Specification. See below for how to build the a web service defined by a OpenAPI Specification. See below for how to build the
library. library.
This module provides an interface to the generated library. All the classes, This module provides an interface to the generated library. All the classes,
objects, and methods (well, not quite \*all\*, see below) are flattened into this objects, and methods (well, not quite \*all\*, see below) are flattened into this
role. role.
package MyApp; package MyApp;
use Moose; use Moose;
with 'WWW::SwaggerClient::Role'; with 'WWW::SwaggerClient::Role';
package main; package main;
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
my $pet = $api->get_pet_by_id(pet_id => $pet_id); my $pet = $api->get_pet_by_id(pet_id => $pet_id);
## Structure of the library ## Structure of the library
The library consists of a set of API classes, one for each endpoint. These APIs The library consists of a set of API classes, one for each endpoint. These APIs
implement the method calls available on each endpoint. implement the method calls available on each endpoint.
Additionally, there is a set of "object" classes, which represent the objects Additionally, there is a set of "object" classes, which represent the objects
returned by and sent to the methods on the endpoints. returned by and sent to the methods on the endpoints.
An API factory class is provided, which builds instances of each endpoint API. An API factory class is provided, which builds instances of each endpoint API.
This Moose role flattens all the methods from the endpoint APIs onto the consuming This Moose role flattens all the methods from the endpoint APIs onto the consuming
class. It also provides methods to retrieve the endpoint API objects, and the API class. It also provides methods to retrieve the endpoint API objects, and the API
factory object, should you need it. factory object, should you need it.
For documentation of all these methods, see AUTOMATIC DOCUMENTATION below. For documentation of all these methods, see AUTOMATIC DOCUMENTATION below.
@@ -64,33 +63,33 @@ required and where to put them. You just need to supply the tokens.
# basic # basic
username => $username, username => $username,
password => $password, password => $password,
# oauth # oauth
access_token => $oauth_token, access_token => $oauth_token,
# keys # keys
$some_key => { token => $token, $some_key => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
$another => { token => $token, $another => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
..., ...,
}; };
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
Note these are all optional, as are `prefix` and `in`, and depend on the API Note these are all optional, as are `prefix` and `in`, and depend on the API
you are accessing. Usually `prefix` and `in` will be determined by the code generator from you are accessing. Usually `prefix` and `in` will be determined by the code generator from
the spec and you will not need to set them at run time. If not, `in` will the spec and you will not need to set them at run time. If not, `in` will
default to 'head' and `prefix` to the empty string. default to 'head' and `prefix` to the empty string.
The tokens will be placed in the `WWW::SwaggerClient::Configuration` namespace The tokens will be placed in the `WWW::SwaggerClient::Configuration` namespace
as follows, but you don't need to know about this. as follows, but you don't need to know about this.
- `$WWW::SwaggerClient::Configuration::username` - `$WWW::SwaggerClient::Configuration::username`
@@ -121,22 +120,22 @@ as follows, but you don't need to know about this.
- `$WWW::SwaggerClient::Configuration::access_token` - `$WWW::SwaggerClient::Configuration::access_token`
String. The OAuth access token. String. The OAuth access token.
# METHODS # METHODS
## `base_url` ## `base_url`
The generated code has the `base_url` already set as a default value. This method The generated code has the `base_url` already set as a default value. This method
returns (and optionally sets, but only if the API client has not been returns (and optionally sets, but only if the API client has not been
created yet) the current value of `base_url`. created yet) the current value of `base_url`.
## `api_factory` ## `api_factory`
Returns an API factory object. You probably won't need to call this directly. Returns an API factory object. You probably won't need to call this directly.
$self->api_factory('Pet'); # returns a WWW::SwaggerClient::PetApi instance $self->api_factory('Pet'); # returns a WWW::SwaggerClient::PetApi instance
$self->pet_api; # the same $self->pet_api; # the same
# MISSING METHODS # MISSING METHODS
@@ -146,9 +145,9 @@ Most of the methods on the API are delegated to individual endpoint API objects
same method name (e.g. `new()`), these methods can't be delegated. So you need same method name (e.g. `new()`), these methods can't be delegated. So you need
to call `$api->pet_api->new()`. to call `$api->pet_api->new()`.
In principle, every API is susceptible to the presence of a few, random, undelegatable In principle, every API is susceptible to the presence of a few, random, undelegatable
method names. In practice, because of the way method names are constructed, it's method names. In practice, because of the way method names are constructed, it's
unlikely in general that any methods will be undelegatable, except for: unlikely in general that any methods will be undelegatable, except for:
new() new()
class_documentation() class_documentation()
@@ -161,12 +160,12 @@ you could also call them on class names.
# BUILDING YOUR LIBRARY # BUILDING YOUR LIBRARY
See the homepage `https://github.com/swagger-api/swagger-codegen` for full details. See the homepage `https://github.com/swagger-api/swagger-codegen` for full details.
But briefly, clone the git repository, build the codegen codebase, set up your build But briefly, clone the git repository, build the codegen codebase, set up your build
config file, then run the API build script. You will need git, Java 7 or 8 and Apache config file, then run the API build script. You will need git, Java 7 or 8 and Apache
maven 3.0.3 or better already installed. maven 3.0.3 or better already installed.
The config file should specify the project name for the generated library: The config file should specify the project name for the generated library:
{"moduleName":"WWW::MyProjectName"} {"moduleName":"WWW::MyProjectName"}
@@ -181,8 +180,8 @@ Your library files will be built under `WWW::MyProjectName`.
-c /path/to/config/file.json \ -c /path/to/config/file.json \
-o /path/to/output/folder -o /path/to/output/folder
Bang, all done. Run the `autodoc` script in the `bin` directory to see the API Bang, all done. Run the `autodoc` script in the `bin` directory to see the API
you just built. you just built.
# AUTOMATIC DOCUMENTATION # AUTOMATIC DOCUMENTATION
@@ -194,28 +193,28 @@ output formats are supported:
-w wide format (default) -w wide format (default)
-n narrow format -n narrow format
-p POD format -p POD format
-H HTML format -H HTML format
-m Markdown format -m Markdown format
-h print this help message -h print this help message
-c your application class -c your application class
The `-c` option allows you to load and inspect your own application. A dummy The `-c` option allows you to load and inspect your own application. A dummy
namespace is used if you don't supply your own class. namespace is used if you don't supply your own class.
# DOCUMENTATION FROM THE OpenAPI Spec # DOCUMENTATION FROM THE OpenAPI Spec
Additional documentation for each class and method may be provided by the Swagger Additional documentation for each class and method may be provided by the Swagger
spec. If so, this is available via the `class_documentation()` and spec. If so, this is available via the `class_documentation()` and
`method_documentation()` methods on each generated object class, and the `method_documentation()` methods on each generated object class, and the
`method_documentation()` method on the endpoint API classes: `method_documentation()` method on the endpoint API classes:
my $cmdoc = $api->pet_api->method_documentation->{$method_name};
my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation;
my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name};
my $cmdoc = $api->pet_api->method_documentation->{$method_name};
my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation;
my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name};
Each of these calls returns a hashref with various useful pieces of information. Each of these calls returns a hashref with various useful pieces of information.
@@ -248,38 +247,40 @@ use WWW::SwaggerClient::Object::ModelReturn;
# for displaying the API response data # for displaying the API response data
use Data::Dumper; use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::;
my $api_instance = WWW::SwaggerClient::FakeApi->new(); my $api_instance = WWW::SwaggerClient::FakeApi->new();
my $test code inject */ ' " =end = 'test code inject */ ' " =end_example'; # string | To test code injection */ ' \" my $test code inject */ ' " =end __ \r\n \n \r = 'test code inject */ ' " =end __ \r\n \n \r_example'; # string | To test code injection */ ' \" =_end -- \\r\\n \\n \\r
eval { eval {
$api_instance->test_code_inject____end(test code inject */ ' " =end => $test code inject */ ' " =end); $api_instance->test_code_inject____end__rn_n_r(test code inject */ ' " =end __ \r\n \n \r => $test code inject */ ' " =end __ \r\n \n \r);
}; };
if ($@) { if ($@) {
warn "Exception when calling FakeApi->test_code_inject____end: $@\n"; warn "Exception when calling FakeApi->test_code_inject____end__rn_n_r: $@\n";
} }
``` ```
# DOCUMENTATION FOR API ENDPOINTS # DOCUMENTATION FOR API ENDPOINTS
All URIs are relative to *https://petstore.swagger.io */ ' " =end/v2 */ ' " =end* All URIs are relative to *https://petstore.swagger.io */ ' \" =_end -- \\r\\n \\n \\r/v2 */ ' \" =_end -- \\r\\n \\n \\r*
Class | Method | HTTP request | Description Class | Method | HTTP request | Description
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
*FakeApi* | [**test_code_inject____end**](docs/FakeApi.md#test_code_inject____end) | **PUT** /fake | To test code injection */ ' \" *FakeApi* | [**test_code_inject____end__rn_n_r**](docs/FakeApi.md#test_code_inject____end__rn_n_r) | **PUT** /fake | To test code injection */ ' \" =_end -- \\r\\n \\n \\r
# DOCUMENTATION FOR MODELS # DOCUMENTATION FOR MODELS
- [WWW::SwaggerClient::Object::ModelReturn](docs/ModelReturn.md) - [WWW::SwaggerClient::Object::ModelReturn](docs/ModelReturn.md)
# DOCUMENTATION FOR AUTHORIATION # DOCUMENTATION FOR AUTHORIZATION
## api_key ## api_key
- **Type**: API key - **Type**: API key
- **API key parameter name**: api_key */ ' " =end - **API key parameter name**: api_key */ ' " =end -- \r\n \n \r
- **Location**: HTTP header - **Location**: HTTP header
## petstore_auth ## petstore_auth
@@ -288,8 +289,6 @@ Class | Method | HTTP request | Description
- **Flow**: implicit - **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**: - **Scopes**:
- **write:pets**: modify pets in your account */ ' " =end - **write:pets**: modify pets in your account */ ' \" =_end -- \\r\\n \\n \\r
- **read:pets**: read your pets */ ' " =end - **read:pets**: read your pets */ ' \" =_end -- \\r\\n \\n \\r

View File

@@ -1,57 +1,56 @@
# NAME # NAME
Something::Deep::Role - a Moose role for the Swagger Petstore */ ' \" Something::Deep::Role - a Moose role for the Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
# VERSION # VERSION
Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API version: 1.0.0 */ ' \" - API version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
- Package version: 1.0.0 - Package version: 1.0.0
- Build date: 2016-06-28T16:32:37.043+08:00 - Build package: io.swagger.codegen.languages.PerlClientCodegen
- Build package: class io.swagger.codegen.languages.PerlClientCodegen
## A note on Moose ## A note on Moose
This role is the only component of the library that uses Moose. See This role is the only component of the library that uses Moose. See
Something::Deep::ApiFactory for non-Moosey usage. Something::Deep::ApiFactory for non-Moosey usage.
# SYNOPSIS # SYNOPSIS
The Perl Swagger Codegen project builds a library of Perl modules to interact with The Perl Swagger Codegen project builds a library of Perl modules to interact with
a web service defined by a OpenAPI Specification. See below for how to build the a web service defined by a OpenAPI Specification. See below for how to build the
library. library.
This module provides an interface to the generated library. All the classes, This module provides an interface to the generated library. All the classes,
objects, and methods (well, not quite \*all\*, see below) are flattened into this objects, and methods (well, not quite \*all\*, see below) are flattened into this
role. role.
package MyApp; package MyApp;
use Moose; use Moose;
with 'Something::Deep::Role'; with 'Something::Deep::Role';
package main; package main;
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
my $pet = $api->get_pet_by_id(pet_id => $pet_id); my $pet = $api->get_pet_by_id(pet_id => $pet_id);
## Structure of the library ## Structure of the library
The library consists of a set of API classes, one for each endpoint. These APIs The library consists of a set of API classes, one for each endpoint. These APIs
implement the method calls available on each endpoint. implement the method calls available on each endpoint.
Additionally, there is a set of "object" classes, which represent the objects Additionally, there is a set of "object" classes, which represent the objects
returned by and sent to the methods on the endpoints. returned by and sent to the methods on the endpoints.
An API factory class is provided, which builds instances of each endpoint API. An API factory class is provided, which builds instances of each endpoint API.
This Moose role flattens all the methods from the endpoint APIs onto the consuming This Moose role flattens all the methods from the endpoint APIs onto the consuming
class. It also provides methods to retrieve the endpoint API objects, and the API class. It also provides methods to retrieve the endpoint API objects, and the API
factory object, should you need it. factory object, should you need it.
For documentation of all these methods, see AUTOMATIC DOCUMENTATION below. For documentation of all these methods, see AUTOMATIC DOCUMENTATION below.
@@ -64,33 +63,33 @@ required and where to put them. You just need to supply the tokens.
# basic # basic
username => $username, username => $username,
password => $password, password => $password,
# oauth # oauth
access_token => $oauth_token, access_token => $oauth_token,
# keys # keys
$some_key => { token => $token, $some_key => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
$another => { token => $token, $another => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
..., ...,
}; };
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
Note these are all optional, as are `prefix` and `in`, and depend on the API Note these are all optional, as are `prefix` and `in`, and depend on the API
you are accessing. Usually `prefix` and `in` will be determined by the code generator from you are accessing. Usually `prefix` and `in` will be determined by the code generator from
the spec and you will not need to set them at run time. If not, `in` will the spec and you will not need to set them at run time. If not, `in` will
default to 'head' and `prefix` to the empty string. default to 'head' and `prefix` to the empty string.
The tokens will be placed in the `Something::Deep::Configuration` namespace The tokens will be placed in the `Something::Deep::Configuration` namespace
as follows, but you don't need to know about this. as follows, but you don't need to know about this.
- `$Something::Deep::Configuration::username` - `$Something::Deep::Configuration::username`
@@ -121,22 +120,22 @@ as follows, but you don't need to know about this.
- `$Something::Deep::Configuration::access_token` - `$Something::Deep::Configuration::access_token`
String. The OAuth access token. String. The OAuth access token.
# METHODS # METHODS
## `base_url` ## `base_url`
The generated code has the `base_url` already set as a default value. This method The generated code has the `base_url` already set as a default value. This method
returns (and optionally sets, but only if the API client has not been returns (and optionally sets, but only if the API client has not been
created yet) the current value of `base_url`. created yet) the current value of `base_url`.
## `api_factory` ## `api_factory`
Returns an API factory object. You probably won't need to call this directly. Returns an API factory object. You probably won't need to call this directly.
$self->api_factory('Pet'); # returns a Something::Deep::PetApi instance $self->api_factory('Pet'); # returns a Something::Deep::PetApi instance
$self->pet_api; # the same $self->pet_api; # the same
# MISSING METHODS # MISSING METHODS
@@ -146,9 +145,9 @@ Most of the methods on the API are delegated to individual endpoint API objects
same method name (e.g. `new()`), these methods can't be delegated. So you need same method name (e.g. `new()`), these methods can't be delegated. So you need
to call `$api->pet_api->new()`. to call `$api->pet_api->new()`.
In principle, every API is susceptible to the presence of a few, random, undelegatable In principle, every API is susceptible to the presence of a few, random, undelegatable
method names. In practice, because of the way method names are constructed, it's method names. In practice, because of the way method names are constructed, it's
unlikely in general that any methods will be undelegatable, except for: unlikely in general that any methods will be undelegatable, except for:
new() new()
class_documentation() class_documentation()
@@ -161,12 +160,12 @@ you could also call them on class names.
# BUILDING YOUR LIBRARY # BUILDING YOUR LIBRARY
See the homepage `https://github.com/swagger-api/swagger-codegen` for full details. See the homepage `https://github.com/swagger-api/swagger-codegen` for full details.
But briefly, clone the git repository, build the codegen codebase, set up your build But briefly, clone the git repository, build the codegen codebase, set up your build
config file, then run the API build script. You will need git, Java 7 or 8 and Apache config file, then run the API build script. You will need git, Java 7 or 8 and Apache
maven 3.0.3 or better already installed. maven 3.0.3 or better already installed.
The config file should specify the project name for the generated library: The config file should specify the project name for the generated library:
{"moduleName":"WWW::MyProjectName"} {"moduleName":"WWW::MyProjectName"}
@@ -181,8 +180,8 @@ Your library files will be built under `WWW::MyProjectName`.
-c /path/to/config/file.json \ -c /path/to/config/file.json \
-o /path/to/output/folder -o /path/to/output/folder
Bang, all done. Run the `autodoc` script in the `bin` directory to see the API Bang, all done. Run the `autodoc` script in the `bin` directory to see the API
you just built. you just built.
# AUTOMATIC DOCUMENTATION # AUTOMATIC DOCUMENTATION
@@ -194,28 +193,28 @@ output formats are supported:
-w wide format (default) -w wide format (default)
-n narrow format -n narrow format
-p POD format -p POD format
-H HTML format -H HTML format
-m Markdown format -m Markdown format
-h print this help message -h print this help message
-c your application class -c your application class
The `-c` option allows you to load and inspect your own application. A dummy The `-c` option allows you to load and inspect your own application. A dummy
namespace is used if you don't supply your own class. namespace is used if you don't supply your own class.
# DOCUMENTATION FROM THE OpenAPI Spec # DOCUMENTATION FROM THE OpenAPI Spec
Additional documentation for each class and method may be provided by the Swagger Additional documentation for each class and method may be provided by the Swagger
spec. If so, this is available via the `class_documentation()` and spec. If so, this is available via the `class_documentation()` and
`method_documentation()` methods on each generated object class, and the `method_documentation()` methods on each generated object class, and the
`method_documentation()` method on the endpoint API classes: `method_documentation()` method on the endpoint API classes:
my $cmdoc = $api->pet_api->method_documentation->{$method_name};
my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation;
my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name};
my $cmdoc = $api->pet_api->method_documentation->{$method_name};
my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation;
my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name};
Each of these calls returns a hashref with various useful pieces of information. Each of these calls returns a hashref with various useful pieces of information.
@@ -248,38 +247,40 @@ use Something::Deep::Object::ModelReturn;
# for displaying the API response data # for displaying the API response data
use Data::Dumper; use Data::Dumper;
use Something::Deep::Configuration;
use Something::Deep::;
my $api_instance = Something::Deep::FakeApi->new(); my $api_instance = Something::Deep::FakeApi->new();
my $test code inject */ ' " =end = 'test code inject */ ' " =end_example'; # string | To test code injection */ ' \" my $test code inject */ ' " =end __ \r\n \n \r = 'test code inject */ ' " =end __ \r\n \n \r_example'; # string | To test code injection */ ' \" =_end -- \\r\\n \\n \\r
eval { eval {
$api_instance->test_code_inject____end(test code inject */ ' " =end => $test code inject */ ' " =end); $api_instance->test_code_inject____end__rn_n_r(test code inject */ ' " =end __ \r\n \n \r => $test code inject */ ' " =end __ \r\n \n \r);
}; };
if ($@) { if ($@) {
warn "Exception when calling FakeApi->test_code_inject____end: $@\n"; warn "Exception when calling FakeApi->test_code_inject____end__rn_n_r: $@\n";
} }
``` ```
# DOCUMENTATION FOR API ENDPOINTS # DOCUMENTATION FOR API ENDPOINTS
All URIs are relative to *https://petstore.swagger.io */ ' " =end/v2 */ ' " =end* All URIs are relative to *https://petstore.swagger.io */ ' \" =_end -- \\r\\n \\n \\r/v2 */ ' \" =_end -- \\r\\n \\n \\r*
Class | Method | HTTP request | Description Class | Method | HTTP request | Description
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
*FakeApi* | [**test_code_inject____end**](docs/FakeApi.md#test_code_inject____end) | **PUT** /fake | To test code injection */ ' \" *FakeApi* | [**test_code_inject____end__rn_n_r**](docs/FakeApi.md#test_code_inject____end__rn_n_r) | **PUT** /fake | To test code injection */ ' \" =_end -- \\r\\n \\n \\r
# DOCUMENTATION FOR MODELS # DOCUMENTATION FOR MODELS
- [Something::Deep::Object::ModelReturn](docs/ModelReturn.md) - [Something::Deep::Object::ModelReturn](docs/ModelReturn.md)
# DOCUMENTATION FOR AUTHORIATION # DOCUMENTATION FOR AUTHORIZATION
## api_key ## api_key
- **Type**: API key - **Type**: API key
- **API key parameter name**: api_key */ ' " =end - **API key parameter name**: api_key */ ' " =end -- \r\n \n \r
- **Location**: HTTP header - **Location**: HTTP header
## petstore_auth ## petstore_auth
@@ -288,8 +289,6 @@ Class | Method | HTTP request | Description
- **Flow**: implicit - **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**: - **Scopes**:
- **write:pets**: modify pets in your account */ ' " =end - **write:pets**: modify pets in your account */ ' \" =_end -- \\r\\n \\n \\r
- **read:pets**: read your pets */ ' " =end - **read:pets**: read your pets */ ' \" =_end -- \\r\\n \\n \\r

View File

@@ -5,30 +5,32 @@
use Something::Deep::Object::FakeApi; use Something::Deep::Object::FakeApi;
``` ```
All URIs are relative to *https://petstore.swagger.io */ ' " =end/v2 */ ' " =end* All URIs are relative to *https://petstore.swagger.io */ ' \" =_end -- \\r\\n \\n \\r/v2 */ ' \" =_end -- \\r\\n \\n \\r*
Method | HTTP request | Description Method | HTTP request | Description
------------- | ------------- | ------------- ------------- | ------------- | -------------
[**test_code_inject____end**](FakeApi.md#test_code_inject____end) | **PUT** /fake | To test code injection */ ' \" [**test_code_inject____end__rn_n_r**](FakeApi.md#test_code_inject____end__rn_n_r) | **PUT** /fake | To test code injection */ ' \" =_end -- \\r\\n \\n \\r
# **test_code_inject____end** # **test_code_inject____end__rn_n_r**
> test_code_inject____end(test code inject */ ' " =end => $test code inject */ ' " =end) > test_code_inject____end__rn_n_r(test code inject */ ' " =end __ \r\n \n \r => $test code inject */ ' " =end __ \r\n \n \r)
To test code injection */ ' \" To test code injection */ ' \" =_end -- \\r\\n \\n \\r
### Example ### Example
```perl ```perl
use Data::Dumper; use Data::Dumper;
use Something::Deep::Configuration;
use Something::Deep::FakeApi;
my $api_instance = Something::Deep::FakeApi->new(); my $api_instance = Something::Deep::FakeApi->new();
my $test code inject */ ' " =end = 'test code inject */ ' " =end_example'; # string | To test code injection */ ' \" my $test code inject */ ' " =end __ \r\n \n \r = 'test code inject */ ' " =end __ \r\n \n \r_example'; # string | To test code injection */ ' \" =_end -- \\r\\n \\n \\r
eval { eval {
$api_instance->test_code_inject____end(test code inject */ ' " =end => $test code inject */ ' " =end); $api_instance->test_code_inject____end__rn_n_r(test code inject */ ' " =end __ \r\n \n \r => $test code inject */ ' " =end __ \r\n \n \r);
}; };
if ($@) { if ($@) {
warn "Exception when calling FakeApi->test_code_inject____end: $@\n"; warn "Exception when calling FakeApi->test_code_inject____end__rn_n_r: $@\n";
} }
``` ```
@@ -36,7 +38,7 @@ if ($@) {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**test code inject */ ' " =end** | **string**| To test code injection */ ' \" | [optional] **test code inject */ ' " =end __ \r\n \n \r** | **string**| To test code injection */ ' \" =_end -- \\r\\n \\n \\r | [optional]
### Return type ### Return type
@@ -48,8 +50,8 @@ No authorization required
### HTTP request headers ### HTTP request headers
- **Content-Type**: application/json, */ " =end - **Content-Type**: application/json, */ \" =_end --
- **Accept**: application/json, */ " =end - **Accept**: application/json, */ \" =_end --
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@@ -8,7 +8,7 @@ use Something::Deep::Object::ModelReturn;
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**return** | **int** | property description */ ' \" | [optional] **return** | **int** | property description */ ' \" =_end -- \\r\\n \\n \\r | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
OpenAPI spec version: 1.0.0 */ ' \" OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end comment =end comment
=cut =cut
@@ -58,7 +46,7 @@ sub _new_instance
my $class = shift; my $class = shift;
my (%args) = ( my (%args) = (
'ua' => LWP::UserAgent->new, 'ua' => LWP::UserAgent->new,
'base_url' => 'https://petstore.swagger.io */ ' " =end/v2 */ ' " =end', 'base_url' => 'https://petstore.swagger.io */ ' \" =_end -- \\r\\n \\n \\r/v2 */ ' \" =_end -- \\r\\n \\n \\r',
@_ @_
); );
@@ -352,9 +340,9 @@ sub update_params_for_auth {
} }
elsif ($auth eq 'api_key') { elsif ($auth eq 'api_key') {
my $api_key = $self->get_api_key_with_prefix('api_key */ ' " =end'); my $api_key = $self->get_api_key_with_prefix('api_key */ ' " =end -- \r\n \n \r');
if ($api_key) { if ($api_key) {
$header_params->{'api_key */ ' " =end'} = $api_key; $header_params->{'api_key */ ' " =end -- \r\n \n \r'} = $api_key;
} }
} }
elsif ($auth eq 'petstore_auth') { elsif ($auth eq 'petstore_auth') {

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
OpenAPI spec version: 1.0.0 */ ' \" OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end comment =end comment
=cut =cut

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
OpenAPI spec version: 1.0.0 */ ' \" OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end comment =end comment
=cut =cut
@@ -42,7 +30,7 @@ use constant VERSION => '1.0.0';
# class/static variables # class/static variables
our $http_timeout = 180; our $http_timeout = 180;
our $http_user_agent = 'Perl-Swagger'; our $http_user_agent = 'Swagger-Codegen/1.0.0/perl';
# authentication setting # authentication setting
our $api_key = {}; our $api_key = {};

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
OpenAPI spec version: 1.0.0 */ ' \" OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end comment =end comment
=cut =cut
@@ -64,33 +52,32 @@ sub new {
# #
# test_code_inject____end # test_code_inject____end__rn_n_r
# #
# To test code injection */ ' \" # To test code injection */ ' \" =_end -- \\r\\n \\n \\r
# #
# @param string $test code inject */ ' " =end To test code injection */ ' \" (optional) # @param string $test code inject */ ' " =end __ \r\n \n \r To test code injection */ ' \" =_end -- \\r\\n \\n \\r (optional)
{ {
my $params = { my $params = {
'test code inject */ ' " =end' => { 'test code inject */ ' " =end __ \r\n \n \r' => {
data_type => 'string', data_type => 'string',
description => 'To test code injection */ ' \" ', description => 'To test code injection */ ' \" =_end -- \\r\\n \\n \\r',
required => '0', required => '0',
}, },
}; };
__PACKAGE__->method_documentation->{ 'test_code_inject____end' } = { __PACKAGE__->method_documentation->{ 'test_code_inject____end__rn_n_r' } = {
summary => 'To test code injection */ ' \" ', summary => 'To test code injection */ ' \" =_end -- \\r\\n \\n \\r',
params => $params, params => $params,
returns => undef, returns => undef,
}; };
} }
# @return void # @return void
# #
sub test_code_inject____end { sub test_code_inject____end__rn_n_r {
my ($self, %args) = @_; my ($self, %args) = @_;
# parse inputs # parse inputs
my $_resource_path = '/fake'; my $_resource_path = '/fake';
$_resource_path =~ s/{format}/json/; # default format to json
my $_method = 'PUT'; my $_method = 'PUT';
my $query_params = {}; my $query_params = {};
@@ -98,15 +85,15 @@ sub test_code_inject____end {
my $form_params = {}; my $form_params = {};
# 'Accept' and 'Content-Type' header # 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/json', '*/ " =end'); my $_header_accept = $self->{api_client}->select_header_accept('application/json', '*/ \" =_end -- ');
if ($_header_accept) { if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept; $header_params->{'Accept'} = $_header_accept;
} }
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json', '*/ " =end'); $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json', '*/ \" =_end -- ');
# form params # form params
if ( exists $args{'test code inject */ ' " =end'} ) { if ( exists $args{'test code inject */ ' " =end __ \r\n \n \r'} ) {
$form_params->{'test code inject */ ' " =end'} = $self->{api_client}->to_form_value($args{'test code inject */ ' " =end'}); $form_params->{'test code inject */ ' " =end -- \r\n \n \r'} = $self->{api_client}->to_form_value($args{'test code inject */ ' " =end __ \r\n \n \r'});
} }
my $_body_data; my $_body_data;

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
OpenAPI spec version: 1.0.0 */ ' \" OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end comment =end comment
=cut =cut
@@ -46,7 +34,7 @@ use base ("Class::Accessor", "Class::Data::Inheritable");
# #
#Model for testing reserved words */ ' \" #Model for testing reserved words */ ' \" =_end -- \\r\\n \\n \\r
# #
# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. # NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
# REF: https://github.com/swagger-api/swagger-codegen # REF: https://github.com/swagger-api/swagger-codegen
@@ -54,26 +42,14 @@ use base ("Class::Accessor", "Class::Data::Inheritable");
=begin comment =begin comment
Swagger Petstore */ ' \" Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
OpenAPI spec version: 1.0.0 */ ' \" OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end comment =end comment
=cut =cut
@@ -160,7 +136,7 @@ sub _deserialize {
__PACKAGE__->class_documentation({description => 'Model for testing reserved words */ ' \" ', __PACKAGE__->class_documentation({description => 'Model for testing reserved words */ ' \" =_end -- \\r\\n \\n \\r',
class => 'ModelReturn', class => 'ModelReturn',
required => [], # TODO required => [], # TODO
} ); } );
@@ -169,7 +145,7 @@ __PACKAGE__->method_documentation({
'return' => { 'return' => {
datatype => 'int', datatype => 'int',
base_name => 'return', base_name => 'return',
description => 'property description */ ' \" ', description => 'property description */ ' \" =_end -- \\r\\n \\n \\r',
format => '', format => '',
read_only => '', read_only => '',
}, },

View File

@@ -1,31 +1,19 @@
=begin comment =begin comment
Swagger Petstore */ ' \" Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
OpenAPI spec version: 1.0.0 */ ' \" OpenAPI spec version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end comment =end comment
=cut =cut
# #
# NOTE: This class is auto generated by the swagger code generator program. # NOTE: This class is auto generated by the swagger code generator program.
# Do not edit the class manually. # Do not edit the class manually.
# Ref: https://github.com/swagger-api/swagger-codegen # Ref: https://github.com/swagger-api/swagger-codegen
# #
@@ -46,7 +34,7 @@ has base_url => ( is => 'ro',
has api_factory => ( is => 'ro', has api_factory => ( is => 'ro',
isa => 'Something::Deep::ApiFactory', isa => 'Something::Deep::ApiFactory',
builder => '_build_af', builder => '_build_af',
lazy => 1, lazy => 1,
documentation => 'Builds an instance of the endpoint API class', documentation => 'Builds an instance of the endpoint API class',
); );
@@ -63,49 +51,48 @@ has _cfg => ( is => 'ro',
default => 'Something::Deep::Configuration', default => 'Something::Deep::Configuration',
); );
has version_info => ( is => 'ro', has version_info => ( is => 'ro',
isa => 'HashRef', isa => 'HashRef',
default => sub { { default => sub { {
app_name => 'Swagger Petstore */ ' \" ', app_name => 'Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r',
app_version => '1.0.0 */ ' \" ', app_version => '1.0.0 */ ' \" =_end -- \\r\\n \\n \\r',
generated_date => '2016-06-28T16:32:37.043+08:00', generator_class => 'io.swagger.codegen.languages.PerlClientCodegen',
generator_class => 'class io.swagger.codegen.languages.PerlClientCodegen',
} }, } },
documentation => 'Information about the application version and the codegen codebase version' documentation => 'Information about the application version and the codegen codebase version'
); );
sub BUILD { sub BUILD {
my $self = shift; my $self = shift;
$self->_cfg->accept_tokens( $self->tokens ) if keys %{$self->tokens}; $self->_cfg->accept_tokens( $self->tokens ) if keys %{$self->tokens};
# ignore these symbols imported into API namespaces # ignore these symbols imported into API namespaces
my %outsiders = map {$_ => 1} qw( croak ); my %outsiders = map {$_ => 1} qw( croak );
my %delegates; my %delegates;
# collect the methods callable on each API # collect the methods callable on each API
foreach my $api_name ($self->api_factory->apis_available) { foreach my $api_name ($self->api_factory->apis_available) {
my $api_class = $self->api_factory->classname_for($api_name); my $api_class = $self->api_factory->classname_for($api_name);
my $methods = Class::Inspector->methods($api_class, 'expanded'); # not Moose, so use CI instead my $methods = Class::Inspector->methods($api_class, 'expanded'); # not Moose, so use CI instead
my @local_methods = grep {! /^_/} grep {! $outsiders{$_}} map {$_->[2]} grep {$_->[1] eq $api_class} @$methods; my @local_methods = grep {! /^_/} grep {! $outsiders{$_}} map {$_->[2]} grep {$_->[1] eq $api_class} @$methods;
push( @{$delegates{$_}}, {api_name => $api_name, api_class => $api_class} ) for @local_methods; push( @{$delegates{$_}}, {api_name => $api_name, api_class => $api_class} ) for @local_methods;
} }
# remove clashes # remove clashes
foreach my $method (keys %delegates) { foreach my $method (keys %delegates) {
if ( @{$delegates{$method}} > 1 ) { if ( @{$delegates{$method}} > 1 ) {
my ($apis) = delete $delegates{$method}; my ($apis) = delete $delegates{$method};
} }
} }
# build the flattened API # build the flattened API
foreach my $api_name ($self->api_factory->apis_available) { foreach my $api_name ($self->api_factory->apis_available) {
my $att_name = sprintf "%s_api", lc($api_name); my $att_name = sprintf "%s_api", lc($api_name);
my $api_class = $self->api_factory->classname_for($api_name); my $api_class = $self->api_factory->classname_for($api_name);
my @delegated = grep { $delegates{$_}->[0]->{api_name} eq $api_name } keys %delegates; my @delegated = grep { $delegates{$_}->[0]->{api_name} eq $api_name } keys %delegates;
$log->debugf("Adding API: '%s' handles %s", $att_name, join ', ', @delegated); $log->debugf("Adding API: '%s' handles %s", $att_name, join ', ', @delegated);
$self->meta->add_attribute( $att_name => ( $self->meta->add_attribute( $att_name => (
is => 'ro', is => 'ro',
isa => $api_class, isa => $api_class,
default => sub {$self->api_factory->get_api($api_name)}, default => sub {$self->api_factory->get_api($api_name)},
@@ -124,62 +111,59 @@ sub _build_af {
=head1 NAME =head1 NAME
Something::Deep::Role - a Moose role for the Swagger Petstore */ ' \" Something::Deep::Role - a Moose role for the Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
=head2 Swagger Petstore */ ' \" version: 1.0.0 */ ' \" =head2 Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r version: 1.0.0 */ ' \" =_end -- \\r\\n \\n \\r
=head1 VERSION =head1 VERSION
Automatically generated by the Perl Swagger Codegen project: Automatically generated by the Perl Swagger Codegen project:
=over 4 =over 4
=item Build package: io.swagger.codegen.languages.PerlClientCodegen
=item Build date: 2016-06-28T16:32:37.043+08:00 =item Codegen version:
=item Build package: class io.swagger.codegen.languages.PerlClientCodegen
=item Codegen version:
=back =back
=head2 A note on Moose =head2 A note on Moose
This role is the only component of the library that uses Moose. See This role is the only component of the library that uses Moose. See
Something::Deep::ApiFactory for non-Moosey usage. Something::Deep::ApiFactory for non-Moosey usage.
=head1 SYNOPSIS =head1 SYNOPSIS
The Perl Swagger Codegen project builds a library of Perl modules to interact with The Perl Swagger Codegen project builds a library of Perl modules to interact with
a web service defined by a OpenAPI Specification. See below for how to build the a web service defined by a OpenAPI Specification. See below for how to build the
library. library.
This module provides an interface to the generated library. All the classes, This module provides an interface to the generated library. All the classes,
objects, and methods (well, not quite *all*, see below) are flattened into this objects, and methods (well, not quite *all*, see below) are flattened into this
role. role.
package MyApp; package MyApp;
use Moose; use Moose;
with 'Something::Deep::Role'; with 'Something::Deep::Role';
package main; package main;
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
my $pet = $api->get_pet_by_id(pet_id => $pet_id); my $pet = $api->get_pet_by_id(pet_id => $pet_id);
=head2 Structure of the library =head2 Structure of the library
The library consists of a set of API classes, one for each endpoint. These APIs The library consists of a set of API classes, one for each endpoint. These APIs
implement the method calls available on each endpoint. implement the method calls available on each endpoint.
Additionally, there is a set of "object" classes, which represent the objects Additionally, there is a set of "object" classes, which represent the objects
returned by and sent to the methods on the endpoints. returned by and sent to the methods on the endpoints.
An API factory class is provided, which builds instances of each endpoint API. An API factory class is provided, which builds instances of each endpoint API.
This Moose role flattens all the methods from the endpoint APIs onto the consuming This Moose role flattens all the methods from the endpoint APIs onto the consuming
class. It also provides methods to retrieve the endpoint API objects, and the API class. It also provides methods to retrieve the endpoint API objects, and the API
factory object, should you need it. factory object, should you need it.
For documentation of all these methods, see AUTOMATIC DOCUMENTATION below. For documentation of all these methods, see AUTOMATIC DOCUMENTATION below.
@@ -192,33 +176,33 @@ required and where to put them. You just need to supply the tokens.
# basic # basic
username => $username, username => $username,
password => $password, password => $password,
# oauth # oauth
access_token => $oauth_token, access_token => $oauth_token,
# keys # keys
$some_key => { token => $token, $some_key => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
$another => { token => $token, $another => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
..., ...,
}; };
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
Note these are all optional, as are C<prefix> and C<in>, and depend on the API Note these are all optional, as are C<prefix> and C<in>, and depend on the API
you are accessing. Usually C<prefix> and C<in> will be determined by the code generator from you are accessing. Usually C<prefix> and C<in> will be determined by the code generator from
the spec and you will not need to set them at run time. If not, C<in> will the spec and you will not need to set them at run time. If not, C<in> will
default to 'head' and C<prefix> to the empty string. default to 'head' and C<prefix> to the empty string.
The tokens will be placed in the C<Something::Deep::Configuration> namespace The tokens will be placed in the C<Something::Deep::Configuration> namespace
as follows, but you don't need to know about this. as follows, but you don't need to know about this.
=over 4 =over 4
@@ -251,7 +235,7 @@ all api keys require a prefix.
=item C<$Something::Deep::Configuration::access_token> =item C<$Something::Deep::Configuration::access_token>
String. The OAuth access token. String. The OAuth access token.
=back =back
@@ -259,16 +243,16 @@ String. The OAuth access token.
=head2 C<base_url> =head2 C<base_url>
The generated code has the C<base_url> already set as a default value. This method The generated code has the C<base_url> already set as a default value. This method
returns (and optionally sets, but only if the API client has not been returns (and optionally sets, but only if the API client has not been
created yet) the current value of C<base_url>. created yet) the current value of C<base_url>.
=head2 C<api_factory> =head2 C<api_factory>
Returns an API factory object. You probably won't need to call this directly. Returns an API factory object. You probably won't need to call this directly.
$self->api_factory('Pet'); # returns a Something::Deep::PetApi instance $self->api_factory('Pet'); # returns a Something::Deep::PetApi instance
$self->pet_api; # the same $self->pet_api; # the same
=head1 MISSING METHODS =head1 MISSING METHODS
@@ -278,9 +262,9 @@ Most of the methods on the API are delegated to individual endpoint API objects
same method name (e.g. C<new()>), these methods can't be delegated. So you need same method name (e.g. C<new()>), these methods can't be delegated. So you need
to call C<$api-E<gt>pet_api-E<gt>new()>. to call C<$api-E<gt>pet_api-E<gt>new()>.
In principle, every API is susceptible to the presence of a few, random, undelegatable In principle, every API is susceptible to the presence of a few, random, undelegatable
method names. In practice, because of the way method names are constructed, it's method names. In practice, because of the way method names are constructed, it's
unlikely in general that any methods will be undelegatable, except for: unlikely in general that any methods will be undelegatable, except for:
new() new()
class_documentation() class_documentation()
@@ -293,12 +277,12 @@ you could also call them on class names.
=head1 BUILDING YOUR LIBRARY =head1 BUILDING YOUR LIBRARY
See the homepage C<https://github.com/swagger-api/swagger-codegen> for full details. See the homepage C<https://github.com/swagger-api/swagger-codegen> for full details.
But briefly, clone the git repository, build the codegen codebase, set up your build But briefly, clone the git repository, build the codegen codebase, set up your build
config file, then run the API build script. You will need git, Java 7 or 8 and Apache config file, then run the API build script. You will need git, Java 7 or 8 and Apache
maven 3.0.3 or better already installed. maven 3.0.3 or better already installed.
The config file should specify the project name for the generated library: The config file should specify the project name for the generated library:
{"moduleName":"WWW::MyProjectName"} {"moduleName":"WWW::MyProjectName"}
@@ -313,8 +297,8 @@ Your library files will be built under C<WWW::MyProjectName>.
-c /path/to/config/file.json \ -c /path/to/config/file.json \
-o /path/to/output/folder -o /path/to/output/folder
Bang, all done. Run the C<autodoc> script in the C<bin> directory to see the API Bang, all done. Run the C<autodoc> script in the C<bin> directory to see the API
you just built. you just built.
=head1 AUTOMATIC DOCUMENTATION =head1 AUTOMATIC DOCUMENTATION
@@ -326,28 +310,28 @@ output formats are supported:
-w wide format (default) -w wide format (default)
-n narrow format -n narrow format
-p POD format -p POD format
-H HTML format -H HTML format
-m Markdown format -m Markdown format
-h print this help message -h print this help message
-c your application class -c your application class
The C<-c> option allows you to load and inspect your own application. A dummy The C<-c> option allows you to load and inspect your own application. A dummy
namespace is used if you don't supply your own class. namespace is used if you don't supply your own class.
=head1 DOCUMENTATION FROM THE OpenAPI Spec =head1 DOCUMENTATION FROM THE OpenAPI Spec
Additional documentation for each class and method may be provided by the Swagger Additional documentation for each class and method may be provided by the Swagger
spec. If so, this is available via the C<class_documentation()> and spec. If so, this is available via the C<class_documentation()> and
C<method_documentation()> methods on each generated object class, and the C<method_documentation()> methods on each generated object class, and the
C<method_documentation()> method on the endpoint API classes: C<method_documentation()> method on the endpoint API classes:
my $cmdoc = $api->pet_api->method_documentation->{$method_name}; my $cmdoc = $api->pet_api->method_documentation->{$method_name};
my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation; my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation;
my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name}; my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name};
Each of these calls returns a hashref with various useful pieces of information. Each of these calls returns a hashref with various useful pieces of information.
=cut =cut

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
OpenAPI spec version: 1.0.0 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end comment =end comment
=cut =cut

View File

@@ -5,30 +5,32 @@
use WWW::SwaggerClient::Object::FakeApi; use WWW::SwaggerClient::Object::FakeApi;
``` ```
All URIs are relative to *https://petstore.swagger.io */ &#39; &quot; &#x3D;end/v2 */ &#39; &quot; &#x3D;end* All URIs are relative to *https://petstore.swagger.io */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r/v2 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r*
Method | HTTP request | Description Method | HTTP request | Description
------------- | ------------- | ------------- ------------- | ------------- | -------------
[**test_code_inject____end**](FakeApi.md#test_code_inject____end) | **PUT** /fake | To test code injection */ &#39; \&quot; [**test_code_inject____end__rn_n_r**](FakeApi.md#test_code_inject____end__rn_n_r) | **PUT** /fake | To test code injection */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
# **test_code_inject____end** # **test_code_inject____end__rn_n_r**
> test_code_inject____end(test code inject */ &#39; &quot; &#x3D;end => $test code inject */ &#39; &quot; &#x3D;end) > test_code_inject____end__rn_n_r(test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r => $test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r)
To test code injection */ ' \" To test code injection */ ' \" =_end -- \\r\\n \\n \\r
### Example ### Example
```perl ```perl
use Data::Dumper; use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::FakeApi;
my $api_instance = WWW::SwaggerClient::FakeApi->new(); my $api_instance = WWW::SwaggerClient::FakeApi->new();
my $test code inject */ &#39; &quot; &#x3D;end = 'test code inject */ ' " =end_example'; # string | To test code injection */ ' \" my $test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r = 'test code inject */ ' " =end __ \r\n \n \r_example'; # string | To test code injection */ ' \" =_end -- \\r\\n \\n \\r
eval { eval {
$api_instance->test_code_inject____end(test code inject */ &#39; &quot; &#x3D;end => $test code inject */ &#39; &quot; &#x3D;end); $api_instance->test_code_inject____end__rn_n_r(test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r => $test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r);
}; };
if ($@) { if ($@) {
warn "Exception when calling FakeApi->test_code_inject____end: $@\n"; warn "Exception when calling FakeApi->test_code_inject____end__rn_n_r: $@\n";
} }
``` ```
@@ -36,7 +38,7 @@ if ($@) {
Name | Type | Description | Notes Name | Type | Description | Notes
------------- | ------------- | ------------- | ------------- ------------- | ------------- | ------------- | -------------
**test code inject */ &#39; &quot; &#x3D;end** | **string**| To test code injection */ &#39; \&quot; | [optional] **test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r** | **string**| To test code injection */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r | [optional]
### Return type ### Return type
@@ -48,8 +50,8 @@ No authorization required
### HTTP request headers ### HTTP request headers
- **Content-Type**: application/json, */ " =end - **Content-Type**: application/json, */ \" =_end --
- **Accept**: application/json, */ " =end - **Accept**: application/json, */ \" =_end --
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@@ -8,7 +8,7 @@ use WWW::SwaggerClient::Object::ModelReturn;
## Properties ## Properties
Name | Type | Description | Notes Name | Type | Description | Notes
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
**return** | **int** | property description */ &#39; \&quot; | [optional] **return** | **int** | property description */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
OpenAPI spec version: 1.0.0 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end comment =end comment
=cut =cut
@@ -58,7 +46,7 @@ sub _new_instance
my $class = shift; my $class = shift;
my (%args) = ( my (%args) = (
'ua' => LWP::UserAgent->new, 'ua' => LWP::UserAgent->new,
'base_url' => 'https://petstore.swagger.io */ &#39; &quot; &#x3D;end/v2 */ &#39; &quot; &#x3D;end', 'base_url' => 'https://petstore.swagger.io */ ' \" =_end -- \\r\\n \\n \\r/v2 */ ' \" =_end -- \\r\\n \\n \\r',
@_ @_
); );
@@ -352,9 +340,9 @@ sub update_params_for_auth {
} }
elsif ($auth eq 'api_key') { elsif ($auth eq 'api_key') {
my $api_key = $self->get_api_key_with_prefix('api_key */ &#39; &quot; &#x3D;end'); my $api_key = $self->get_api_key_with_prefix('api_key */ &#39; &quot; &#x3D;end -- \r\n \n \r');
if ($api_key) { if ($api_key) {
$header_params->{'api_key */ &#39; &quot; &#x3D;end'} = $api_key; $header_params->{'api_key */ &#39; &quot; &#x3D;end -- \r\n \n \r'} = $api_key;
} }
} }
elsif ($auth eq 'petstore_auth') { elsif ($auth eq 'petstore_auth') {

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
OpenAPI spec version: 1.0.0 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end comment =end comment
=cut =cut

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
OpenAPI spec version: 1.0.0 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end comment =end comment
=cut =cut
@@ -42,7 +30,7 @@ use constant VERSION => '1.0.0';
# class/static variables # class/static variables
our $http_timeout = 180; our $http_timeout = 180;
our $http_user_agent = 'Perl-Swagger'; our $http_user_agent = 'Swagger-Codegen/1.0.0/perl';
# authentication setting # authentication setting
our $api_key = {}; our $api_key = {};

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
OpenAPI spec version: 1.0.0 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end comment =end comment
=cut =cut
@@ -64,33 +52,32 @@ sub new {
# #
# test_code_inject____end # test_code_inject____end__rn_n_r
# #
# To test code injection */ ' \" # To test code injection */ ' \" =_end -- \\r\\n \\n \\r
# #
# @param string $test code inject */ &#39; &quot; &#x3D;end To test code injection */ &#39; \&quot; (optional) # @param string $test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r To test code injection */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r (optional)
{ {
my $params = { my $params = {
'test code inject */ &#39; &quot; &#x3D;end' => { 'test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r' => {
data_type => 'string', data_type => 'string',
description => 'To test code injection */ &#39; \&quot; ', description => 'To test code injection */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r',
required => '0', required => '0',
}, },
}; };
__PACKAGE__->method_documentation->{ 'test_code_inject____end' } = { __PACKAGE__->method_documentation->{ 'test_code_inject____end__rn_n_r' } = {
summary => 'To test code injection */ &#39; \&quot; ', summary => 'To test code injection */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r',
params => $params, params => $params,
returns => undef, returns => undef,
}; };
} }
# @return void # @return void
# #
sub test_code_inject____end { sub test_code_inject____end__rn_n_r {
my ($self, %args) = @_; my ($self, %args) = @_;
# parse inputs # parse inputs
my $_resource_path = '/fake'; my $_resource_path = '/fake';
$_resource_path =~ s/{format}/json/; # default format to json
my $_method = 'PUT'; my $_method = 'PUT';
my $query_params = {}; my $query_params = {};
@@ -98,15 +85,15 @@ sub test_code_inject____end {
my $form_params = {}; my $form_params = {};
# 'Accept' and 'Content-Type' header # 'Accept' and 'Content-Type' header
my $_header_accept = $self->{api_client}->select_header_accept('application/json', '*/ " =end'); my $_header_accept = $self->{api_client}->select_header_accept('application/json', '*/ \" =_end -- ');
if ($_header_accept) { if ($_header_accept) {
$header_params->{'Accept'} = $_header_accept; $header_params->{'Accept'} = $_header_accept;
} }
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json', '*/ " =end'); $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json', '*/ \" =_end -- ');
# form params # form params
if ( exists $args{'test code inject */ &#39; &quot; &#x3D;end'} ) { if ( exists $args{'test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r'} ) {
$form_params->{'test code inject */ &#39; &quot; &#x3D;end'} = $self->{api_client}->to_form_value($args{'test code inject */ &#39; &quot; &#x3D;end'}); $form_params->{'test code inject */ &#39; &quot; &#x3D;end -- \r\n \n \r'} = $self->{api_client}->to_form_value($args{'test code inject */ &#39; &quot; &#x3D;end __ \r\n \n \r'});
} }
my $_body_data; my $_body_data;

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
OpenAPI spec version: 1.0.0 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end comment =end comment
=cut =cut
@@ -46,7 +34,7 @@ use base ("Class::Accessor", "Class::Data::Inheritable");
# #
#Model for testing reserved words */ &#39; \&quot; #Model for testing reserved words */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
# #
# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. # NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
# REF: https://github.com/swagger-api/swagger-codegen # REF: https://github.com/swagger-api/swagger-codegen
@@ -54,26 +42,14 @@ use base ("Class::Accessor", "Class::Data::Inheritable");
=begin comment =begin comment
Swagger Petstore */ ' \" Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
OpenAPI spec version: 1.0.0 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end comment =end comment
=cut =cut
@@ -160,7 +136,7 @@ sub _deserialize {
__PACKAGE__->class_documentation({description => 'Model for testing reserved words */ &#39; \&quot; ', __PACKAGE__->class_documentation({description => 'Model for testing reserved words */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r',
class => 'ModelReturn', class => 'ModelReturn',
required => [], # TODO required => [], # TODO
} ); } );
@@ -169,7 +145,7 @@ __PACKAGE__->method_documentation({
'return' => { 'return' => {
datatype => 'int', datatype => 'int',
base_name => 'return', base_name => 'return',
description => 'property description */ &#39; \&quot; ', description => 'property description */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r',
format => '', format => '',
read_only => '', read_only => '',
}, },

View File

@@ -1,31 +1,19 @@
=begin comment =begin comment
Swagger Petstore */ ' \" Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
OpenAPI spec version: 1.0.0 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end comment =end comment
=cut =cut
# #
# NOTE: This class is auto generated by the swagger code generator program. # NOTE: This class is auto generated by the swagger code generator program.
# Do not edit the class manually. # Do not edit the class manually.
# Ref: https://github.com/swagger-api/swagger-codegen # Ref: https://github.com/swagger-api/swagger-codegen
# #
@@ -46,7 +34,7 @@ has base_url => ( is => 'ro',
has api_factory => ( is => 'ro', has api_factory => ( is => 'ro',
isa => 'WWW::SwaggerClient::ApiFactory', isa => 'WWW::SwaggerClient::ApiFactory',
builder => '_build_af', builder => '_build_af',
lazy => 1, lazy => 1,
documentation => 'Builds an instance of the endpoint API class', documentation => 'Builds an instance of the endpoint API class',
); );
@@ -63,49 +51,48 @@ has _cfg => ( is => 'ro',
default => 'WWW::SwaggerClient::Configuration', default => 'WWW::SwaggerClient::Configuration',
); );
has version_info => ( is => 'ro', has version_info => ( is => 'ro',
isa => 'HashRef', isa => 'HashRef',
default => sub { { default => sub { {
app_name => 'Swagger Petstore */ &#39; \&quot; ', app_name => 'Swagger Petstore */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r',
app_version => '1.0.0 */ &#39; \&quot; ', app_version => '1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r',
generated_date => '2016-06-28T16:32:36.006+08:00', generator_class => 'io.swagger.codegen.languages.PerlClientCodegen',
generator_class => 'class io.swagger.codegen.languages.PerlClientCodegen',
} }, } },
documentation => 'Information about the application version and the codegen codebase version' documentation => 'Information about the application version and the codegen codebase version'
); );
sub BUILD { sub BUILD {
my $self = shift; my $self = shift;
$self->_cfg->accept_tokens( $self->tokens ) if keys %{$self->tokens}; $self->_cfg->accept_tokens( $self->tokens ) if keys %{$self->tokens};
# ignore these symbols imported into API namespaces # ignore these symbols imported into API namespaces
my %outsiders = map {$_ => 1} qw( croak ); my %outsiders = map {$_ => 1} qw( croak );
my %delegates; my %delegates;
# collect the methods callable on each API # collect the methods callable on each API
foreach my $api_name ($self->api_factory->apis_available) { foreach my $api_name ($self->api_factory->apis_available) {
my $api_class = $self->api_factory->classname_for($api_name); my $api_class = $self->api_factory->classname_for($api_name);
my $methods = Class::Inspector->methods($api_class, 'expanded'); # not Moose, so use CI instead my $methods = Class::Inspector->methods($api_class, 'expanded'); # not Moose, so use CI instead
my @local_methods = grep {! /^_/} grep {! $outsiders{$_}} map {$_->[2]} grep {$_->[1] eq $api_class} @$methods; my @local_methods = grep {! /^_/} grep {! $outsiders{$_}} map {$_->[2]} grep {$_->[1] eq $api_class} @$methods;
push( @{$delegates{$_}}, {api_name => $api_name, api_class => $api_class} ) for @local_methods; push( @{$delegates{$_}}, {api_name => $api_name, api_class => $api_class} ) for @local_methods;
} }
# remove clashes # remove clashes
foreach my $method (keys %delegates) { foreach my $method (keys %delegates) {
if ( @{$delegates{$method}} > 1 ) { if ( @{$delegates{$method}} > 1 ) {
my ($apis) = delete $delegates{$method}; my ($apis) = delete $delegates{$method};
} }
} }
# build the flattened API # build the flattened API
foreach my $api_name ($self->api_factory->apis_available) { foreach my $api_name ($self->api_factory->apis_available) {
my $att_name = sprintf "%s_api", lc($api_name); my $att_name = sprintf "%s_api", lc($api_name);
my $api_class = $self->api_factory->classname_for($api_name); my $api_class = $self->api_factory->classname_for($api_name);
my @delegated = grep { $delegates{$_}->[0]->{api_name} eq $api_name } keys %delegates; my @delegated = grep { $delegates{$_}->[0]->{api_name} eq $api_name } keys %delegates;
$log->debugf("Adding API: '%s' handles %s", $att_name, join ', ', @delegated); $log->debugf("Adding API: '%s' handles %s", $att_name, join ', ', @delegated);
$self->meta->add_attribute( $att_name => ( $self->meta->add_attribute( $att_name => (
is => 'ro', is => 'ro',
isa => $api_class, isa => $api_class,
default => sub {$self->api_factory->get_api($api_name)}, default => sub {$self->api_factory->get_api($api_name)},
@@ -124,62 +111,59 @@ sub _build_af {
=head1 NAME =head1 NAME
WWW::SwaggerClient::Role - a Moose role for the Swagger Petstore */ &#39; \&quot; WWW::SwaggerClient::Role - a Moose role for the Swagger Petstore */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
=head2 Swagger Petstore */ &#39; \&quot; version: 1.0.0 */ &#39; \&quot; =head2 Swagger Petstore */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
=head1 VERSION =head1 VERSION
Automatically generated by the Perl Swagger Codegen project: Automatically generated by the Perl Swagger Codegen project:
=over 4 =over 4
=item Build package: io.swagger.codegen.languages.PerlClientCodegen
=item Build date: 2016-06-28T16:32:36.006+08:00 =item Codegen version:
=item Build package: class io.swagger.codegen.languages.PerlClientCodegen
=item Codegen version:
=back =back
=head2 A note on Moose =head2 A note on Moose
This role is the only component of the library that uses Moose. See This role is the only component of the library that uses Moose. See
WWW::SwaggerClient::ApiFactory for non-Moosey usage. WWW::SwaggerClient::ApiFactory for non-Moosey usage.
=head1 SYNOPSIS =head1 SYNOPSIS
The Perl Swagger Codegen project builds a library of Perl modules to interact with The Perl Swagger Codegen project builds a library of Perl modules to interact with
a web service defined by a OpenAPI Specification. See below for how to build the a web service defined by a OpenAPI Specification. See below for how to build the
library. library.
This module provides an interface to the generated library. All the classes, This module provides an interface to the generated library. All the classes,
objects, and methods (well, not quite *all*, see below) are flattened into this objects, and methods (well, not quite *all*, see below) are flattened into this
role. role.
package MyApp; package MyApp;
use Moose; use Moose;
with 'WWW::SwaggerClient::Role'; with 'WWW::SwaggerClient::Role';
package main; package main;
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
my $pet = $api->get_pet_by_id(pet_id => $pet_id); my $pet = $api->get_pet_by_id(pet_id => $pet_id);
=head2 Structure of the library =head2 Structure of the library
The library consists of a set of API classes, one for each endpoint. These APIs The library consists of a set of API classes, one for each endpoint. These APIs
implement the method calls available on each endpoint. implement the method calls available on each endpoint.
Additionally, there is a set of "object" classes, which represent the objects Additionally, there is a set of "object" classes, which represent the objects
returned by and sent to the methods on the endpoints. returned by and sent to the methods on the endpoints.
An API factory class is provided, which builds instances of each endpoint API. An API factory class is provided, which builds instances of each endpoint API.
This Moose role flattens all the methods from the endpoint APIs onto the consuming This Moose role flattens all the methods from the endpoint APIs onto the consuming
class. It also provides methods to retrieve the endpoint API objects, and the API class. It also provides methods to retrieve the endpoint API objects, and the API
factory object, should you need it. factory object, should you need it.
For documentation of all these methods, see AUTOMATIC DOCUMENTATION below. For documentation of all these methods, see AUTOMATIC DOCUMENTATION below.
@@ -192,33 +176,33 @@ required and where to put them. You just need to supply the tokens.
# basic # basic
username => $username, username => $username,
password => $password, password => $password,
# oauth # oauth
access_token => $oauth_token, access_token => $oauth_token,
# keys # keys
$some_key => { token => $token, $some_key => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
$another => { token => $token, $another => { token => $token,
prefix => $prefix, prefix => $prefix,
in => $in, # 'head||query', in => $in, # 'head||query',
}, },
..., ...,
}; };
my $api = MyApp->new({ tokens => $tokens }); my $api = MyApp->new({ tokens => $tokens });
Note these are all optional, as are C<prefix> and C<in>, and depend on the API Note these are all optional, as are C<prefix> and C<in>, and depend on the API
you are accessing. Usually C<prefix> and C<in> will be determined by the code generator from you are accessing. Usually C<prefix> and C<in> will be determined by the code generator from
the spec and you will not need to set them at run time. If not, C<in> will the spec and you will not need to set them at run time. If not, C<in> will
default to 'head' and C<prefix> to the empty string. default to 'head' and C<prefix> to the empty string.
The tokens will be placed in the C<WWW::SwaggerClient::Configuration> namespace The tokens will be placed in the C<WWW::SwaggerClient::Configuration> namespace
as follows, but you don't need to know about this. as follows, but you don't need to know about this.
=over 4 =over 4
@@ -251,7 +235,7 @@ all api keys require a prefix.
=item C<$WWW::SwaggerClient::Configuration::access_token> =item C<$WWW::SwaggerClient::Configuration::access_token>
String. The OAuth access token. String. The OAuth access token.
=back =back
@@ -259,16 +243,16 @@ String. The OAuth access token.
=head2 C<base_url> =head2 C<base_url>
The generated code has the C<base_url> already set as a default value. This method The generated code has the C<base_url> already set as a default value. This method
returns (and optionally sets, but only if the API client has not been returns (and optionally sets, but only if the API client has not been
created yet) the current value of C<base_url>. created yet) the current value of C<base_url>.
=head2 C<api_factory> =head2 C<api_factory>
Returns an API factory object. You probably won't need to call this directly. Returns an API factory object. You probably won't need to call this directly.
$self->api_factory('Pet'); # returns a WWW::SwaggerClient::PetApi instance $self->api_factory('Pet'); # returns a WWW::SwaggerClient::PetApi instance
$self->pet_api; # the same $self->pet_api; # the same
=head1 MISSING METHODS =head1 MISSING METHODS
@@ -278,9 +262,9 @@ Most of the methods on the API are delegated to individual endpoint API objects
same method name (e.g. C<new()>), these methods can't be delegated. So you need same method name (e.g. C<new()>), these methods can't be delegated. So you need
to call C<$api-E<gt>pet_api-E<gt>new()>. to call C<$api-E<gt>pet_api-E<gt>new()>.
In principle, every API is susceptible to the presence of a few, random, undelegatable In principle, every API is susceptible to the presence of a few, random, undelegatable
method names. In practice, because of the way method names are constructed, it's method names. In practice, because of the way method names are constructed, it's
unlikely in general that any methods will be undelegatable, except for: unlikely in general that any methods will be undelegatable, except for:
new() new()
class_documentation() class_documentation()
@@ -293,12 +277,12 @@ you could also call them on class names.
=head1 BUILDING YOUR LIBRARY =head1 BUILDING YOUR LIBRARY
See the homepage C<https://github.com/swagger-api/swagger-codegen> for full details. See the homepage C<https://github.com/swagger-api/swagger-codegen> for full details.
But briefly, clone the git repository, build the codegen codebase, set up your build But briefly, clone the git repository, build the codegen codebase, set up your build
config file, then run the API build script. You will need git, Java 7 or 8 and Apache config file, then run the API build script. You will need git, Java 7 or 8 and Apache
maven 3.0.3 or better already installed. maven 3.0.3 or better already installed.
The config file should specify the project name for the generated library: The config file should specify the project name for the generated library:
{"moduleName":"WWW::MyProjectName"} {"moduleName":"WWW::MyProjectName"}
@@ -313,8 +297,8 @@ Your library files will be built under C<WWW::MyProjectName>.
-c /path/to/config/file.json \ -c /path/to/config/file.json \
-o /path/to/output/folder -o /path/to/output/folder
Bang, all done. Run the C<autodoc> script in the C<bin> directory to see the API Bang, all done. Run the C<autodoc> script in the C<bin> directory to see the API
you just built. you just built.
=head1 AUTOMATIC DOCUMENTATION =head1 AUTOMATIC DOCUMENTATION
@@ -326,28 +310,28 @@ output formats are supported:
-w wide format (default) -w wide format (default)
-n narrow format -n narrow format
-p POD format -p POD format
-H HTML format -H HTML format
-m Markdown format -m Markdown format
-h print this help message -h print this help message
-c your application class -c your application class
The C<-c> option allows you to load and inspect your own application. A dummy The C<-c> option allows you to load and inspect your own application. A dummy
namespace is used if you don't supply your own class. namespace is used if you don't supply your own class.
=head1 DOCUMENTATION FROM THE OpenAPI Spec =head1 DOCUMENTATION FROM THE OpenAPI Spec
Additional documentation for each class and method may be provided by the Swagger Additional documentation for each class and method may be provided by the Swagger
spec. If so, this is available via the C<class_documentation()> and spec. If so, this is available via the C<class_documentation()> and
C<method_documentation()> methods on each generated object class, and the C<method_documentation()> methods on each generated object class, and the
C<method_documentation()> method on the endpoint API classes: C<method_documentation()> method on the endpoint API classes:
my $cmdoc = $api->pet_api->method_documentation->{$method_name}; my $cmdoc = $api->pet_api->method_documentation->{$method_name};
my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation; my $odoc = $api->get_pet_by_id->(pet_id => $pet_id)->class_documentation;
my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name}; my $omdoc = $api->get_pet_by_id->(pet_id => $pet_id)->method_documentation->{method_name};
Each of these calls returns a hashref with various useful pieces of information. Each of these calls returns a hashref with various useful pieces of information.
=cut =cut

View File

@@ -1,25 +1,13 @@
=begin comment =begin comment
Swagger Petstore */ ' \" Swagger Petstore */ ' \" =_end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =_end --
OpenAPI spec version: 1.0.0 */ &#39; \&quot; OpenAPI spec version: 1.0.0 */ &#39; \&quot; &#x3D;_end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" Contact: apiteam@swagger.io */ ' \" =_end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=end comment =end comment
=cut =cut