Skip to content

Commit

Permalink
Use conditional access for enumref query params (#20418)
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianVennen authored Jan 9, 2025
1 parent 40d4703 commit 3d2ff49
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ use {{invokerPackage}}\ObjectSerializer;
{{#queryParams}}
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
${{paramName}}{{#isEnumRef}}->value{{/isEnumRef}},
${{paramName}}{{#isEnumRef}}?->value{{/isEnumRef}},
'{{baseName}}', // param base name
'{{#schema}}{{openApiType}}{{/schema}}', // openApiType
'{{style}}', // style
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ public function testEnumRefStringRequest(
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$enum_ref_string_query->value,
$enum_ref_string_query?->value,
'enum_ref_string_query', // param base name
'StringEnumRef', // openApiType
'form', // style
Expand Down
2 changes: 1 addition & 1 deletion samples/client/echo_api/php-nextgen/src/Api/QueryApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ public function testEnumRefStringRequest(
) ?? []);
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$enum_ref_string_query->value,
$enum_ref_string_query?->value,
'enum_ref_string_query', // param base name
'StringEnumRef', // openApiType
'form', // style
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ public function fakeEnumEndpointRequest(

// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$enum_class->value,
$enum_class?->value,
'enum-class', // param base name
'EnumClass', // openApiType
'form', // style
Expand Down

0 comments on commit 3d2ff49

Please sign in to comment.