Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for query parameters (array of integer/string) #17686

Merged
merged 4 commits into from
Jan 24, 2024
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
46 changes: 46 additions & 0 deletions modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,52 @@ paths:
text/plain:
schema:
type: string
/query/style_form/explode_false/array_integer:
get:
tags:
- query
summary: Test query parameter(s)
description: Test query parameter(s)
operationId: test/query/style_form/explode_false/array_integer
parameters:
- in: query
name: query_object
style: form #default
explode: false
schema:
type: array
items:
type: integer
responses:
'200':
description: Successful operation
content:
text/plain:
schema:
type: string
/query/style_form/explode_false/array_string:
get:
tags:
- query
summary: Test query parameter(s)
description: Test query parameter(s)
operationId: test/query/style_form/explode_false/array_string
parameters:
- in: query
name: query_object
style: form #default
explode: false
schema:
type: array
items:
type: string
responses:
'200':
description: Successful operation
content:
text/plain:
schema:
type: string
/query/style_form/explode_true/object:
get:
tags:
Expand Down
2 changes: 2 additions & 0 deletions samples/client/echo_api/csharp-restsharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ Class | Method | HTTP request | Description
*QueryApi* | [**TestQueryIntegerBooleanString**](docs/QueryApi.md#testqueryintegerbooleanstring) | **GET** /query/integer/boolean/string | Test query parameter(s)
*QueryApi* | [**TestQueryStyleDeepObjectExplodeTrueObject**](docs/QueryApi.md#testquerystyledeepobjectexplodetrueobject) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s)
*QueryApi* | [**TestQueryStyleDeepObjectExplodeTrueObjectAllOf**](docs/QueryApi.md#testquerystyledeepobjectexplodetrueobjectallof) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s)
*QueryApi* | [**TestQueryStyleFormExplodeFalseArrayInteger**](docs/QueryApi.md#testquerystyleformexplodefalsearrayinteger) | **GET** /query/style_form/explode_false/array_integer | Test query parameter(s)
*QueryApi* | [**TestQueryStyleFormExplodeFalseArrayString**](docs/QueryApi.md#testquerystyleformexplodefalsearraystring) | **GET** /query/style_form/explode_false/array_string | Test query parameter(s)
*QueryApi* | [**TestQueryStyleFormExplodeTrueArrayString**](docs/QueryApi.md#testquerystyleformexplodetruearraystring) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s)
*QueryApi* | [**TestQueryStyleFormExplodeTrueObject**](docs/QueryApi.md#testquerystyleformexplodetrueobject) | **GET** /query/style_form/explode_true/object | Test query parameter(s)
*QueryApi* | [**TestQueryStyleFormExplodeTrueObjectAllOf**](docs/QueryApi.md#testquerystyleformexplodetrueobjectallof) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s)
Expand Down
48 changes: 48 additions & 0 deletions samples/client/echo_api/csharp-restsharp/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,54 @@ paths:
summary: Test query parameter(s)
tags:
- query
/query/style_form/explode_false/array_integer:
get:
description: Test query parameter(s)
operationId: test/query/style_form/explode_false/array_integer
parameters:
- explode: false
in: query
name: query_object
required: false
schema:
items:
type: integer
type: array
style: form
responses:
"200":
content:
text/plain:
schema:
type: string
description: Successful operation
summary: Test query parameter(s)
tags:
- query
/query/style_form/explode_false/array_string:
get:
description: Test query parameter(s)
operationId: test/query/style_form/explode_false/array_string
parameters:
- explode: false
in: query
name: query_object
required: false
schema:
items:
type: string
type: array
style: form
responses:
"200":
content:
text/plain:
schema:
type: string
description: Successful operation
summary: Test query parameter(s)
tags:
- query
/query/style_form/explode_true/object:
get:
description: Test query parameter(s)
Expand Down
184 changes: 184 additions & 0 deletions samples/client/echo_api/csharp-restsharp/docs/QueryApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ All URIs are relative to *http://localhost:3000*
| [**TestQueryIntegerBooleanString**](QueryApi.md#testqueryintegerbooleanstring) | **GET** /query/integer/boolean/string | Test query parameter(s) |
| [**TestQueryStyleDeepObjectExplodeTrueObject**](QueryApi.md#testquerystyledeepobjectexplodetrueobject) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s) |
| [**TestQueryStyleDeepObjectExplodeTrueObjectAllOf**](QueryApi.md#testquerystyledeepobjectexplodetrueobjectallof) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s) |
| [**TestQueryStyleFormExplodeFalseArrayInteger**](QueryApi.md#testquerystyleformexplodefalsearrayinteger) | **GET** /query/style_form/explode_false/array_integer | Test query parameter(s) |
| [**TestQueryStyleFormExplodeFalseArrayString**](QueryApi.md#testquerystyleformexplodefalsearraystring) | **GET** /query/style_form/explode_false/array_string | Test query parameter(s) |
| [**TestQueryStyleFormExplodeTrueArrayString**](QueryApi.md#testquerystyleformexplodetruearraystring) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) |
| [**TestQueryStyleFormExplodeTrueObject**](QueryApi.md#testquerystyleformexplodetrueobject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) |
| [**TestQueryStyleFormExplodeTrueObjectAllOf**](QueryApi.md#testquerystyleformexplodetrueobjectallof) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s) |
Expand Down Expand Up @@ -471,6 +473,188 @@ No authorization required
- **Accept**: text/plain


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

<a id="testquerystyleformexplodefalsearrayinteger"></a>
# **TestQueryStyleFormExplodeFalseArrayInteger**
> string TestQueryStyleFormExplodeFalseArrayInteger (List<int>? queryObject = null)

Test query parameter(s)

Test query parameter(s)

### Example
```csharp
using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
public class TestQueryStyleFormExplodeFalseArrayIntegerExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://localhost:3000";
var apiInstance = new QueryApi(config);
var queryObject = new List<int>?(); // List<int>? | (optional)

try
{
// Test query parameter(s)
string result = apiInstance.TestQueryStyleFormExplodeFalseArrayInteger(queryObject);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling QueryApi.TestQueryStyleFormExplodeFalseArrayInteger: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```

#### Using the TestQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.

```csharp
try
{
// Test query parameter(s)
ApiResponse<string> response = apiInstance.TestQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo(queryObject);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling QueryApi.TestQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```

### Parameters

| Name | Type | Description | Notes |
|------|------|-------------|-------|
| **queryObject** | [**List&lt;int&gt;?**](int.md) | | [optional] |

### Return type

**string**

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: text/plain


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

<a id="testquerystyleformexplodefalsearraystring"></a>
# **TestQueryStyleFormExplodeFalseArrayString**
> string TestQueryStyleFormExplodeFalseArrayString (List<string>? queryObject = null)

Test query parameter(s)

Test query parameter(s)

### Example
```csharp
using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
public class TestQueryStyleFormExplodeFalseArrayStringExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "http://localhost:3000";
var apiInstance = new QueryApi(config);
var queryObject = new List<string>?(); // List<string>? | (optional)

try
{
// Test query parameter(s)
string result = apiInstance.TestQueryStyleFormExplodeFalseArrayString(queryObject);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling QueryApi.TestQueryStyleFormExplodeFalseArrayString: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```

#### Using the TestQueryStyleFormExplodeFalseArrayStringWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.

```csharp
try
{
// Test query parameter(s)
ApiResponse<string> response = apiInstance.TestQueryStyleFormExplodeFalseArrayStringWithHttpInfo(queryObject);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling QueryApi.TestQueryStyleFormExplodeFalseArrayStringWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```

### Parameters

| Name | Type | Description | Notes |
|------|------|-------------|-------|
| **queryObject** | [**List&lt;string&gt;?**](string.md) | | [optional] |

### Return type

**string**

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: text/plain


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
Expand Down
Loading
Loading