Skip to content

Commit

Permalink
[PHP] Add missing qualifier for enum parameters (#19567)
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianVennen authored Sep 23, 2024
1 parent 98783f8 commit 78f2f70
Show file tree
Hide file tree
Showing 24 changed files with 1,450 additions and 160 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.media.StringSchema;
import io.swagger.v3.oas.models.parameters.Parameter;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.io.FilenameUtils;
Expand Down Expand Up @@ -384,6 +385,11 @@ public String getTypeDeclaration(String name) {
return super.getTypeDeclaration(name);
}

@Override
protected String getParameterDataType(Parameter parameter, Schema schema) {
return getTypeDeclaration(schema);
}

@Override
public String getSchemaType(Schema p) {
String openAPIType = super.getSchemaType(p);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,42 @@ paths:
responses:
200:
description: The instance started successfully
/fake/enum/endpoint:
get:
tags:
- fake
summary: test endpoint with enum parameter
operationId: fake-enum-endpoint
parameters:
- name: enum-class
in: query
description: enum class parameter
required: true
schema:
$ref: '#/components/schemas/EnumClass'
- name: enum-class-array
in: query
description: enum class parameter
required: true
schema:
type: array
items:
$ref: '#/components/schemas/EnumClass'
- name: enum-class-map
in: query
description: enum class parameter
required: true
schema:
type: object
additionalProperties:
$ref: '#/components/schemas/EnumClass'
responses:
200:
description: The instance started successfully
content:
application/json:
schema:
$ref: '#/components/schemas/EnumClass'
servers:
- url: 'http://{server}.swagger.io:{port}/v2'
description: petstore server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,42 @@ paths:
responses:
200:
description: OK
/fake/enum/endpoint:
get:
tags:
- fake
summary: test endpoint with enum parameter
operationId: fake-enum-endpoint
parameters:
- name: enum-class
in: query
description: enum class parameter
required: true
schema:
$ref: '#/components/schemas/EnumClass'
- name: enum-class-array
in: query
description: enum class parameter
required: true
schema:
type: array
items:
$ref: '#/components/schemas/EnumClass'
- name: enum-class-map
in: query
description: enum class parameter
required: true
schema:
type: object
additionalProperties:
$ref: '#/components/schemas/EnumClass'
responses:
200:
description: The instance started successfully
content:
application/json:
schema:
$ref: '#/components/schemas/EnumClass'
servers:
- url: 'http://{server}.swagger.io:{port}/v2'
description: petstore server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ $integer_header = 56; // int
$boolean_header = True; // bool
$string_header = 'string_header_example'; // string
$enum_nonref_string_header = 'enum_nonref_string_header_example'; // string
$enum_ref_string_header = new \OpenAPI\Client\Model\StringEnumRef(); // StringEnumRef
$enum_ref_string_header = new \OpenAPI\Client\Model\\OpenAPI\Client\Model\StringEnumRef(); // \OpenAPI\Client\Model\StringEnumRef

try {
$result = $apiInstance->testHeaderIntegerBooleanStringEnums($integer_header, $boolean_header, $string_header, $enum_nonref_string_header, $enum_ref_string_header);
Expand All @@ -52,7 +52,7 @@ try {
| **boolean_header** | **bool**| | [optional] |
| **string_header** | **string**| | [optional] |
| **enum_nonref_string_header** | **string**| | [optional] |
| **enum_ref_string_header** | [**StringEnumRef**](../Model/.md)| | [optional] |
| **enum_ref_string_header** | [**\OpenAPI\Client\Model\StringEnumRef**](../Model/.md)| | [optional] |

### Return type

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ $apiInstance = new OpenAPI\Client\Api\PathApi(
$path_string = 'path_string_example'; // string
$path_integer = 56; // int
$enum_nonref_string_path = 'enum_nonref_string_path_example'; // string
$enum_ref_string_path = new \OpenAPI\Client\Model\StringEnumRef(); // StringEnumRef
$enum_ref_string_path = new \OpenAPI\Client\Model\\OpenAPI\Client\Model\StringEnumRef(); // \OpenAPI\Client\Model\StringEnumRef

try {
$result = $apiInstance->testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath($path_string, $path_integer, $enum_nonref_string_path, $enum_ref_string_path);
Expand All @@ -50,7 +50,7 @@ try {
| **path_string** | **string**| | |
| **path_integer** | **int**| | |
| **enum_nonref_string_path** | **string**| | |
| **enum_ref_string_path** | [**StringEnumRef**](../Model/.md)| | |
| **enum_ref_string_path** | [**\OpenAPI\Client\Model\StringEnumRef**](../Model/.md)| | |

### Return type

Expand Down
24 changes: 12 additions & 12 deletions samples/client/echo_api/php-nextgen-streaming/docs/Api/QueryApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ $apiInstance = new OpenAPI\Client\Api\QueryApi(
new GuzzleHttp\Client()
);
$enum_nonref_string_query = 'enum_nonref_string_query_example'; // string
$enum_ref_string_query = new \OpenAPI\Client\Model\StringEnumRef(); // StringEnumRef
$enum_ref_string_query = new \OpenAPI\Client\Model\\OpenAPI\Client\Model\StringEnumRef(); // \OpenAPI\Client\Model\StringEnumRef

try {
$result = $apiInstance->testEnumRefString($enum_nonref_string_query, $enum_ref_string_query);
Expand All @@ -55,7 +55,7 @@ try {
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **enum_nonref_string_query** | **string**| | [optional] |
| **enum_ref_string_query** | [**StringEnumRef**](../Model/.md)| | [optional] |
| **enum_ref_string_query** | [**\OpenAPI\Client\Model\StringEnumRef**](../Model/.md)| | [optional] |

### Return type

Expand Down Expand Up @@ -217,7 +217,7 @@ $apiInstance = new OpenAPI\Client\Api\QueryApi(
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$query_object = new \OpenAPI\Client\Model\Pet(); // Pet
$query_object = new \OpenAPI\Client\Model\\OpenAPI\Client\Model\Pet(); // \OpenAPI\Client\Model\Pet

try {
$result = $apiInstance->testQueryStyleDeepObjectExplodeTrueObject($query_object);
Expand All @@ -231,7 +231,7 @@ try {

| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **query_object** | [**Pet**](../Model/.md)| | [optional] |
| **query_object** | [**\OpenAPI\Client\Model\Pet**](../Model/.md)| | [optional] |

### Return type

Expand Down Expand Up @@ -273,7 +273,7 @@ $apiInstance = new OpenAPI\Client\Api\QueryApi(
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$query_object = new \OpenAPI\Client\Model\TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(); // TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
$query_object = new \OpenAPI\Client\Model\\OpenAPI\Client\Model\TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(); // \OpenAPI\Client\Model\TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter

try {
$result = $apiInstance->testQueryStyleDeepObjectExplodeTrueObjectAllOf($query_object);
Expand All @@ -287,7 +287,7 @@ try {

| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **query_object** | [**TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter**](../Model/.md)| | [optional] |
| **query_object** | [**\OpenAPI\Client\Model\TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter**](../Model/.md)| | [optional] |

### Return type

Expand Down Expand Up @@ -441,7 +441,7 @@ $apiInstance = new OpenAPI\Client\Api\QueryApi(
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$query_object = new \OpenAPI\Client\Model\TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(); // TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
$query_object = new \OpenAPI\Client\Model\\OpenAPI\Client\Model\TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(); // \OpenAPI\Client\Model\TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter

try {
$result = $apiInstance->testQueryStyleFormExplodeTrueArrayString($query_object);
Expand All @@ -455,7 +455,7 @@ try {

| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **query_object** | [**TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter**](../Model/.md)| | [optional] |
| **query_object** | [**\OpenAPI\Client\Model\TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter**](../Model/.md)| | [optional] |

### Return type

Expand Down Expand Up @@ -497,7 +497,7 @@ $apiInstance = new OpenAPI\Client\Api\QueryApi(
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$query_object = new \OpenAPI\Client\Model\Pet(); // Pet
$query_object = new \OpenAPI\Client\Model\\OpenAPI\Client\Model\Pet(); // \OpenAPI\Client\Model\Pet

try {
$result = $apiInstance->testQueryStyleFormExplodeTrueObject($query_object);
Expand All @@ -511,7 +511,7 @@ try {

| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **query_object** | [**Pet**](../Model/.md)| | [optional] |
| **query_object** | [**\OpenAPI\Client\Model\Pet**](../Model/.md)| | [optional] |

### Return type

Expand Down Expand Up @@ -553,7 +553,7 @@ $apiInstance = new OpenAPI\Client\Api\QueryApi(
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$query_object = new \OpenAPI\Client\Model\DataQuery(); // DataQuery
$query_object = new \OpenAPI\Client\Model\\OpenAPI\Client\Model\DataQuery(); // \OpenAPI\Client\Model\DataQuery

try {
$result = $apiInstance->testQueryStyleFormExplodeTrueObjectAllOf($query_object);
Expand All @@ -567,7 +567,7 @@ try {

| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
| **query_object** | [**DataQuery**](../Model/.md)| | [optional] |
| **query_object** | [**\OpenAPI\Client\Model\DataQuery**](../Model/.md)| | [optional] |

### Return type

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function getConfig(): Configuration
* @param bool|null $boolean_header boolean_header (optional)
* @param string|null $string_header string_header (optional)
* @param string|null $enum_nonref_string_header enum_nonref_string_header (optional)
* @param StringEnumRef|null $enum_ref_string_header enum_ref_string_header (optional)
* @param \OpenAPI\Client\Model\StringEnumRef|null $enum_ref_string_header enum_ref_string_header (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testHeaderIntegerBooleanStringEnums'] to see the possible values for this operation
*
* @throws ApiException on non-2xx response or if the response body is not in the expected format
Expand All @@ -144,7 +144,7 @@ public function testHeaderIntegerBooleanStringEnums(
?bool $boolean_header = null,
?string $string_header = null,
?string $enum_nonref_string_header = null,
?StringEnumRef $enum_ref_string_header = null,
?\OpenAPI\Client\Model\StringEnumRef $enum_ref_string_header = null,
string $contentType = self::contentTypes['testHeaderIntegerBooleanStringEnums'][0]
): string
{
Expand All @@ -161,7 +161,7 @@ public function testHeaderIntegerBooleanStringEnums(
* @param bool|null $boolean_header (optional)
* @param string|null $string_header (optional)
* @param string|null $enum_nonref_string_header (optional)
* @param StringEnumRef|null $enum_ref_string_header (optional)
* @param \OpenAPI\Client\Model\StringEnumRef|null $enum_ref_string_header (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testHeaderIntegerBooleanStringEnums'] to see the possible values for this operation
*
* @throws ApiException on non-2xx response or if the response body is not in the expected format
Expand All @@ -173,7 +173,7 @@ public function testHeaderIntegerBooleanStringEnumsWithHttpInfo(
?bool $boolean_header = null,
?string $string_header = null,
?string $enum_nonref_string_header = null,
?StringEnumRef $enum_ref_string_header = null,
?\OpenAPI\Client\Model\StringEnumRef $enum_ref_string_header = null,
string $contentType = self::contentTypes['testHeaderIntegerBooleanStringEnums'][0]
): array
{
Expand Down Expand Up @@ -296,7 +296,7 @@ public function testHeaderIntegerBooleanStringEnumsWithHttpInfo(
* @param bool|null $boolean_header (optional)
* @param string|null $string_header (optional)
* @param string|null $enum_nonref_string_header (optional)
* @param StringEnumRef|null $enum_ref_string_header (optional)
* @param \OpenAPI\Client\Model\StringEnumRef|null $enum_ref_string_header (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testHeaderIntegerBooleanStringEnums'] to see the possible values for this operation
*
* @throws InvalidArgumentException
Expand All @@ -307,7 +307,7 @@ public function testHeaderIntegerBooleanStringEnumsAsync(
?bool $boolean_header = null,
?string $string_header = null,
?string $enum_nonref_string_header = null,
?StringEnumRef $enum_ref_string_header = null,
?\OpenAPI\Client\Model\StringEnumRef $enum_ref_string_header = null,
string $contentType = self::contentTypes['testHeaderIntegerBooleanStringEnums'][0]
): PromiseInterface
{
Expand All @@ -328,7 +328,7 @@ function ($response) {
* @param bool|null $boolean_header (optional)
* @param string|null $string_header (optional)
* @param string|null $enum_nonref_string_header (optional)
* @param StringEnumRef|null $enum_ref_string_header (optional)
* @param \OpenAPI\Client\Model\StringEnumRef|null $enum_ref_string_header (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testHeaderIntegerBooleanStringEnums'] to see the possible values for this operation
*
* @throws InvalidArgumentException
Expand Down Expand Up @@ -389,7 +389,7 @@ function ($exception) {
* @param bool|null $boolean_header (optional)
* @param string|null $string_header (optional)
* @param string|null $enum_nonref_string_header (optional)
* @param StringEnumRef|null $enum_ref_string_header (optional)
* @param \OpenAPI\Client\Model\StringEnumRef|null $enum_ref_string_header (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testHeaderIntegerBooleanStringEnums'] to see the possible values for this operation
*
* @throws InvalidArgumentException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function getConfig(): Configuration
* @param string $path_string path_string (required)
* @param int $path_integer path_integer (required)
* @param string $enum_nonref_string_path enum_nonref_string_path (required)
* @param StringEnumRef $enum_ref_string_path enum_ref_string_path (required)
* @param \OpenAPI\Client\Model\StringEnumRef $enum_ref_string_path enum_ref_string_path (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'] to see the possible values for this operation
*
* @throws ApiException on non-2xx response or if the response body is not in the expected format
Expand All @@ -142,7 +142,7 @@ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathE
string $path_string,
int $path_integer,
string $enum_nonref_string_path,
StringEnumRef $enum_ref_string_path,
\OpenAPI\Client\Model\StringEnumRef $enum_ref_string_path,
string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'][0]
): string
{
Expand All @@ -158,7 +158,7 @@ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathE
* @param string $path_string (required)
* @param int $path_integer (required)
* @param string $enum_nonref_string_path (required)
* @param StringEnumRef $enum_ref_string_path (required)
* @param \OpenAPI\Client\Model\StringEnumRef $enum_ref_string_path (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'] to see the possible values for this operation
*
* @throws ApiException on non-2xx response or if the response body is not in the expected format
Expand All @@ -169,7 +169,7 @@ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathE
string $path_string,
int $path_integer,
string $enum_nonref_string_path,
StringEnumRef $enum_ref_string_path,
\OpenAPI\Client\Model\StringEnumRef $enum_ref_string_path,
string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'][0]
): array
{
Expand Down Expand Up @@ -291,7 +291,7 @@ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathE
* @param string $path_string (required)
* @param int $path_integer (required)
* @param string $enum_nonref_string_path (required)
* @param StringEnumRef $enum_ref_string_path (required)
* @param \OpenAPI\Client\Model\StringEnumRef $enum_ref_string_path (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'] to see the possible values for this operation
*
* @throws InvalidArgumentException
Expand All @@ -301,7 +301,7 @@ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathE
string $path_string,
int $path_integer,
string $enum_nonref_string_path,
StringEnumRef $enum_ref_string_path,
\OpenAPI\Client\Model\StringEnumRef $enum_ref_string_path,
string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'][0]
): PromiseInterface
{
Expand All @@ -321,7 +321,7 @@ function ($response) {
* @param string $path_string (required)
* @param int $path_integer (required)
* @param string $enum_nonref_string_path (required)
* @param StringEnumRef $enum_ref_string_path (required)
* @param \OpenAPI\Client\Model\StringEnumRef $enum_ref_string_path (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'] to see the possible values for this operation
*
* @throws InvalidArgumentException
Expand Down Expand Up @@ -380,7 +380,7 @@ function ($exception) {
* @param string $path_string (required)
* @param int $path_integer (required)
* @param string $enum_nonref_string_path (required)
* @param StringEnumRef $enum_ref_string_path (required)
* @param \OpenAPI\Client\Model\StringEnumRef $enum_ref_string_path (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'] to see the possible values for this operation
*
* @throws InvalidArgumentException
Expand Down
Loading

0 comments on commit 78f2f70

Please sign in to comment.