Skip to content

Commit 3cf653d

Browse files
authored
[php-nextgen]: Fix array defaults (#23290)
Co-authored-by: coffeemakr <coffeemakr@users.noreply.github.com>
1 parent 7213753 commit 3cf653d

9 files changed

Lines changed: 21 additions & 21 deletions

File tree

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public String toDefaultValue(CodegenProperty codegenProperty, Schema schema) {
251251
schema = ModelUtils.getReferencedSchema(this.openAPI, schema);
252252

253253
if (schema.getDefault() != null) { // array schema has default value
254-
return "[" + schema.getDefault().toString() + "]";
254+
return schema.getDefault().toString();
255255
} else if (schema.getItems().getDefault() != null) { // array item schema has default value
256256
return "[" + toDefaultValue(schema.getItems()) + "]";
257257
} else {

samples/client/echo_api/php-nextgen-streaming/docs/Model/DefaultValue.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
7-
**array_string_enum_ref_default** | [**\OpenAPI\Client\Model\StringEnumRef[]**](StringEnumRef.md) | | [optional] [default to [["success","failure"]]]
8-
**array_string_enum_default** | **string[]** | | [optional] [default to [["success","failure"]]]
9-
**array_string_default** | **string[]** | | [optional] [default to [["failure","skipped"]]]
10-
**array_integer_default** | **int[]** | | [optional] [default to [[1,3]]]
7+
**array_string_enum_ref_default** | [**\OpenAPI\Client\Model\StringEnumRef[]**](StringEnumRef.md) | | [optional] [default to ["success","failure"]]
8+
**array_string_enum_default** | **string[]** | | [optional] [default to ["success","failure"]]
9+
**array_string_default** | **string[]** | | [optional] [default to ["failure","skipped"]]
10+
**array_integer_default** | **int[]** | | [optional] [default to [1,3]]
1111
**array_string** | **string[]** | | [optional]
1212
**array_string_nullable** | **string[]** | | [optional]
1313
**array_string_extension_nullable** | **string[]** | | [optional]

samples/client/echo_api/php-nextgen-streaming/docs/Model/Query.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
77
**id** | **int** | Query | [optional]
8-
**outcomes** | **string[]** | | [optional] [default to [["SUCCESS","FAILURE"]]]
8+
**outcomes** | **string[]** | | [optional] [default to ["SUCCESS","FAILURE"]]
99

1010
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

samples/client/echo_api/php-nextgen-streaming/src/Model/DefaultValue.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,10 @@ public static function getArrayStringEnumDefaultAllowableValues()
303303
*/
304304
public function __construct(?array $data = null)
305305
{
306-
$this->setIfExists('array_string_enum_ref_default', $data ?? [], [["success","failure"]]);
307-
$this->setIfExists('array_string_enum_default', $data ?? [], [["success","failure"]]);
308-
$this->setIfExists('array_string_default', $data ?? [], [["failure","skipped"]]);
309-
$this->setIfExists('array_integer_default', $data ?? [], [[1,3]]);
306+
$this->setIfExists('array_string_enum_ref_default', $data ?? [], ["success","failure"]);
307+
$this->setIfExists('array_string_enum_default', $data ?? [], ["success","failure"]);
308+
$this->setIfExists('array_string_default', $data ?? [], ["failure","skipped"]);
309+
$this->setIfExists('array_integer_default', $data ?? [], [1,3]);
310310
$this->setIfExists('array_string', $data ?? [], null);
311311
$this->setIfExists('array_string_nullable', $data ?? [], null);
312312
$this->setIfExists('array_string_extension_nullable', $data ?? [], null);

samples/client/echo_api/php-nextgen-streaming/src/Model/Query.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ public static function getOutcomesAllowableValues()
267267
public function __construct(?array $data = null)
268268
{
269269
$this->setIfExists('id', $data ?? [], null);
270-
$this->setIfExists('outcomes', $data ?? [], [["SUCCESS","FAILURE"]]);
270+
$this->setIfExists('outcomes', $data ?? [], ["SUCCESS","FAILURE"]);
271271
}
272272

273273
/**

samples/client/echo_api/php-nextgen/docs/Model/DefaultValue.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
7-
**array_string_enum_ref_default** | [**\OpenAPI\Client\Model\StringEnumRef[]**](StringEnumRef.md) | | [optional] [default to [["success","failure"]]]
8-
**array_string_enum_default** | **string[]** | | [optional] [default to [["success","failure"]]]
9-
**array_string_default** | **string[]** | | [optional] [default to [["failure","skipped"]]]
10-
**array_integer_default** | **int[]** | | [optional] [default to [[1,3]]]
7+
**array_string_enum_ref_default** | [**\OpenAPI\Client\Model\StringEnumRef[]**](StringEnumRef.md) | | [optional] [default to ["success","failure"]]
8+
**array_string_enum_default** | **string[]** | | [optional] [default to ["success","failure"]]
9+
**array_string_default** | **string[]** | | [optional] [default to ["failure","skipped"]]
10+
**array_integer_default** | **int[]** | | [optional] [default to [1,3]]
1111
**array_string** | **string[]** | | [optional]
1212
**array_string_nullable** | **string[]** | | [optional]
1313
**array_string_extension_nullable** | **string[]** | | [optional]

samples/client/echo_api/php-nextgen/docs/Model/Query.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
77
**id** | **int** | Query | [optional]
8-
**outcomes** | **string[]** | | [optional] [default to [["SUCCESS","FAILURE"]]]
8+
**outcomes** | **string[]** | | [optional] [default to ["SUCCESS","FAILURE"]]
99

1010
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

samples/client/echo_api/php-nextgen/src/Model/DefaultValue.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,10 @@ public static function getArrayStringEnumDefaultAllowableValues()
303303
*/
304304
public function __construct(?array $data = null)
305305
{
306-
$this->setIfExists('array_string_enum_ref_default', $data ?? [], [["success","failure"]]);
307-
$this->setIfExists('array_string_enum_default', $data ?? [], [["success","failure"]]);
308-
$this->setIfExists('array_string_default', $data ?? [], [["failure","skipped"]]);
309-
$this->setIfExists('array_integer_default', $data ?? [], [[1,3]]);
306+
$this->setIfExists('array_string_enum_ref_default', $data ?? [], ["success","failure"]);
307+
$this->setIfExists('array_string_enum_default', $data ?? [], ["success","failure"]);
308+
$this->setIfExists('array_string_default', $data ?? [], ["failure","skipped"]);
309+
$this->setIfExists('array_integer_default', $data ?? [], [1,3]);
310310
$this->setIfExists('array_string', $data ?? [], null);
311311
$this->setIfExists('array_string_nullable', $data ?? [], null);
312312
$this->setIfExists('array_string_extension_nullable', $data ?? [], null);

samples/client/echo_api/php-nextgen/src/Model/Query.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ public static function getOutcomesAllowableValues()
267267
public function __construct(?array $data = null)
268268
{
269269
$this->setIfExists('id', $data ?? [], null);
270-
$this->setIfExists('outcomes', $data ?? [], [["SUCCESS","FAILURE"]]);
270+
$this->setIfExists('outcomes', $data ?? [], ["SUCCESS","FAILURE"]);
271271
}
272272

273273
/**

0 commit comments

Comments
 (0)