Skip to content

Commit 54c26f9

Browse files
author
Jonathan Wehrle
committed
add echo test for enum json response deserialization (python)
1 parent a3e8930 commit 54c26f9

File tree

11 files changed

+927
-0
lines changed

11 files changed

+927
-0
lines changed

modules/openapi-generator/src/test/resources/3_0/echo_api.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,26 @@ paths:
544544
text/plain:
545545
schema:
546546
type: string
547+
/echo/body/string_enum:
548+
post:
549+
tags:
550+
- body
551+
summary: Test string enum response body
552+
description: Test string enum response body
553+
operationId: test/echo/body/string_enum
554+
requestBody:
555+
content:
556+
application/json:
557+
schema:
558+
$ref: '#/components/schemas/StringEnumRef'
559+
description: String enum
560+
responses:
561+
'200':
562+
description: Successful operation
563+
content:
564+
application/json:
565+
schema:
566+
$ref: '#/components/schemas/StringEnumRef'
547567
/binary/gif:
548568
post:
549569
tags:

samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ Class | Method | HTTP request | Description
103103
*BodyApi* | [**test_echo_body_free_form_object_response_string**](docs/BodyApi.md#test_echo_body_free_form_object_response_string) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
104104
*BodyApi* | [**test_echo_body_pet**](docs/BodyApi.md#test_echo_body_pet) | **POST** /echo/body/Pet | Test body parameter(s)
105105
*BodyApi* | [**test_echo_body_pet_response_string**](docs/BodyApi.md#test_echo_body_pet_response_string) | **POST** /echo/body/Pet/response_string | Test empty response body
106+
*BodyApi* | [**test_echo_body_string_enum**](docs/BodyApi.md#test_echo_body_string_enum) | **POST** /echo/body/string_enum | Test string enum response body
106107
*BodyApi* | [**test_echo_body_tag_response_string**](docs/BodyApi.md#test_echo_body_tag_response_string) | **POST** /echo/body/Tag/response_string | Test empty json (request body)
107108
*FormApi* | [**test_form_integer_boolean_string**](docs/FormApi.md#test_form_integer_boolean_string) | **POST** /form/integer/boolean/string | Test form parameter(s)
108109
*FormApi* | [**test_form_oneof**](docs/FormApi.md#test_form_oneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema

samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/docs/BodyApi.md

+69
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Method | HTTP request | Description
1212
[**test_echo_body_free_form_object_response_string**](BodyApi.md#test_echo_body_free_form_object_response_string) | **POST** /echo/body/FreeFormObject/response_string | Test free form object
1313
[**test_echo_body_pet**](BodyApi.md#test_echo_body_pet) | **POST** /echo/body/Pet | Test body parameter(s)
1414
[**test_echo_body_pet_response_string**](BodyApi.md#test_echo_body_pet_response_string) | **POST** /echo/body/Pet/response_string | Test empty response body
15+
[**test_echo_body_string_enum**](BodyApi.md#test_echo_body_string_enum) | **POST** /echo/body/string_enum | Test string enum response body
1516
[**test_echo_body_tag_response_string**](BodyApi.md#test_echo_body_tag_response_string) | **POST** /echo/body/Tag/response_string | Test empty json (request body)
1617

1718

@@ -550,6 +551,74 @@ No authorization required
550551

551552
[[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)
552553

554+
# **test_echo_body_string_enum**
555+
> StringEnumRef test_echo_body_string_enum(body=body)
556+
557+
Test string enum response body
558+
559+
Test string enum response body
560+
561+
### Example
562+
563+
564+
```python
565+
import openapi_client
566+
from openapi_client.models.string_enum_ref import StringEnumRef
567+
from openapi_client.rest import ApiException
568+
from pprint import pprint
569+
570+
# Defining the host is optional and defaults to http://localhost:3000
571+
# See configuration.py for a list of all supported configuration parameters.
572+
configuration = openapi_client.Configuration(
573+
host = "http://localhost:3000"
574+
)
575+
576+
577+
# Enter a context with an instance of the API client
578+
with openapi_client.ApiClient(configuration) as api_client:
579+
# Create an instance of the API class
580+
api_instance = openapi_client.BodyApi(api_client)
581+
body = 'body_example' # str | String enum (optional)
582+
583+
try:
584+
# Test string enum response body
585+
api_response = api_instance.test_echo_body_string_enum(body=body)
586+
print("The response of BodyApi->test_echo_body_string_enum:\n")
587+
pprint(api_response)
588+
except Exception as e:
589+
print("Exception when calling BodyApi->test_echo_body_string_enum: %s\n" % e)
590+
```
591+
592+
593+
594+
### Parameters
595+
596+
597+
Name | Type | Description | Notes
598+
------------- | ------------- | ------------- | -------------
599+
**body** | **str**| String enum | [optional]
600+
601+
### Return type
602+
603+
[**StringEnumRef**](StringEnumRef.md)
604+
605+
### Authorization
606+
607+
No authorization required
608+
609+
### HTTP request headers
610+
611+
- **Content-Type**: application/json
612+
- **Accept**: application/json
613+
614+
### HTTP response details
615+
616+
| Status code | Description | Response headers |
617+
|-------------|-------------|------------------|
618+
**200** | Successful operation | - |
619+
620+
[[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)
621+
553622
# **test_echo_body_tag_response_string**
554623
> str test_echo_body_tag_response_string(tag=tag)
555624

0 commit comments

Comments
 (0)