Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}},
${{paramName}}{{#isEnumRef}}->value{{/isEnumRef}},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about inline enum? shall we use isEnumOrRef instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An inline enum for that would look like this, right?

paths:
  /path-int/{p}:
    get:
      parameters:
        - name: p
          in: path
          required: true
          description: Integer option in path
          schema:
            type: integer
            enum:
              - 0
              - 1
              - 2
            x-enum-varnames:
              - ZERO
              - ONE
              - TWO
      responses:
        '200':
          description: OK

That does not generate any model classes or constants in the php-nextgen generator.
The type of the function parameter is just int or string so adding ->value would be incorrect.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

let's give it a try

'{{baseName}}', // param base name
'{{#schema}}{{openApiType}}{{/schema}}', // openApiType
'{{style}}', // style
Expand All @@ -728,7 +728,7 @@ use {{invokerPackage}}\ObjectSerializer;
}
{{/collectionFormat}}
if (${{paramName}} !== null) {
$headerParams['{{baseName}}'] = ObjectSerializer::toHeaderValue(${{paramName}});
$headerParams['{{baseName}}'] = ObjectSerializer::toHeaderValue(${{paramName}}{{#isEnumRef}}->value{{/isEnumRef}});
}
{{/headerParams}}

Expand All @@ -742,7 +742,7 @@ use {{invokerPackage}}\ObjectSerializer;
if (${{paramName}} !== null) {
$resourcePath = str_replace(
'{' . '{{baseName}}' . '}',
ObjectSerializer::toPathValue(${{paramName}}),
ObjectSerializer::toPathValue(${{paramName}}{{#isEnumRef}}->value{{/isEnumRef}}),
$resourcePath
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ public function testHeaderIntegerBooleanStringEnumsRequest(
}
// header params
if ($enum_ref_string_header !== null) {
$headerParams['enum_ref_string_header'] = ObjectSerializer::toHeaderValue($enum_ref_string_header);
$headerParams['enum_ref_string_header'] = ObjectSerializer::toHeaderValue($enum_ref_string_header->value);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathE
if ($enum_ref_string_path !== null) {
$resourcePath = str_replace(
'{' . 'enum_ref_string_path' . '}',
ObjectSerializer::toPathValue($enum_ref_string_path),
ObjectSerializer::toPathValue($enum_ref_string_path->value),
$resourcePath
);
}
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,
$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/HeaderApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ public function testHeaderIntegerBooleanStringEnumsRequest(
}
// header params
if ($enum_ref_string_header !== null) {
$headerParams['enum_ref_string_header'] = ObjectSerializer::toHeaderValue($enum_ref_string_header);
$headerParams['enum_ref_string_header'] = ObjectSerializer::toHeaderValue($enum_ref_string_header->value);
}


Expand Down
2 changes: 1 addition & 1 deletion samples/client/echo_api/php-nextgen/src/Api/PathApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathE
if ($enum_ref_string_path !== null) {
$resourcePath = str_replace(
'{' . 'enum_ref_string_path' . '}',
ObjectSerializer::toPathValue($enum_ref_string_path),
ObjectSerializer::toPathValue($enum_ref_string_path->value),
$resourcePath
);
}
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,
$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,
$enum_class->value,
'enum-class', // param base name
'EnumClass', // openApiType
'form', // style
Expand Down