From a8f13f680d3478a1b1d270215d78616472059e1a Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sat, 20 Jan 2024 16:41:51 +0800 Subject: [PATCH] add auto-generated cpanfile in perl client --- .../codegen/languages/PerlClientCodegen.java | 15 +++++++++------ .../src/main/resources/perl/cpanfile.mustache | 11 +++++++++++ .../client/petstore/perl/.openapi-generator/FILES | 1 + samples/client/petstore/perl/cpanfile | 11 +++++++++++ 4 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 modules/openapi-generator/src/main/resources/perl/cpanfile.mustache create mode 100644 samples/client/petstore/perl/cpanfile diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PerlClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PerlClientCodegen.java index 7fd05a4c668d..f5d72b984d74 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PerlClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PerlClientCodegen.java @@ -159,8 +159,8 @@ public PerlClientCodegen() { // option to change the order of form/body parameter cliOptions.add(CliOption.newBoolean( - CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, - CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS_DESC) + CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, + CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS_DESC) .defaultValue(Boolean.FALSE.toString())); } @@ -202,6 +202,7 @@ public void processOpts() { supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); supportingFiles.add(new SupportingFile("travis.mustache", "", ".travis.yml")); + supportingFiles.add(new SupportingFile("cpanfile.mustache", "", "cpanfile")); } @Override @@ -700,9 +701,9 @@ public CodegenModel fromModel(String name, Schema sc) { * A custom version is made for this method to ensure that * property.format remains empty string * - * @param name name of the property - * @param p OAS property schema - * @param required true if the property is required in the next higher object schema, false otherwise + * @param name name of the property + * @param p OAS property schema + * @param required true if the property is required in the next higher object schema, false otherwise * @param schemaIsFromAdditionalProperties true if the property is defined by additional properties schema * @return Codegen Property object */ @@ -714,5 +715,7 @@ public CodegenProperty fromProperty(String name, Schema p, boolean required, boo } @Override - public GeneratorLanguage generatorLanguage() { return GeneratorLanguage.PERL; } + public GeneratorLanguage generatorLanguage() { + return GeneratorLanguage.PERL; + } } diff --git a/modules/openapi-generator/src/main/resources/perl/cpanfile.mustache b/modules/openapi-generator/src/main/resources/perl/cpanfile.mustache new file mode 100644 index 000000000000..402fd48a247d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/perl/cpanfile.mustache @@ -0,0 +1,11 @@ +requires 'Class::Accessor'; +requires 'Test::Exception'; +requires 'Test::More'; +requires 'Log::Any'; +requires 'LWP::UserAgent'; +requires 'URI::Query'; +requires 'Module::Runtime'; +requires 'DateTime'; +requires 'Module::Find'; +requires 'Moose::Role'; +requires 'JSON', '>= 2.00, < 2.80'; \ No newline at end of file diff --git a/samples/client/petstore/perl/.openapi-generator/FILES b/samples/client/petstore/perl/.openapi-generator/FILES index 790e480f56da..a4c0c9025cb5 100644 --- a/samples/client/petstore/perl/.openapi-generator/FILES +++ b/samples/client/petstore/perl/.openapi-generator/FILES @@ -2,6 +2,7 @@ .travis.yml README.md bin/autodoc +cpanfile docs/AdditionalPropertiesClass.md docs/AllOfWithSingleRef.md docs/Animal.md diff --git a/samples/client/petstore/perl/cpanfile b/samples/client/petstore/perl/cpanfile new file mode 100644 index 000000000000..402fd48a247d --- /dev/null +++ b/samples/client/petstore/perl/cpanfile @@ -0,0 +1,11 @@ +requires 'Class::Accessor'; +requires 'Test::Exception'; +requires 'Test::More'; +requires 'Log::Any'; +requires 'LWP::UserAgent'; +requires 'URI::Query'; +requires 'Module::Runtime'; +requires 'DateTime'; +requires 'Module::Find'; +requires 'Moose::Role'; +requires 'JSON', '>= 2.00, < 2.80'; \ No newline at end of file