mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-03 08:46:55 +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 |
|
||||
| ------ | ------------ | ----------- |
|
||||
| [**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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user