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:
@@ -4,12 +4,12 @@ All URIs are relative to *http://localhost:3000*
|
||||
|
||||
| Method | HTTP request | Description |
|
||||
|------------- | ------------- | -------------|
|
||||
| [**testHeaderIntegerBooleanString**](HeaderApi.md#testHeaderIntegerBooleanString) | **GET** /header/integer/boolean/string | Test header parameter(s) |
|
||||
| [**testHeaderIntegerBooleanStringEnums**](HeaderApi.md#testHeaderIntegerBooleanStringEnums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s) |
|
||||
|
||||
|
||||
<a id="testHeaderIntegerBooleanString"></a>
|
||||
# **testHeaderIntegerBooleanString**
|
||||
> String testHeaderIntegerBooleanString(integerHeader, booleanHeader, stringHeader)
|
||||
<a id="testHeaderIntegerBooleanStringEnums"></a>
|
||||
# **testHeaderIntegerBooleanStringEnums**
|
||||
> String testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader)
|
||||
|
||||
Test header parameter(s)
|
||||
|
||||
@@ -33,11 +33,13 @@ public class Example {
|
||||
Integer integerHeader = 56; // Integer |
|
||||
Boolean booleanHeader = true; // Boolean |
|
||||
String stringHeader = "stringHeader_example"; // String |
|
||||
String enumNonrefStringHeader = "success"; // String |
|
||||
StringEnumRef enumRefStringHeader = StringEnumRef.fromValue("success"); // StringEnumRef |
|
||||
try {
|
||||
String result = apiInstance.testHeaderIntegerBooleanString(integerHeader, booleanHeader, stringHeader);
|
||||
String result = apiInstance.testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling HeaderApi#testHeaderIntegerBooleanString");
|
||||
System.err.println("Exception when calling HeaderApi#testHeaderIntegerBooleanStringEnums");
|
||||
System.err.println("Status code: " + e.getCode());
|
||||
System.err.println("Reason: " + e.getResponseBody());
|
||||
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||
@@ -54,6 +56,8 @@ public class Example {
|
||||
| **integerHeader** | **Integer**| | [optional] |
|
||||
| **booleanHeader** | **Boolean**| | [optional] |
|
||||
| **stringHeader** | **String**| | [optional] |
|
||||
| **enumNonrefStringHeader** | **String**| | [optional] [enum: success, failure, unclassified] |
|
||||
| **enumRefStringHeader** | [**StringEnumRef**](.md)| | [optional] [enum: success, failure, unclassified] |
|
||||
|
||||
### Return type
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@ All URIs are relative to *http://localhost:3000*
|
||||
|
||||
| Method | HTTP request | Description |
|
||||
|------------- | ------------- | -------------|
|
||||
| [**testsPathStringPathStringIntegerPathInteger**](PathApi.md#testsPathStringPathStringIntegerPathInteger) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s) |
|
||||
| [**testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**](PathApi.md#testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) |
|
||||
|
||||
|
||||
<a id="testsPathStringPathStringIntegerPathInteger"></a>
|
||||
# **testsPathStringPathStringIntegerPathInteger**
|
||||
> String testsPathStringPathStringIntegerPathInteger(pathString, pathInteger)
|
||||
<a id="testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath"></a>
|
||||
# **testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**
|
||||
> String testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath)
|
||||
|
||||
Test path parameter(s)
|
||||
|
||||
@@ -32,11 +32,13 @@ public class Example {
|
||||
PathApi apiInstance = new PathApi(defaultClient);
|
||||
String pathString = "pathString_example"; // String |
|
||||
Integer pathInteger = 56; // Integer |
|
||||
String enumNonrefStringPath = "success"; // String |
|
||||
StringEnumRef enumRefStringPath = StringEnumRef.fromValue("success"); // StringEnumRef |
|
||||
try {
|
||||
String result = apiInstance.testsPathStringPathStringIntegerPathInteger(pathString, pathInteger);
|
||||
String result = apiInstance.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling PathApi#testsPathStringPathStringIntegerPathInteger");
|
||||
System.err.println("Exception when calling PathApi#testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath");
|
||||
System.err.println("Status code: " + e.getCode());
|
||||
System.err.println("Reason: " + e.getResponseBody());
|
||||
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||
@@ -52,6 +54,8 @@ public class Example {
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **pathString** | **String**| | |
|
||||
| **pathInteger** | **Integer**| | |
|
||||
| **enumNonrefStringPath** | **String**| | [enum: success, failure, unclassified] |
|
||||
| **enumRefStringPath** | [**StringEnumRef**](.md)| | [enum: success, failure, unclassified] |
|
||||
|
||||
### Return type
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ All URIs are relative to *http://localhost:3000*
|
||||
|
||||
<a id="testEnumRefString"></a>
|
||||
# **testEnumRefString**
|
||||
> String testEnumRefString(enumRefStringQuery)
|
||||
> String testEnumRefString(enumNonrefStringQuery, enumRefStringQuery)
|
||||
|
||||
Test query parameter(s)
|
||||
|
||||
@@ -37,9 +37,10 @@ public class Example {
|
||||
defaultClient.setBasePath("http://localhost:3000");
|
||||
|
||||
QueryApi apiInstance = new QueryApi(defaultClient);
|
||||
String enumNonrefStringQuery = "success"; // String |
|
||||
StringEnumRef enumRefStringQuery = StringEnumRef.fromValue("success"); // StringEnumRef |
|
||||
try {
|
||||
String result = apiInstance.testEnumRefString(enumRefStringQuery);
|
||||
String result = apiInstance.testEnumRefString(enumNonrefStringQuery, enumRefStringQuery);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling QueryApi#testEnumRefString");
|
||||
@@ -56,6 +57,7 @@ public class Example {
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
|------------- | ------------- | ------------- | -------------|
|
||||
| **enumNonrefStringQuery** | **String**| | [optional] [enum: success, failure, unclassified] |
|
||||
| **enumRefStringQuery** | [**StringEnumRef**](.md)| | [optional] [enum: success, failure, unclassified] |
|
||||
|
||||
### Return type
|
||||
|
||||
Reference in New Issue
Block a user