From 217d93401b208fcc7e635693867b8782e705b455 Mon Sep 17 00:00:00 2001 From: wing328 Date: Sun, 3 Apr 2016 17:05:32 +0800 Subject: [PATCH] better php enum naming --- .../swagger/codegen/languages/PhpClientCodegen.java | 3 ++- .../client/petstore/php/SwaggerClient-php/README.md | 2 +- .../lib/Model/InlineResponse200.php | 12 ++++++------ .../php/SwaggerClient-php/lib/Model/Order.php | 12 ++++++------ .../petstore/php/SwaggerClient-php/lib/Model/Pet.php | 12 ++++++------ 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java index 83e6495399..8f8ad281f6 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PhpClientCodegen.java @@ -585,7 +585,7 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String toEnumName(CodegenProperty property) { - String enumName = toModelName(property.name) + "Enum"; + String enumName = toModelName(property.name); if (enumName.matches("\\d.*")) { // starts with number return "_" + enumName; @@ -596,6 +596,7 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public Map postProcessModels(Map objs) { + // process enum in models return postProcessModelsEnum(objs); } } diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index 1eaa868a05..e829f2643a 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-03T00:07:22.143+08:00 +- Build date: 2016-04-03T17:03:15.368+08:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php index 85e140a5eb..7aa1610cb9 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/InlineResponse200.php @@ -114,9 +114,9 @@ class InlineResponse200 implements ArrayAccess return self::$getters; } - const STATUS_AVAILABLE = ""available""; - const STATUS_PENDING = ""pending""; - const STATUS_SOLD = ""sold""; + const Status_AVAILABLE = "available"; + const Status_PENDING = "pending"; + const Status_SOLD = "sold"; @@ -126,9 +126,9 @@ class InlineResponse200 implements ArrayAccess */ public function getStatusAllowableValues() { return [ - self::STATUS_AVAILABLE, - self::STATUS_PENDING, - self::STATUS_SOLD, + self::Status_AVAILABLE, + self::Status_PENDING, + self::Status_SOLD, ]; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php index 0be579b8c5..b9aeed0189 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -114,9 +114,9 @@ class Order implements ArrayAccess return self::$getters; } - const STATUS_PLACED = ""placed""; - const STATUS_APPROVED = ""approved""; - const STATUS_DELIVERED = ""delivered""; + const Status_PLACED = "placed"; + const Status_APPROVED = "approved"; + const Status_DELIVERED = "delivered"; @@ -126,9 +126,9 @@ class Order implements ArrayAccess */ public function getStatusAllowableValues() { return [ - self::STATUS_PLACED, - self::STATUS_APPROVED, - self::STATUS_DELIVERED, + self::Status_PLACED, + self::Status_APPROVED, + self::Status_DELIVERED, ]; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php index 6154dc36fe..dfad9032e3 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Pet.php @@ -114,9 +114,9 @@ class Pet implements ArrayAccess return self::$getters; } - const STATUS_AVAILABLE = ""available""; - const STATUS_PENDING = ""pending""; - const STATUS_SOLD = ""sold""; + const Status_AVAILABLE = "available"; + const Status_PENDING = "pending"; + const Status_SOLD = "sold"; @@ -126,9 +126,9 @@ class Pet implements ArrayAccess */ public function getStatusAllowableValues() { return [ - self::STATUS_AVAILABLE, - self::STATUS_PENDING, - self::STATUS_SOLD, + self::Status_AVAILABLE, + self::Status_PENDING, + self::Status_SOLD, ]; }