mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-03 00:43:46 +00:00
[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 |
|
||||
| ------ | ------------ | ----------- |
|
||||
| [**test_header_integer_boolean_string**](HeaderApi.md#test_header_integer_boolean_string) | **GET** /header/integer/boolean/string | Test header parameter(s) |
|
||||
| [**test_header_integer_boolean_string_enums**](HeaderApi.md#test_header_integer_boolean_string_enums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s) |
|
||||
|
||||
|
||||
## test_header_integer_boolean_string
|
||||
## test_header_integer_boolean_string_enums
|
||||
|
||||
> String test_header_integer_boolean_string(opts)
|
||||
> String test_header_integer_boolean_string_enums(opts)
|
||||
|
||||
Test header parameter(s)
|
||||
|
||||
@@ -25,33 +25,35 @@ api_instance = OpenapiClient::HeaderApi.new
|
||||
opts = {
|
||||
integer_header: 56, # Integer |
|
||||
boolean_header: true, # Boolean |
|
||||
string_header: 'string_header_example' # String |
|
||||
string_header: 'string_header_example', # String |
|
||||
enum_nonref_string_header: 'success', # String |
|
||||
enum_ref_string_header: OpenapiClient::StringEnumRef::SUCCESS # StringEnumRef |
|
||||
}
|
||||
|
||||
begin
|
||||
# Test header parameter(s)
|
||||
result = api_instance.test_header_integer_boolean_string(opts)
|
||||
result = api_instance.test_header_integer_boolean_string_enums(opts)
|
||||
p result
|
||||
rescue OpenapiClient::ApiError => e
|
||||
puts "Error when calling HeaderApi->test_header_integer_boolean_string: #{e}"
|
||||
puts "Error when calling HeaderApi->test_header_integer_boolean_string_enums: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
#### Using the test_header_integer_boolean_string_with_http_info variant
|
||||
#### Using the test_header_integer_boolean_string_enums_with_http_info variant
|
||||
|
||||
This returns an Array which contains the response data, status code and headers.
|
||||
|
||||
> <Array(String, Integer, Hash)> test_header_integer_boolean_string_with_http_info(opts)
|
||||
> <Array(String, Integer, Hash)> test_header_integer_boolean_string_enums_with_http_info(opts)
|
||||
|
||||
```ruby
|
||||
begin
|
||||
# Test header parameter(s)
|
||||
data, status_code, headers = api_instance.test_header_integer_boolean_string_with_http_info(opts)
|
||||
data, status_code, headers = api_instance.test_header_integer_boolean_string_enums_with_http_info(opts)
|
||||
p status_code # => 2xx
|
||||
p headers # => { ... }
|
||||
p data # => String
|
||||
rescue OpenapiClient::ApiError => e
|
||||
puts "Error when calling HeaderApi->test_header_integer_boolean_string_with_http_info: #{e}"
|
||||
puts "Error when calling HeaderApi->test_header_integer_boolean_string_enums_with_http_info: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -62,6 +64,8 @@ end
|
||||
| **integer_header** | **Integer** | | [optional] |
|
||||
| **boolean_header** | **Boolean** | | [optional] |
|
||||
| **string_header** | **String** | | [optional] |
|
||||
| **enum_nonref_string_header** | **String** | | [optional] |
|
||||
| **enum_ref_string_header** | [**StringEnumRef**](.md) | | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@ All URIs are relative to *http://localhost:3000*
|
||||
|
||||
| Method | HTTP request | Description |
|
||||
| ------ | ------------ | ----------- |
|
||||
| [**tests_path_string_path_string_integer_path_integer**](PathApi.md#tests_path_string_path_string_integer_path_integer) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s) |
|
||||
| [**tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path**](PathApi.md#tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) |
|
||||
|
||||
|
||||
## tests_path_string_path_string_integer_path_integer
|
||||
## tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path
|
||||
|
||||
> String tests_path_string_path_string_integer_path_integer(path_string, path_integer)
|
||||
> String tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path)
|
||||
|
||||
Test path parameter(s)
|
||||
|
||||
@@ -24,31 +24,33 @@ require 'openapi_client'
|
||||
api_instance = OpenapiClient::PathApi.new
|
||||
path_string = 'path_string_example' # String |
|
||||
path_integer = 56 # Integer |
|
||||
enum_nonref_string_path = 'success' # String |
|
||||
enum_ref_string_path = OpenapiClient::StringEnumRef::SUCCESS # StringEnumRef |
|
||||
|
||||
begin
|
||||
# Test path parameter(s)
|
||||
result = api_instance.tests_path_string_path_string_integer_path_integer(path_string, path_integer)
|
||||
result = api_instance.tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path)
|
||||
p result
|
||||
rescue OpenapiClient::ApiError => e
|
||||
puts "Error when calling PathApi->tests_path_string_path_string_integer_path_integer: #{e}"
|
||||
puts "Error when calling PathApi->tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
#### Using the tests_path_string_path_string_integer_path_integer_with_http_info variant
|
||||
#### Using the tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path_with_http_info variant
|
||||
|
||||
This returns an Array which contains the response data, status code and headers.
|
||||
|
||||
> <Array(String, Integer, Hash)> tests_path_string_path_string_integer_path_integer_with_http_info(path_string, path_integer)
|
||||
> <Array(String, Integer, Hash)> tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path_with_http_info(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path)
|
||||
|
||||
```ruby
|
||||
begin
|
||||
# Test path parameter(s)
|
||||
data, status_code, headers = api_instance.tests_path_string_path_string_integer_path_integer_with_http_info(path_string, path_integer)
|
||||
data, status_code, headers = api_instance.tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path_with_http_info(path_string, path_integer, enum_nonref_string_path, enum_ref_string_path)
|
||||
p status_code # => 2xx
|
||||
p headers # => { ... }
|
||||
p data # => String
|
||||
rescue OpenapiClient::ApiError => e
|
||||
puts "Error when calling PathApi->tests_path_string_path_string_integer_path_integer_with_http_info: #{e}"
|
||||
puts "Error when calling PathApi->tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path_with_http_info: #{e}"
|
||||
end
|
||||
```
|
||||
|
||||
@@ -58,6 +60,8 @@ end
|
||||
| ---- | ---- | ----------- | ----- |
|
||||
| **path_string** | **String** | | |
|
||||
| **path_integer** | **Integer** | | |
|
||||
| **enum_nonref_string_path** | **String** | | |
|
||||
| **enum_ref_string_path** | [**StringEnumRef**](.md) | | |
|
||||
|
||||
### Return type
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ require 'openapi_client'
|
||||
|
||||
api_instance = OpenapiClient::QueryApi.new
|
||||
opts = {
|
||||
enum_nonref_string_query: 'success', # String |
|
||||
enum_ref_string_query: OpenapiClient::StringEnumRef::SUCCESS # StringEnumRef |
|
||||
}
|
||||
|
||||
@@ -64,6 +65,7 @@ end
|
||||
|
||||
| Name | Type | Description | Notes |
|
||||
| ---- | ---- | ----------- | ----- |
|
||||
| **enum_nonref_string_query** | **String** | | [optional] |
|
||||
| **enum_ref_string_query** | [**StringEnumRef**](.md) | | [optional] |
|
||||
|
||||
### Return type
|
||||
|
||||
Reference in New Issue
Block a user