[PHP][php-nextgen] Fix usage of enums in parameters (#20294)

This commit is contained in:
Julian Vennen 2024-12-16 12:19:24 +01:00 committed by GitHub
parent 47891245e9
commit e87c4ea6c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 10 additions and 10 deletions

View File

@ -711,7 +711,7 @@ use {{invokerPackage}}\ObjectSerializer;
{{#queryParams}}
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
${{paramName}},
${{paramName}}{{#isEnumRef}}->value{{/isEnumRef}},
'{{baseName}}', // param base name
'{{#schema}}{{openApiType}}{{/schema}}', // openApiType
'{{style}}', // style
@ -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}}
@ -742,7 +742,7 @@ use {{invokerPackage}}\ObjectSerializer;
if (${{paramName}} !== null) {
$resourcePath = str_replace(
'{' . '{{baseName}}' . '}',
ObjectSerializer::toPathValue(${{paramName}}),
ObjectSerializer::toPathValue(${{paramName}}{{#isEnumRef}}->value{{/isEnumRef}}),
$resourcePath
);
}

View File

@ -438,7 +438,7 @@ class HeaderApi
}
// 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);
}

View File

@ -462,7 +462,7 @@ class PathApi
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
);
}

View File

@ -424,7 +424,7 @@ class QueryApi
) ?? []);
// 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

View File

@ -438,7 +438,7 @@ class HeaderApi
}
// 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);
}

View File

@ -462,7 +462,7 @@ class PathApi
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
);
}

View File

@ -424,7 +424,7 @@ class QueryApi
) ?? []);
// 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

View File

@ -773,7 +773,7 @@ class FakeApi
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
$enum_class,
$enum_class->value,
'enum-class', // param base name
'EnumClass', // openApiType
'form', // style