From a8f173b999aed2c410b37665bbbbbb2f299cec4b Mon Sep 17 00:00:00 2001 From: coffeemakr Date: Thu, 19 Mar 2026 13:09:25 +0100 Subject: [PATCH] [php-nextgen]: Fix array defaults --- .../codegen/languages/PhpNextgenClientCodegen.java | 2 +- .../php-nextgen-streaming/docs/Model/DefaultValue.md | 8 ++++---- .../echo_api/php-nextgen-streaming/docs/Model/Query.md | 2 +- .../php-nextgen-streaming/src/Model/DefaultValue.php | 8 ++++---- .../echo_api/php-nextgen-streaming/src/Model/Query.php | 2 +- .../echo_api/php-nextgen/docs/Model/DefaultValue.md | 8 ++++---- samples/client/echo_api/php-nextgen/docs/Model/Query.md | 2 +- .../echo_api/php-nextgen/src/Model/DefaultValue.php | 8 ++++---- samples/client/echo_api/php-nextgen/src/Model/Query.php | 2 +- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java index 447e2b346666..e83f7bf92f4f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java @@ -251,7 +251,7 @@ public String toDefaultValue(CodegenProperty codegenProperty, Schema schema) { schema = ModelUtils.getReferencedSchema(this.openAPI, schema); if (schema.getDefault() != null) { // array schema has default value - return "[" + schema.getDefault().toString() + "]"; + return schema.getDefault().toString(); } else if (schema.getItems().getDefault() != null) { // array item schema has default value return "[" + toDefaultValue(schema.getItems()) + "]"; } else { diff --git a/samples/client/echo_api/php-nextgen-streaming/docs/Model/DefaultValue.md b/samples/client/echo_api/php-nextgen-streaming/docs/Model/DefaultValue.md index ad271999e3ac..69e7efd181f5 100644 --- a/samples/client/echo_api/php-nextgen-streaming/docs/Model/DefaultValue.md +++ b/samples/client/echo_api/php-nextgen-streaming/docs/Model/DefaultValue.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**array_string_enum_ref_default** | [**\OpenAPI\Client\Model\StringEnumRef[]**](StringEnumRef.md) | | [optional] [default to [["success","failure"]]] -**array_string_enum_default** | **string[]** | | [optional] [default to [["success","failure"]]] -**array_string_default** | **string[]** | | [optional] [default to [["failure","skipped"]]] -**array_integer_default** | **int[]** | | [optional] [default to [[1,3]]] +**array_string_enum_ref_default** | [**\OpenAPI\Client\Model\StringEnumRef[]**](StringEnumRef.md) | | [optional] [default to ["success","failure"]] +**array_string_enum_default** | **string[]** | | [optional] [default to ["success","failure"]] +**array_string_default** | **string[]** | | [optional] [default to ["failure","skipped"]] +**array_integer_default** | **int[]** | | [optional] [default to [1,3]] **array_string** | **string[]** | | [optional] **array_string_nullable** | **string[]** | | [optional] **array_string_extension_nullable** | **string[]** | | [optional] diff --git a/samples/client/echo_api/php-nextgen-streaming/docs/Model/Query.md b/samples/client/echo_api/php-nextgen-streaming/docs/Model/Query.md index 91d1e7e7feb3..43fc0b53feff 100644 --- a/samples/client/echo_api/php-nextgen-streaming/docs/Model/Query.md +++ b/samples/client/echo_api/php-nextgen-streaming/docs/Model/Query.md @@ -5,6 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | Query | [optional] -**outcomes** | **string[]** | | [optional] [default to [["SUCCESS","FAILURE"]]] +**outcomes** | **string[]** | | [optional] [default to ["SUCCESS","FAILURE"]] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Model/DefaultValue.php b/samples/client/echo_api/php-nextgen-streaming/src/Model/DefaultValue.php index 5d349d4619b4..d32a7995cb87 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Model/DefaultValue.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Model/DefaultValue.php @@ -303,10 +303,10 @@ public static function getArrayStringEnumDefaultAllowableValues() */ public function __construct(?array $data = null) { - $this->setIfExists('array_string_enum_ref_default', $data ?? [], [["success","failure"]]); - $this->setIfExists('array_string_enum_default', $data ?? [], [["success","failure"]]); - $this->setIfExists('array_string_default', $data ?? [], [["failure","skipped"]]); - $this->setIfExists('array_integer_default', $data ?? [], [[1,3]]); + $this->setIfExists('array_string_enum_ref_default', $data ?? [], ["success","failure"]); + $this->setIfExists('array_string_enum_default', $data ?? [], ["success","failure"]); + $this->setIfExists('array_string_default', $data ?? [], ["failure","skipped"]); + $this->setIfExists('array_integer_default', $data ?? [], [1,3]); $this->setIfExists('array_string', $data ?? [], null); $this->setIfExists('array_string_nullable', $data ?? [], null); $this->setIfExists('array_string_extension_nullable', $data ?? [], null); diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Model/Query.php b/samples/client/echo_api/php-nextgen-streaming/src/Model/Query.php index ec0b3feb996f..1305b348def6 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Model/Query.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Model/Query.php @@ -267,7 +267,7 @@ public static function getOutcomesAllowableValues() public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); - $this->setIfExists('outcomes', $data ?? [], [["SUCCESS","FAILURE"]]); + $this->setIfExists('outcomes', $data ?? [], ["SUCCESS","FAILURE"]); } /** diff --git a/samples/client/echo_api/php-nextgen/docs/Model/DefaultValue.md b/samples/client/echo_api/php-nextgen/docs/Model/DefaultValue.md index ad271999e3ac..69e7efd181f5 100644 --- a/samples/client/echo_api/php-nextgen/docs/Model/DefaultValue.md +++ b/samples/client/echo_api/php-nextgen/docs/Model/DefaultValue.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**array_string_enum_ref_default** | [**\OpenAPI\Client\Model\StringEnumRef[]**](StringEnumRef.md) | | [optional] [default to [["success","failure"]]] -**array_string_enum_default** | **string[]** | | [optional] [default to [["success","failure"]]] -**array_string_default** | **string[]** | | [optional] [default to [["failure","skipped"]]] -**array_integer_default** | **int[]** | | [optional] [default to [[1,3]]] +**array_string_enum_ref_default** | [**\OpenAPI\Client\Model\StringEnumRef[]**](StringEnumRef.md) | | [optional] [default to ["success","failure"]] +**array_string_enum_default** | **string[]** | | [optional] [default to ["success","failure"]] +**array_string_default** | **string[]** | | [optional] [default to ["failure","skipped"]] +**array_integer_default** | **int[]** | | [optional] [default to [1,3]] **array_string** | **string[]** | | [optional] **array_string_nullable** | **string[]** | | [optional] **array_string_extension_nullable** | **string[]** | | [optional] diff --git a/samples/client/echo_api/php-nextgen/docs/Model/Query.md b/samples/client/echo_api/php-nextgen/docs/Model/Query.md index 91d1e7e7feb3..43fc0b53feff 100644 --- a/samples/client/echo_api/php-nextgen/docs/Model/Query.md +++ b/samples/client/echo_api/php-nextgen/docs/Model/Query.md @@ -5,6 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **int** | Query | [optional] -**outcomes** | **string[]** | | [optional] [default to [["SUCCESS","FAILURE"]]] +**outcomes** | **string[]** | | [optional] [default to ["SUCCESS","FAILURE"]] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/echo_api/php-nextgen/src/Model/DefaultValue.php b/samples/client/echo_api/php-nextgen/src/Model/DefaultValue.php index 5d349d4619b4..d32a7995cb87 100644 --- a/samples/client/echo_api/php-nextgen/src/Model/DefaultValue.php +++ b/samples/client/echo_api/php-nextgen/src/Model/DefaultValue.php @@ -303,10 +303,10 @@ public static function getArrayStringEnumDefaultAllowableValues() */ public function __construct(?array $data = null) { - $this->setIfExists('array_string_enum_ref_default', $data ?? [], [["success","failure"]]); - $this->setIfExists('array_string_enum_default', $data ?? [], [["success","failure"]]); - $this->setIfExists('array_string_default', $data ?? [], [["failure","skipped"]]); - $this->setIfExists('array_integer_default', $data ?? [], [[1,3]]); + $this->setIfExists('array_string_enum_ref_default', $data ?? [], ["success","failure"]); + $this->setIfExists('array_string_enum_default', $data ?? [], ["success","failure"]); + $this->setIfExists('array_string_default', $data ?? [], ["failure","skipped"]); + $this->setIfExists('array_integer_default', $data ?? [], [1,3]); $this->setIfExists('array_string', $data ?? [], null); $this->setIfExists('array_string_nullable', $data ?? [], null); $this->setIfExists('array_string_extension_nullable', $data ?? [], null); diff --git a/samples/client/echo_api/php-nextgen/src/Model/Query.php b/samples/client/echo_api/php-nextgen/src/Model/Query.php index ec0b3feb996f..1305b348def6 100644 --- a/samples/client/echo_api/php-nextgen/src/Model/Query.php +++ b/samples/client/echo_api/php-nextgen/src/Model/Query.php @@ -267,7 +267,7 @@ public static function getOutcomesAllowableValues() public function __construct(?array $data = null) { $this->setIfExists('id', $data ?? [], null); - $this->setIfExists('outcomes', $data ?? [], [["SUCCESS","FAILURE"]]); + $this->setIfExists('outcomes', $data ?? [], ["SUCCESS","FAILURE"]); } /**