forked from loafle/openapi-generator-original
update perl model to support prefix and suffix
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -83,4 +83,3 @@ samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/
|
|||||||
samples/client/petstore/python/dev-requirements.txt.log
|
samples/client/petstore/python/dev-requirements.txt.log
|
||||||
samples/client/petstore/python/swagger_client.egg-info/SOURCES.txt
|
samples/client/petstore/python/swagger_client.egg-info/SOURCES.txt
|
||||||
samples/client/petstore/python/.coverage
|
samples/client/petstore/python/.coverage
|
||||||
samples/client/petstore/python/swagger_client.egg-info/SOURCES.txt
|
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
if (type == null) {
|
if (type == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return type;
|
return toModelName(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -220,9 +220,13 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
public String toModelName(String name) {
|
public String toModelName(String name) {
|
||||||
// model name cannot use reserved keyword
|
// model name cannot use reserved keyword
|
||||||
if (isReservedWord(name)) {
|
if (isReservedWord(name)) {
|
||||||
escapeReservedWord(name); // e.g. return => _return
|
LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + camelize("object_" + name));
|
||||||
|
name = "object_" + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add prefix/suffic to model name
|
||||||
|
name = modelNamePrefix + name + modelNameSuffix;
|
||||||
|
|
||||||
// camelize the model name
|
// camelize the model name
|
||||||
// phone_number => PhoneNumber
|
// phone_number => PhoneNumber
|
||||||
return camelize(name);
|
return camelize(name);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ WWW::SwaggerClient::Role - a Moose role for the Swagger Petstore
|
|||||||
|
|
||||||
Automatically generated by the Perl Swagger Codegen project:
|
Automatically generated by the Perl Swagger Codegen project:
|
||||||
|
|
||||||
- Build date: 2016-02-24T21:56:00.847+08:00
|
- Build date: 2016-02-27T21:43:00.005+08:00
|
||||||
- Build package: class io.swagger.codegen.languages.PerlClientCodegen
|
- Build package: class io.swagger.codegen.languages.PerlClientCodegen
|
||||||
- Codegen version:
|
- Codegen version:
|
||||||
|
|
||||||
|
|||||||
@@ -574,7 +574,7 @@ sub delete_pet {
|
|||||||
#
|
#
|
||||||
# @param int $pet_id ID of pet to update (required)
|
# @param int $pet_id ID of pet to update (required)
|
||||||
# @param string $additional_metadata Additional data to pass to server (optional)
|
# @param string $additional_metadata Additional data to pass to server (optional)
|
||||||
# @param file $file file to upload (optional)
|
# @param File $file file to upload (optional)
|
||||||
{
|
{
|
||||||
my $params = {
|
my $params = {
|
||||||
'pet_id' => {
|
'pet_id' => {
|
||||||
@@ -588,7 +588,7 @@ sub delete_pet {
|
|||||||
required => '0',
|
required => '0',
|
||||||
},
|
},
|
||||||
'file' => {
|
'file' => {
|
||||||
data_type => 'file',
|
data_type => 'File',
|
||||||
description => 'file to upload',
|
description => 'file to upload',
|
||||||
required => '0',
|
required => '0',
|
||||||
},
|
},
|
||||||
@@ -667,10 +667,10 @@ sub upload_file {
|
|||||||
#
|
#
|
||||||
# Fake endpoint to test byte array return by 'Find pet by ID'
|
# Fake endpoint to test byte array return by 'Find pet by ID'
|
||||||
#
|
#
|
||||||
# @param int $package ID of pet that needs to be fetched (required)
|
# @param int $pet_id ID of pet that needs to be fetched (required)
|
||||||
{
|
{
|
||||||
my $params = {
|
my $params = {
|
||||||
'package' => {
|
'pet_id' => {
|
||||||
data_type => 'int',
|
data_type => 'int',
|
||||||
description => 'ID of pet that needs to be fetched',
|
description => 'ID of pet that needs to be fetched',
|
||||||
required => '1',
|
required => '1',
|
||||||
@@ -688,9 +688,9 @@ sub pet_pet_idtesting_byte_arraytrue_get {
|
|||||||
my ($self, %args) = @_;
|
my ($self, %args) = @_;
|
||||||
|
|
||||||
|
|
||||||
# verify the required parameter 'package' is set
|
# verify the required parameter 'pet_id' is set
|
||||||
unless (exists $args{'package'}) {
|
unless (exists $args{'pet_id'}) {
|
||||||
croak("Missing the required parameter 'package' when calling pet_pet_idtesting_byte_arraytrue_get");
|
croak("Missing the required parameter 'pet_id' when calling pet_pet_idtesting_byte_arraytrue_get");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -713,9 +713,9 @@ sub pet_pet_idtesting_byte_arraytrue_get {
|
|||||||
|
|
||||||
|
|
||||||
# path params
|
# path params
|
||||||
if ( exists $args{'package'}) {
|
if ( exists $args{'pet_id'}) {
|
||||||
my $_base_variable = "{" . "package" . "}";
|
my $_base_variable = "{" . "petId" . "}";
|
||||||
my $_base_value = $self->{api_client}->to_path_value($args{'package'});
|
my $_base_value = $self->{api_client}->to_path_value($args{'pet_id'});
|
||||||
$_resource_path =~ s/$_base_variable/$_base_value/g;
|
$_resource_path =~ s/$_base_variable/$_base_value/g;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ has version_info => ( is => 'ro',
|
|||||||
default => sub { {
|
default => sub { {
|
||||||
app_name => 'Swagger Petstore',
|
app_name => 'Swagger Petstore',
|
||||||
app_version => '1.0.0',
|
app_version => '1.0.0',
|
||||||
generated_date => '2016-02-24T21:56:00.847+08:00',
|
generated_date => '2016-02-27T21:43:00.005+08:00',
|
||||||
generator_class => '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'
|
||||||
@@ -103,7 +103,7 @@ Automatically generated by the Perl Swagger Codegen project:
|
|||||||
|
|
||||||
=over 4
|
=over 4
|
||||||
|
|
||||||
=item Build date: 2016-02-24T21:56:00.847+08:00
|
=item Build date: 2016-02-27T21:43:00.005+08:00
|
||||||
|
|
||||||
=item Build package: class io.swagger.codegen.languages.PerlClientCodegen
|
=item Build package: class io.swagger.codegen.languages.PerlClientCodegen
|
||||||
|
|
||||||
|
|||||||
@@ -102,8 +102,8 @@ isa_ok($api, 'WWW::SwaggerClient::PetApi');
|
|||||||
# pet_pet_idtesting_byte_arraytrue_get test
|
# pet_pet_idtesting_byte_arraytrue_get test
|
||||||
#
|
#
|
||||||
{
|
{
|
||||||
my $package = undef; # replace NULL with a proper value
|
my $pet_id = undef; # replace NULL with a proper value
|
||||||
my $result = $api->pet_pet_idtesting_byte_arraytrue_get(package => $package);
|
my $result = $api->pet_pet_idtesting_byte_arraytrue_get(pet_id => $pet_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|||||||
Reference in New Issue
Block a user