forked from loafle/openapi-generator-original
[python] Add tests and fix enum path parameters (#16769)
* test: Tests for enum params in path, query and header * fix: Get enum ref values correctly in path parameters Closes #16688 * fix java tests failure --------- Co-authored-by: William Cheng <wing328hk@gmail.com>
This commit is contained in:
@@ -151,6 +151,7 @@ class QueryApi
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* @param string|null $enum_nonref_string_query enum_nonref_string_query (optional)
|
||||
* @param StringEnumRef|null $enum_ref_string_query enum_ref_string_query (optional)
|
||||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumRefString'] to see the possible values for this operation
|
||||
*
|
||||
@@ -159,11 +160,12 @@ class QueryApi
|
||||
* @return string
|
||||
*/
|
||||
public function testEnumRefString(
|
||||
?string $enum_nonref_string_query = null,
|
||||
?StringEnumRef $enum_ref_string_query = null,
|
||||
string $contentType = self::contentTypes['testEnumRefString'][0]
|
||||
): string
|
||||
{
|
||||
list($response) = $this->testEnumRefStringWithHttpInfo($enum_ref_string_query, $contentType);
|
||||
list($response) = $this->testEnumRefStringWithHttpInfo($enum_nonref_string_query, $enum_ref_string_query, $contentType);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -172,6 +174,7 @@ class QueryApi
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* @param string|null $enum_nonref_string_query (optional)
|
||||
* @param StringEnumRef|null $enum_ref_string_query (optional)
|
||||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumRefString'] to see the possible values for this operation
|
||||
*
|
||||
@@ -180,11 +183,12 @@ class QueryApi
|
||||
* @return array of string, HTTP status code, HTTP response headers (array of strings)
|
||||
*/
|
||||
public function testEnumRefStringWithHttpInfo(
|
||||
?string $enum_nonref_string_query = null,
|
||||
?StringEnumRef $enum_ref_string_query = null,
|
||||
string $contentType = self::contentTypes['testEnumRefString'][0]
|
||||
): array
|
||||
{
|
||||
$request = $this->testEnumRefStringRequest($enum_ref_string_query, $contentType);
|
||||
$request = $this->testEnumRefStringRequest($enum_nonref_string_query, $enum_ref_string_query, $contentType);
|
||||
|
||||
try {
|
||||
$options = $this->createHttpClientOption();
|
||||
@@ -275,6 +279,7 @@ class QueryApi
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* @param string|null $enum_nonref_string_query (optional)
|
||||
* @param StringEnumRef|null $enum_ref_string_query (optional)
|
||||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumRefString'] to see the possible values for this operation
|
||||
*
|
||||
@@ -282,11 +287,12 @@ class QueryApi
|
||||
* @return PromiseInterface
|
||||
*/
|
||||
public function testEnumRefStringAsync(
|
||||
?string $enum_nonref_string_query = null,
|
||||
?StringEnumRef $enum_ref_string_query = null,
|
||||
string $contentType = self::contentTypes['testEnumRefString'][0]
|
||||
): PromiseInterface
|
||||
{
|
||||
return $this->testEnumRefStringAsyncWithHttpInfo($enum_ref_string_query, $contentType)
|
||||
return $this->testEnumRefStringAsyncWithHttpInfo($enum_nonref_string_query, $enum_ref_string_query, $contentType)
|
||||
->then(
|
||||
function ($response) {
|
||||
return $response[0];
|
||||
@@ -299,6 +305,7 @@ class QueryApi
|
||||
*
|
||||
* Test query parameter(s)
|
||||
*
|
||||
* @param string|null $enum_nonref_string_query (optional)
|
||||
* @param StringEnumRef|null $enum_ref_string_query (optional)
|
||||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumRefString'] to see the possible values for this operation
|
||||
*
|
||||
@@ -306,12 +313,13 @@ class QueryApi
|
||||
* @return PromiseInterface
|
||||
*/
|
||||
public function testEnumRefStringAsyncWithHttpInfo(
|
||||
$enum_nonref_string_query = null,
|
||||
$enum_ref_string_query = null,
|
||||
string $contentType = self::contentTypes['testEnumRefString'][0]
|
||||
): PromiseInterface
|
||||
{
|
||||
$returnType = 'string';
|
||||
$request = $this->testEnumRefStringRequest($enum_ref_string_query, $contentType);
|
||||
$request = $this->testEnumRefStringRequest($enum_nonref_string_query, $enum_ref_string_query, $contentType);
|
||||
|
||||
return $this->client
|
||||
->sendAsync($request, $this->createHttpClientOption())
|
||||
@@ -352,6 +360,7 @@ class QueryApi
|
||||
/**
|
||||
* Create request for operation 'testEnumRefString'
|
||||
*
|
||||
* @param string|null $enum_nonref_string_query (optional)
|
||||
* @param StringEnumRef|null $enum_ref_string_query (optional)
|
||||
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testEnumRefString'] to see the possible values for this operation
|
||||
*
|
||||
@@ -359,6 +368,7 @@ class QueryApi
|
||||
* @return \GuzzleHttp\Psr7\Request
|
||||
*/
|
||||
public function testEnumRefStringRequest(
|
||||
$enum_nonref_string_query = null,
|
||||
$enum_ref_string_query = null,
|
||||
string $contentType = self::contentTypes['testEnumRefString'][0]
|
||||
): Request
|
||||
@@ -366,6 +376,7 @@ class QueryApi
|
||||
|
||||
|
||||
|
||||
|
||||
$resourcePath = '/query/enum_ref_string';
|
||||
$formParams = [];
|
||||
$queryParams = [];
|
||||
@@ -373,6 +384,15 @@ class QueryApi
|
||||
$httpBody = '';
|
||||
$multipart = false;
|
||||
|
||||
// query params
|
||||
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
|
||||
$enum_nonref_string_query,
|
||||
'enum_nonref_string_query', // param base name
|
||||
'string', // openApiType
|
||||
'form', // style
|
||||
true, // explode
|
||||
false // required
|
||||
) ?? []);
|
||||
// query params
|
||||
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
|
||||
$enum_ref_string_query,
|
||||
|
||||
Reference in New Issue
Block a user