mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-03 06:00:52 +00:00
Update model_generic.mustache, tuple notation breaks when there is only one element in the tuple (#17749)
* Update model_generic.mustache, tuple notation breaks when there is only one element in the tuple In this excerpt of the mustache template, the matching behaviour is bugged when there is only one element in the tuple notation. A single string with the tuple notation, e.g., `("string")`, will result in a string, and when values are compared with the string, it will do a `contains` match instead of an exact match, which is unintended behaviour. * Update with samples, step 3 * Add test spec and regenerate samples * Update samples * Update spec and samples * update samples --------- Co-authored-by: Edmund Loo <edmundloo@users.noreply.github.com> Co-authored-by: Edmund Loo <github.yn0u9@simplelogin.com>
This commit is contained in:
parent
6ec4ed0b69
commit
c9204c4330
@ -64,11 +64,11 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
|
|||||||
{{/required}}
|
{{/required}}
|
||||||
{{#isArray}}
|
{{#isArray}}
|
||||||
for i in value:
|
for i in value:
|
||||||
if i not in ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}):
|
if i not in set([{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}]):
|
||||||
raise ValueError("each list item must be one of ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}})")
|
raise ValueError("each list item must be one of ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}})")
|
||||||
{{/isArray}}
|
{{/isArray}}
|
||||||
{{^isArray}}
|
{{^isArray}}
|
||||||
if value not in ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}):
|
if value not in set([{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}]):
|
||||||
raise ValueError("must be one of enum values ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}})")
|
raise ValueError("must be one of enum values ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}})")
|
||||||
{{/isArray}}
|
{{/isArray}}
|
||||||
return value
|
return value
|
||||||
|
@ -1579,6 +1579,67 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
xml:
|
xml:
|
||||||
name: Tag
|
name: Tag
|
||||||
|
PoopCleaning:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
task_name:
|
||||||
|
type: string
|
||||||
|
enum: [cleaning]
|
||||||
|
function_name:
|
||||||
|
type: string
|
||||||
|
enum: [care]
|
||||||
|
content:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- task_name
|
||||||
|
- function_name
|
||||||
|
- content
|
||||||
|
Feeding:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
task_name:
|
||||||
|
type: string
|
||||||
|
enum: [cleaning]
|
||||||
|
function_name:
|
||||||
|
type: string
|
||||||
|
enum: [care_nourish]
|
||||||
|
content:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- task_name
|
||||||
|
- function_name
|
||||||
|
- content
|
||||||
|
Bathing:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
task_name:
|
||||||
|
type: string
|
||||||
|
enum: [cleaning_deep]
|
||||||
|
function_name:
|
||||||
|
type: string
|
||||||
|
enum: [care_nourish]
|
||||||
|
content:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- task_name
|
||||||
|
- function_name
|
||||||
|
- content
|
||||||
|
Task:
|
||||||
|
title: Task
|
||||||
|
type: object
|
||||||
|
description: Used to test oneOf enums with only one string value.
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
format: uuid
|
||||||
|
activity:
|
||||||
|
oneOf:
|
||||||
|
- $ref: '#/components/schemas/PoopCleaning'
|
||||||
|
- $ref: '#/components/schemas/Feeding'
|
||||||
|
- $ref: '#/components/schemas/Bathing'
|
||||||
|
required:
|
||||||
|
- id
|
||||||
|
- activity
|
||||||
Pet:
|
Pet:
|
||||||
type: object
|
type: object
|
||||||
required:
|
required:
|
||||||
|
@ -45,7 +45,7 @@ class DefaultValue(BaseModel):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
for i in value:
|
for i in value:
|
||||||
if i not in ('success', 'failure', 'unclassified'):
|
if i not in set(['success', 'failure', 'unclassified']):
|
||||||
raise ValueError("each list item must be one of ('success', 'failure', 'unclassified')")
|
raise ValueError("each list item must be one of ('success', 'failure', 'unclassified')")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ class Pet(BaseModel):
|
|||||||
if value is None:
|
if value is None:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
if value not in ('available', 'pending', 'sold'):
|
if value not in set(['available', 'pending', 'sold']):
|
||||||
raise ValueError("must be one of enum values ('available', 'pending', 'sold')")
|
raise ValueError("must be one of enum values ('available', 'pending', 'sold')")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class Query(BaseModel):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
for i in value:
|
for i in value:
|
||||||
if i not in ('SUCCESS', 'FAILURE', 'SKIPPED'):
|
if i not in set(['SUCCESS', 'FAILURE', 'SKIPPED']):
|
||||||
raise ValueError("each list item must be one of ('SUCCESS', 'FAILURE', 'SKIPPED')")
|
raise ValueError("each list item must be one of ('SUCCESS', 'FAILURE', 'SKIPPED')")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ class DefaultValue(BaseModel):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
for i in value:
|
for i in value:
|
||||||
if i not in ('success', 'failure', 'unclassified'):
|
if i not in set(['success', 'failure', 'unclassified']):
|
||||||
raise ValueError("each list item must be one of ('success', 'failure', 'unclassified')")
|
raise ValueError("each list item must be one of ('success', 'failure', 'unclassified')")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ class Pet(BaseModel):
|
|||||||
if value is None:
|
if value is None:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
if value not in ('available', 'pending', 'sold'):
|
if value not in set(['available', 'pending', 'sold']):
|
||||||
raise ValueError("must be one of enum values ('available', 'pending', 'sold')")
|
raise ValueError("must be one of enum values ('available', 'pending', 'sold')")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class Query(BaseModel):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
for i in value:
|
for i in value:
|
||||||
if i not in ('SUCCESS', 'FAILURE', 'SKIPPED'):
|
if i not in set(['SUCCESS', 'FAILURE', 'SKIPPED']):
|
||||||
raise ValueError("each list item must be one of ('SUCCESS', 'FAILURE', 'SKIPPED')")
|
raise ValueError("each list item must be one of ('SUCCESS', 'FAILURE', 'SKIPPED')")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ docs/ArrayOfArrayOfNumberOnly.md
|
|||||||
docs/ArrayOfNumberOnly.md
|
docs/ArrayOfNumberOnly.md
|
||||||
docs/ArrayTest.md
|
docs/ArrayTest.md
|
||||||
docs/BasquePig.md
|
docs/BasquePig.md
|
||||||
|
docs/Bathing.md
|
||||||
docs/Capitalization.md
|
docs/Capitalization.md
|
||||||
docs/Cat.md
|
docs/Cat.md
|
||||||
docs/Category.md
|
docs/Category.md
|
||||||
@ -38,6 +39,7 @@ docs/EnumString2.md
|
|||||||
docs/EnumTest.md
|
docs/EnumTest.md
|
||||||
docs/FakeApi.md
|
docs/FakeApi.md
|
||||||
docs/FakeClassnameTags123Api.md
|
docs/FakeClassnameTags123Api.md
|
||||||
|
docs/Feeding.md
|
||||||
docs/File.md
|
docs/File.md
|
||||||
docs/FileSchemaTestClass.md
|
docs/FileSchemaTestClass.md
|
||||||
docs/FirstRef.md
|
docs/FirstRef.md
|
||||||
@ -74,6 +76,7 @@ docs/ParentWithOptionalDict.md
|
|||||||
docs/Pet.md
|
docs/Pet.md
|
||||||
docs/PetApi.md
|
docs/PetApi.md
|
||||||
docs/Pig.md
|
docs/Pig.md
|
||||||
|
docs/PoopCleaning.md
|
||||||
docs/PropertyNameCollision.md
|
docs/PropertyNameCollision.md
|
||||||
docs/ReadOnlyFirst.md
|
docs/ReadOnlyFirst.md
|
||||||
docs/SecondRef.md
|
docs/SecondRef.md
|
||||||
@ -84,6 +87,8 @@ docs/SpecialModelName.md
|
|||||||
docs/SpecialName.md
|
docs/SpecialName.md
|
||||||
docs/StoreApi.md
|
docs/StoreApi.md
|
||||||
docs/Tag.md
|
docs/Tag.md
|
||||||
|
docs/Task.md
|
||||||
|
docs/TaskActivity.md
|
||||||
docs/TestErrorResponsesWithModel400Response.md
|
docs/TestErrorResponsesWithModel400Response.md
|
||||||
docs/TestErrorResponsesWithModel404Response.md
|
docs/TestErrorResponsesWithModel404Response.md
|
||||||
docs/TestInlineFreeformAdditionalPropertiesRequest.md
|
docs/TestInlineFreeformAdditionalPropertiesRequest.md
|
||||||
@ -121,6 +126,7 @@ petstore_api/models/array_of_array_of_number_only.py
|
|||||||
petstore_api/models/array_of_number_only.py
|
petstore_api/models/array_of_number_only.py
|
||||||
petstore_api/models/array_test.py
|
petstore_api/models/array_test.py
|
||||||
petstore_api/models/basque_pig.py
|
petstore_api/models/basque_pig.py
|
||||||
|
petstore_api/models/bathing.py
|
||||||
petstore_api/models/capitalization.py
|
petstore_api/models/capitalization.py
|
||||||
petstore_api/models/cat.py
|
petstore_api/models/cat.py
|
||||||
petstore_api/models/category.py
|
petstore_api/models/category.py
|
||||||
@ -139,6 +145,7 @@ petstore_api/models/enum_class.py
|
|||||||
petstore_api/models/enum_string1.py
|
petstore_api/models/enum_string1.py
|
||||||
petstore_api/models/enum_string2.py
|
petstore_api/models/enum_string2.py
|
||||||
petstore_api/models/enum_test.py
|
petstore_api/models/enum_test.py
|
||||||
|
petstore_api/models/feeding.py
|
||||||
petstore_api/models/file.py
|
petstore_api/models/file.py
|
||||||
petstore_api/models/file_schema_test_class.py
|
petstore_api/models/file_schema_test_class.py
|
||||||
petstore_api/models/first_ref.py
|
petstore_api/models/first_ref.py
|
||||||
@ -174,6 +181,7 @@ petstore_api/models/parent.py
|
|||||||
petstore_api/models/parent_with_optional_dict.py
|
petstore_api/models/parent_with_optional_dict.py
|
||||||
petstore_api/models/pet.py
|
petstore_api/models/pet.py
|
||||||
petstore_api/models/pig.py
|
petstore_api/models/pig.py
|
||||||
|
petstore_api/models/poop_cleaning.py
|
||||||
petstore_api/models/property_name_collision.py
|
petstore_api/models/property_name_collision.py
|
||||||
petstore_api/models/read_only_first.py
|
petstore_api/models/read_only_first.py
|
||||||
petstore_api/models/second_ref.py
|
petstore_api/models/second_ref.py
|
||||||
@ -183,6 +191,8 @@ petstore_api/models/special_character_enum.py
|
|||||||
petstore_api/models/special_model_name.py
|
petstore_api/models/special_model_name.py
|
||||||
petstore_api/models/special_name.py
|
petstore_api/models/special_name.py
|
||||||
petstore_api/models/tag.py
|
petstore_api/models/tag.py
|
||||||
|
petstore_api/models/task.py
|
||||||
|
petstore_api/models/task_activity.py
|
||||||
petstore_api/models/test_error_responses_with_model400_response.py
|
petstore_api/models/test_error_responses_with_model400_response.py
|
||||||
petstore_api/models/test_error_responses_with_model404_response.py
|
petstore_api/models/test_error_responses_with_model404_response.py
|
||||||
petstore_api/models/test_inline_freeform_additional_properties_request.py
|
petstore_api/models/test_inline_freeform_additional_properties_request.py
|
||||||
|
@ -152,6 +152,7 @@ Class | Method | HTTP request | Description
|
|||||||
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
||||||
- [ArrayTest](docs/ArrayTest.md)
|
- [ArrayTest](docs/ArrayTest.md)
|
||||||
- [BasquePig](docs/BasquePig.md)
|
- [BasquePig](docs/BasquePig.md)
|
||||||
|
- [Bathing](docs/Bathing.md)
|
||||||
- [Capitalization](docs/Capitalization.md)
|
- [Capitalization](docs/Capitalization.md)
|
||||||
- [Cat](docs/Cat.md)
|
- [Cat](docs/Cat.md)
|
||||||
- [Category](docs/Category.md)
|
- [Category](docs/Category.md)
|
||||||
@ -170,6 +171,7 @@ Class | Method | HTTP request | Description
|
|||||||
- [EnumString1](docs/EnumString1.md)
|
- [EnumString1](docs/EnumString1.md)
|
||||||
- [EnumString2](docs/EnumString2.md)
|
- [EnumString2](docs/EnumString2.md)
|
||||||
- [EnumTest](docs/EnumTest.md)
|
- [EnumTest](docs/EnumTest.md)
|
||||||
|
- [Feeding](docs/Feeding.md)
|
||||||
- [File](docs/File.md)
|
- [File](docs/File.md)
|
||||||
- [FileSchemaTestClass](docs/FileSchemaTestClass.md)
|
- [FileSchemaTestClass](docs/FileSchemaTestClass.md)
|
||||||
- [FirstRef](docs/FirstRef.md)
|
- [FirstRef](docs/FirstRef.md)
|
||||||
@ -205,6 +207,7 @@ Class | Method | HTTP request | Description
|
|||||||
- [ParentWithOptionalDict](docs/ParentWithOptionalDict.md)
|
- [ParentWithOptionalDict](docs/ParentWithOptionalDict.md)
|
||||||
- [Pet](docs/Pet.md)
|
- [Pet](docs/Pet.md)
|
||||||
- [Pig](docs/Pig.md)
|
- [Pig](docs/Pig.md)
|
||||||
|
- [PoopCleaning](docs/PoopCleaning.md)
|
||||||
- [PropertyNameCollision](docs/PropertyNameCollision.md)
|
- [PropertyNameCollision](docs/PropertyNameCollision.md)
|
||||||
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
||||||
- [SecondRef](docs/SecondRef.md)
|
- [SecondRef](docs/SecondRef.md)
|
||||||
@ -214,6 +217,8 @@ Class | Method | HTTP request | Description
|
|||||||
- [SpecialModelName](docs/SpecialModelName.md)
|
- [SpecialModelName](docs/SpecialModelName.md)
|
||||||
- [SpecialName](docs/SpecialName.md)
|
- [SpecialName](docs/SpecialName.md)
|
||||||
- [Tag](docs/Tag.md)
|
- [Tag](docs/Tag.md)
|
||||||
|
- [Task](docs/Task.md)
|
||||||
|
- [TaskActivity](docs/TaskActivity.md)
|
||||||
- [TestErrorResponsesWithModel400Response](docs/TestErrorResponsesWithModel400Response.md)
|
- [TestErrorResponsesWithModel400Response](docs/TestErrorResponsesWithModel400Response.md)
|
||||||
- [TestErrorResponsesWithModel404Response](docs/TestErrorResponsesWithModel404Response.md)
|
- [TestErrorResponsesWithModel404Response](docs/TestErrorResponsesWithModel404Response.md)
|
||||||
- [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md)
|
- [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md)
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
# Bathing
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**task_name** | **str** | |
|
||||||
|
**function_name** | **str** | |
|
||||||
|
**content** | **str** | |
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.bathing import Bathing
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of Bathing from a JSON string
|
||||||
|
bathing_instance = Bathing.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print Bathing.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
bathing_dict = bathing_instance.to_dict()
|
||||||
|
# create an instance of Bathing from a dict
|
||||||
|
bathing_form_dict = bathing.from_dict(bathing_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
|||||||
|
# Feeding
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**task_name** | **str** | |
|
||||||
|
**function_name** | **str** | |
|
||||||
|
**content** | **str** | |
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.feeding import Feeding
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of Feeding from a JSON string
|
||||||
|
feeding_instance = Feeding.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print Feeding.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
feeding_dict = feeding_instance.to_dict()
|
||||||
|
# create an instance of Feeding from a dict
|
||||||
|
feeding_form_dict = feeding.from_dict(feeding_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
|||||||
|
# PoopCleaning
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**task_name** | **str** | |
|
||||||
|
**function_name** | **str** | |
|
||||||
|
**content** | **str** | |
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.poop_cleaning import PoopCleaning
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of PoopCleaning from a JSON string
|
||||||
|
poop_cleaning_instance = PoopCleaning.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print PoopCleaning.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
poop_cleaning_dict = poop_cleaning_instance.to_dict()
|
||||||
|
# create an instance of PoopCleaning from a dict
|
||||||
|
poop_cleaning_form_dict = poop_cleaning.from_dict(poop_cleaning_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
31
samples/openapi3/client/petstore/python-aiohttp/docs/Task.md
Normal file
31
samples/openapi3/client/petstore/python-aiohttp/docs/Task.md
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# Task
|
||||||
|
|
||||||
|
Used to test oneOf enums with only one string value.
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**id** | **str** | |
|
||||||
|
**activity** | [**TaskActivity**](TaskActivity.md) | |
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.task import Task
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of Task from a JSON string
|
||||||
|
task_instance = Task.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print Task.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
task_dict = task_instance.to_dict()
|
||||||
|
# create an instance of Task from a dict
|
||||||
|
task_form_dict = task.from_dict(task_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
|||||||
|
# TaskActivity
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**task_name** | **str** | |
|
||||||
|
**function_name** | **str** | |
|
||||||
|
**content** | **str** | |
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.task_activity import TaskActivity
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of TaskActivity from a JSON string
|
||||||
|
task_activity_instance = TaskActivity.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print TaskActivity.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
task_activity_dict = task_activity_instance.to_dict()
|
||||||
|
# create an instance of TaskActivity from a dict
|
||||||
|
task_activity_form_dict = task_activity.from_dict(task_activity_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -51,6 +51,7 @@ from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumb
|
|||||||
from petstore_api.models.array_of_number_only import ArrayOfNumberOnly
|
from petstore_api.models.array_of_number_only import ArrayOfNumberOnly
|
||||||
from petstore_api.models.array_test import ArrayTest
|
from petstore_api.models.array_test import ArrayTest
|
||||||
from petstore_api.models.basque_pig import BasquePig
|
from petstore_api.models.basque_pig import BasquePig
|
||||||
|
from petstore_api.models.bathing import Bathing
|
||||||
from petstore_api.models.capitalization import Capitalization
|
from petstore_api.models.capitalization import Capitalization
|
||||||
from petstore_api.models.cat import Cat
|
from petstore_api.models.cat import Cat
|
||||||
from petstore_api.models.category import Category
|
from petstore_api.models.category import Category
|
||||||
@ -69,6 +70,7 @@ from petstore_api.models.enum_class import EnumClass
|
|||||||
from petstore_api.models.enum_string1 import EnumString1
|
from petstore_api.models.enum_string1 import EnumString1
|
||||||
from petstore_api.models.enum_string2 import EnumString2
|
from petstore_api.models.enum_string2 import EnumString2
|
||||||
from petstore_api.models.enum_test import EnumTest
|
from petstore_api.models.enum_test import EnumTest
|
||||||
|
from petstore_api.models.feeding import Feeding
|
||||||
from petstore_api.models.file import File
|
from petstore_api.models.file import File
|
||||||
from petstore_api.models.file_schema_test_class import FileSchemaTestClass
|
from petstore_api.models.file_schema_test_class import FileSchemaTestClass
|
||||||
from petstore_api.models.first_ref import FirstRef
|
from petstore_api.models.first_ref import FirstRef
|
||||||
@ -104,6 +106,7 @@ from petstore_api.models.parent import Parent
|
|||||||
from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict
|
from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict
|
||||||
from petstore_api.models.pet import Pet
|
from petstore_api.models.pet import Pet
|
||||||
from petstore_api.models.pig import Pig
|
from petstore_api.models.pig import Pig
|
||||||
|
from petstore_api.models.poop_cleaning import PoopCleaning
|
||||||
from petstore_api.models.property_name_collision import PropertyNameCollision
|
from petstore_api.models.property_name_collision import PropertyNameCollision
|
||||||
from petstore_api.models.read_only_first import ReadOnlyFirst
|
from petstore_api.models.read_only_first import ReadOnlyFirst
|
||||||
from petstore_api.models.second_ref import SecondRef
|
from petstore_api.models.second_ref import SecondRef
|
||||||
@ -113,6 +116,8 @@ from petstore_api.models.special_character_enum import SpecialCharacterEnum
|
|||||||
from petstore_api.models.special_model_name import SpecialModelName
|
from petstore_api.models.special_model_name import SpecialModelName
|
||||||
from petstore_api.models.special_name import SpecialName
|
from petstore_api.models.special_name import SpecialName
|
||||||
from petstore_api.models.tag import Tag
|
from petstore_api.models.tag import Tag
|
||||||
|
from petstore_api.models.task import Task
|
||||||
|
from petstore_api.models.task_activity import TaskActivity
|
||||||
from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response
|
from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response
|
||||||
from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response
|
from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response
|
||||||
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
||||||
|
@ -27,6 +27,7 @@ from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumb
|
|||||||
from petstore_api.models.array_of_number_only import ArrayOfNumberOnly
|
from petstore_api.models.array_of_number_only import ArrayOfNumberOnly
|
||||||
from petstore_api.models.array_test import ArrayTest
|
from petstore_api.models.array_test import ArrayTest
|
||||||
from petstore_api.models.basque_pig import BasquePig
|
from petstore_api.models.basque_pig import BasquePig
|
||||||
|
from petstore_api.models.bathing import Bathing
|
||||||
from petstore_api.models.capitalization import Capitalization
|
from petstore_api.models.capitalization import Capitalization
|
||||||
from petstore_api.models.cat import Cat
|
from petstore_api.models.cat import Cat
|
||||||
from petstore_api.models.category import Category
|
from petstore_api.models.category import Category
|
||||||
@ -45,6 +46,7 @@ from petstore_api.models.enum_class import EnumClass
|
|||||||
from petstore_api.models.enum_string1 import EnumString1
|
from petstore_api.models.enum_string1 import EnumString1
|
||||||
from petstore_api.models.enum_string2 import EnumString2
|
from petstore_api.models.enum_string2 import EnumString2
|
||||||
from petstore_api.models.enum_test import EnumTest
|
from petstore_api.models.enum_test import EnumTest
|
||||||
|
from petstore_api.models.feeding import Feeding
|
||||||
from petstore_api.models.file import File
|
from petstore_api.models.file import File
|
||||||
from petstore_api.models.file_schema_test_class import FileSchemaTestClass
|
from petstore_api.models.file_schema_test_class import FileSchemaTestClass
|
||||||
from petstore_api.models.first_ref import FirstRef
|
from petstore_api.models.first_ref import FirstRef
|
||||||
@ -80,6 +82,7 @@ from petstore_api.models.parent import Parent
|
|||||||
from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict
|
from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict
|
||||||
from petstore_api.models.pet import Pet
|
from petstore_api.models.pet import Pet
|
||||||
from petstore_api.models.pig import Pig
|
from petstore_api.models.pig import Pig
|
||||||
|
from petstore_api.models.poop_cleaning import PoopCleaning
|
||||||
from petstore_api.models.property_name_collision import PropertyNameCollision
|
from petstore_api.models.property_name_collision import PropertyNameCollision
|
||||||
from petstore_api.models.read_only_first import ReadOnlyFirst
|
from petstore_api.models.read_only_first import ReadOnlyFirst
|
||||||
from petstore_api.models.second_ref import SecondRef
|
from petstore_api.models.second_ref import SecondRef
|
||||||
@ -89,6 +92,8 @@ from petstore_api.models.special_character_enum import SpecialCharacterEnum
|
|||||||
from petstore_api.models.special_model_name import SpecialModelName
|
from petstore_api.models.special_model_name import SpecialModelName
|
||||||
from petstore_api.models.special_name import SpecialName
|
from petstore_api.models.special_name import SpecialName
|
||||||
from petstore_api.models.tag import Tag
|
from petstore_api.models.tag import Tag
|
||||||
|
from petstore_api.models.task import Task
|
||||||
|
from petstore_api.models.task_activity import TaskActivity
|
||||||
from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response
|
from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response
|
||||||
from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response
|
from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response
|
||||||
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
||||||
|
@ -0,0 +1,105 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
from pydantic import BaseModel, StrictStr, field_validator
|
||||||
|
from typing import Any, ClassVar, Dict, List
|
||||||
|
from typing import Optional, Set
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
class Bathing(BaseModel):
|
||||||
|
"""
|
||||||
|
Bathing
|
||||||
|
""" # noqa: E501
|
||||||
|
task_name: StrictStr
|
||||||
|
function_name: StrictStr
|
||||||
|
content: StrictStr
|
||||||
|
__properties: ClassVar[List[str]] = ["task_name", "function_name", "content"]
|
||||||
|
|
||||||
|
@field_validator('task_name')
|
||||||
|
def task_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in set(['cleaning_deep']):
|
||||||
|
raise ValueError("must be one of enum values ('cleaning_deep')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
@field_validator('function_name')
|
||||||
|
def function_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in set(['care_nourish']):
|
||||||
|
raise ValueError("must be one of enum values ('care_nourish')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
model_config = {
|
||||||
|
"populate_by_name": True,
|
||||||
|
"validate_assignment": True,
|
||||||
|
"protected_namespaces": (),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.model_dump(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||||
|
"""Create an instance of Bathing from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
|
"""Return the dictionary representation of the model using alias.
|
||||||
|
|
||||||
|
This has the following differences from calling pydantic's
|
||||||
|
`self.model_dump(by_alias=True)`:
|
||||||
|
|
||||||
|
* `None` is only added to the output dict for nullable fields that
|
||||||
|
were set at model initialization. Other fields with value `None`
|
||||||
|
are ignored.
|
||||||
|
"""
|
||||||
|
excluded_fields: Set[str] = set([
|
||||||
|
])
|
||||||
|
|
||||||
|
_dict = self.model_dump(
|
||||||
|
by_alias=True,
|
||||||
|
exclude=excluded_fields,
|
||||||
|
exclude_none=True,
|
||||||
|
)
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||||
|
"""Create an instance of Bathing from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return cls.model_validate(obj)
|
||||||
|
|
||||||
|
_obj = cls.model_validate({
|
||||||
|
"task_name": obj.get("task_name"),
|
||||||
|
"function_name": obj.get("function_name"),
|
||||||
|
"content": obj.get("content")
|
||||||
|
})
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -36,7 +36,7 @@ class EnumArrays(BaseModel):
|
|||||||
if value is None:
|
if value is None:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
if value not in ('>=', '$'):
|
if value not in set(['>=', '$']):
|
||||||
raise ValueError("must be one of enum values ('>=', '$')")
|
raise ValueError("must be one of enum values ('>=', '$')")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ class EnumArrays(BaseModel):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
for i in value:
|
for i in value:
|
||||||
if i not in ('fish', 'crab'):
|
if i not in set(['fish', 'crab']):
|
||||||
raise ValueError("each list item must be one of ('fish', 'crab')")
|
raise ValueError("each list item must be one of ('fish', 'crab')")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
@ -47,14 +47,14 @@ class EnumTest(BaseModel):
|
|||||||
if value is None:
|
if value is None:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
if value not in ('UPPER', 'lower', ''):
|
if value not in set(['UPPER', 'lower', '']):
|
||||||
raise ValueError("must be one of enum values ('UPPER', 'lower', '')")
|
raise ValueError("must be one of enum values ('UPPER', 'lower', '')")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@field_validator('enum_string_required')
|
@field_validator('enum_string_required')
|
||||||
def enum_string_required_validate_enum(cls, value):
|
def enum_string_required_validate_enum(cls, value):
|
||||||
"""Validates the enum"""
|
"""Validates the enum"""
|
||||||
if value not in ('UPPER', 'lower', ''):
|
if value not in set(['UPPER', 'lower', '']):
|
||||||
raise ValueError("must be one of enum values ('UPPER', 'lower', '')")
|
raise ValueError("must be one of enum values ('UPPER', 'lower', '')")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ class EnumTest(BaseModel):
|
|||||||
if value is None:
|
if value is None:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
if value not in (1, 5, 14):
|
if value not in set([1, 5, 14]):
|
||||||
raise ValueError("must be one of enum values (1, 5, 14)")
|
raise ValueError("must be one of enum values (1, 5, 14)")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ class EnumTest(BaseModel):
|
|||||||
if value is None:
|
if value is None:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
if value not in (1, -1):
|
if value not in set([1, -1]):
|
||||||
raise ValueError("must be one of enum values (1, -1)")
|
raise ValueError("must be one of enum values (1, -1)")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ class EnumTest(BaseModel):
|
|||||||
if value is None:
|
if value is None:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
if value not in (1.1, -1.2):
|
if value not in set([1.1, -1.2]):
|
||||||
raise ValueError("must be one of enum values (1.1, -1.2)")
|
raise ValueError("must be one of enum values (1.1, -1.2)")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
@ -0,0 +1,105 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
from pydantic import BaseModel, StrictStr, field_validator
|
||||||
|
from typing import Any, ClassVar, Dict, List
|
||||||
|
from typing import Optional, Set
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
class Feeding(BaseModel):
|
||||||
|
"""
|
||||||
|
Feeding
|
||||||
|
""" # noqa: E501
|
||||||
|
task_name: StrictStr
|
||||||
|
function_name: StrictStr
|
||||||
|
content: StrictStr
|
||||||
|
__properties: ClassVar[List[str]] = ["task_name", "function_name", "content"]
|
||||||
|
|
||||||
|
@field_validator('task_name')
|
||||||
|
def task_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in set(['cleaning']):
|
||||||
|
raise ValueError("must be one of enum values ('cleaning')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
@field_validator('function_name')
|
||||||
|
def function_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in set(['care_nourish']):
|
||||||
|
raise ValueError("must be one of enum values ('care_nourish')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
model_config = {
|
||||||
|
"populate_by_name": True,
|
||||||
|
"validate_assignment": True,
|
||||||
|
"protected_namespaces": (),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.model_dump(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||||
|
"""Create an instance of Feeding from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
|
"""Return the dictionary representation of the model using alias.
|
||||||
|
|
||||||
|
This has the following differences from calling pydantic's
|
||||||
|
`self.model_dump(by_alias=True)`:
|
||||||
|
|
||||||
|
* `None` is only added to the output dict for nullable fields that
|
||||||
|
were set at model initialization. Other fields with value `None`
|
||||||
|
are ignored.
|
||||||
|
"""
|
||||||
|
excluded_fields: Set[str] = set([
|
||||||
|
])
|
||||||
|
|
||||||
|
_dict = self.model_dump(
|
||||||
|
by_alias=True,
|
||||||
|
exclude=excluded_fields,
|
||||||
|
exclude_none=True,
|
||||||
|
)
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||||
|
"""Create an instance of Feeding from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return cls.model_validate(obj)
|
||||||
|
|
||||||
|
_obj = cls.model_validate({
|
||||||
|
"task_name": obj.get("task_name"),
|
||||||
|
"function_name": obj.get("function_name"),
|
||||||
|
"content": obj.get("content")
|
||||||
|
})
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -38,7 +38,7 @@ class MapTest(BaseModel):
|
|||||||
if value is None:
|
if value is None:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
if value not in ('UPPER', 'lower'):
|
if value not in set(['UPPER', 'lower']):
|
||||||
raise ValueError("must be one of enum values ('UPPER', 'lower')")
|
raise ValueError("must be one of enum values ('UPPER', 'lower')")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ class Order(BaseModel):
|
|||||||
if value is None:
|
if value is None:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
if value not in ('placed', 'approved', 'delivered'):
|
if value not in set(['placed', 'approved', 'delivered']):
|
||||||
raise ValueError("must be one of enum values ('placed', 'approved', 'delivered')")
|
raise ValueError("must be one of enum values ('placed', 'approved', 'delivered')")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ class Pet(BaseModel):
|
|||||||
if value is None:
|
if value is None:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
if value not in ('available', 'pending', 'sold'):
|
if value not in set(['available', 'pending', 'sold']):
|
||||||
raise ValueError("must be one of enum values ('available', 'pending', 'sold')")
|
raise ValueError("must be one of enum values ('available', 'pending', 'sold')")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
@ -0,0 +1,105 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
from pydantic import BaseModel, StrictStr, field_validator
|
||||||
|
from typing import Any, ClassVar, Dict, List
|
||||||
|
from typing import Optional, Set
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
class PoopCleaning(BaseModel):
|
||||||
|
"""
|
||||||
|
PoopCleaning
|
||||||
|
""" # noqa: E501
|
||||||
|
task_name: StrictStr
|
||||||
|
function_name: StrictStr
|
||||||
|
content: StrictStr
|
||||||
|
__properties: ClassVar[List[str]] = ["task_name", "function_name", "content"]
|
||||||
|
|
||||||
|
@field_validator('task_name')
|
||||||
|
def task_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in set(['cleaning']):
|
||||||
|
raise ValueError("must be one of enum values ('cleaning')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
@field_validator('function_name')
|
||||||
|
def function_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in set(['care']):
|
||||||
|
raise ValueError("must be one of enum values ('care')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
model_config = {
|
||||||
|
"populate_by_name": True,
|
||||||
|
"validate_assignment": True,
|
||||||
|
"protected_namespaces": (),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.model_dump(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||||
|
"""Create an instance of PoopCleaning from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
|
"""Return the dictionary representation of the model using alias.
|
||||||
|
|
||||||
|
This has the following differences from calling pydantic's
|
||||||
|
`self.model_dump(by_alias=True)`:
|
||||||
|
|
||||||
|
* `None` is only added to the output dict for nullable fields that
|
||||||
|
were set at model initialization. Other fields with value `None`
|
||||||
|
are ignored.
|
||||||
|
"""
|
||||||
|
excluded_fields: Set[str] = set([
|
||||||
|
])
|
||||||
|
|
||||||
|
_dict = self.model_dump(
|
||||||
|
by_alias=True,
|
||||||
|
exclude=excluded_fields,
|
||||||
|
exclude_none=True,
|
||||||
|
)
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||||
|
"""Create an instance of PoopCleaning from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return cls.model_validate(obj)
|
||||||
|
|
||||||
|
_obj = cls.model_validate({
|
||||||
|
"task_name": obj.get("task_name"),
|
||||||
|
"function_name": obj.get("function_name"),
|
||||||
|
"content": obj.get("content")
|
||||||
|
})
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -38,7 +38,7 @@ class SpecialName(BaseModel):
|
|||||||
if value is None:
|
if value is None:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
if value not in ('available', 'pending', 'sold'):
|
if value not in set(['available', 'pending', 'sold']):
|
||||||
raise ValueError("must be one of enum values ('available', 'pending', 'sold')")
|
raise ValueError("must be one of enum values ('available', 'pending', 'sold')")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
@ -0,0 +1,93 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
from pydantic import BaseModel, StrictStr
|
||||||
|
from typing import Any, ClassVar, Dict, List
|
||||||
|
from petstore_api.models.task_activity import TaskActivity
|
||||||
|
from typing import Optional, Set
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
class Task(BaseModel):
|
||||||
|
"""
|
||||||
|
Used to test oneOf enums with only one string value.
|
||||||
|
""" # noqa: E501
|
||||||
|
id: StrictStr
|
||||||
|
activity: TaskActivity
|
||||||
|
__properties: ClassVar[List[str]] = ["id", "activity"]
|
||||||
|
|
||||||
|
model_config = {
|
||||||
|
"populate_by_name": True,
|
||||||
|
"validate_assignment": True,
|
||||||
|
"protected_namespaces": (),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.model_dump(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||||
|
"""Create an instance of Task from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
|
"""Return the dictionary representation of the model using alias.
|
||||||
|
|
||||||
|
This has the following differences from calling pydantic's
|
||||||
|
`self.model_dump(by_alias=True)`:
|
||||||
|
|
||||||
|
* `None` is only added to the output dict for nullable fields that
|
||||||
|
were set at model initialization. Other fields with value `None`
|
||||||
|
are ignored.
|
||||||
|
"""
|
||||||
|
excluded_fields: Set[str] = set([
|
||||||
|
])
|
||||||
|
|
||||||
|
_dict = self.model_dump(
|
||||||
|
by_alias=True,
|
||||||
|
exclude=excluded_fields,
|
||||||
|
exclude_none=True,
|
||||||
|
)
|
||||||
|
# override the default output from pydantic by calling `to_dict()` of activity
|
||||||
|
if self.activity:
|
||||||
|
_dict['activity'] = self.activity.to_dict()
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||||
|
"""Create an instance of Task from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return cls.model_validate(obj)
|
||||||
|
|
||||||
|
_obj = cls.model_validate({
|
||||||
|
"id": obj.get("id"),
|
||||||
|
"activity": TaskActivity.from_dict(obj["activity"]) if obj.get("activity") is not None else None
|
||||||
|
})
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -0,0 +1,151 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import json
|
||||||
|
import pprint
|
||||||
|
from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
|
||||||
|
from typing import Any, List, Optional
|
||||||
|
from petstore_api.models.bathing import Bathing
|
||||||
|
from petstore_api.models.feeding import Feeding
|
||||||
|
from petstore_api.models.poop_cleaning import PoopCleaning
|
||||||
|
from pydantic import StrictStr, Field
|
||||||
|
from typing import Union, List, Optional, Dict
|
||||||
|
from typing_extensions import Literal, Self
|
||||||
|
|
||||||
|
TASKACTIVITY_ONE_OF_SCHEMAS = ["Bathing", "Feeding", "PoopCleaning"]
|
||||||
|
|
||||||
|
class TaskActivity(BaseModel):
|
||||||
|
"""
|
||||||
|
TaskActivity
|
||||||
|
"""
|
||||||
|
# data type: PoopCleaning
|
||||||
|
oneof_schema_1_validator: Optional[PoopCleaning] = None
|
||||||
|
# data type: Feeding
|
||||||
|
oneof_schema_2_validator: Optional[Feeding] = None
|
||||||
|
# data type: Bathing
|
||||||
|
oneof_schema_3_validator: Optional[Bathing] = None
|
||||||
|
actual_instance: Optional[Union[Bathing, Feeding, PoopCleaning]] = None
|
||||||
|
one_of_schemas: List[str] = Field(default=Literal["Bathing", "Feeding", "PoopCleaning"])
|
||||||
|
|
||||||
|
model_config = {
|
||||||
|
"validate_assignment": True,
|
||||||
|
"protected_namespaces": (),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs) -> None:
|
||||||
|
if args:
|
||||||
|
if len(args) > 1:
|
||||||
|
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
||||||
|
if kwargs:
|
||||||
|
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
||||||
|
super().__init__(actual_instance=args[0])
|
||||||
|
else:
|
||||||
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
|
@field_validator('actual_instance')
|
||||||
|
def actual_instance_must_validate_oneof(cls, v):
|
||||||
|
instance = TaskActivity.model_construct()
|
||||||
|
error_messages = []
|
||||||
|
match = 0
|
||||||
|
# validate data type: PoopCleaning
|
||||||
|
if not isinstance(v, PoopCleaning):
|
||||||
|
error_messages.append(f"Error! Input type `{type(v)}` is not `PoopCleaning`")
|
||||||
|
else:
|
||||||
|
match += 1
|
||||||
|
# validate data type: Feeding
|
||||||
|
if not isinstance(v, Feeding):
|
||||||
|
error_messages.append(f"Error! Input type `{type(v)}` is not `Feeding`")
|
||||||
|
else:
|
||||||
|
match += 1
|
||||||
|
# validate data type: Bathing
|
||||||
|
if not isinstance(v, Bathing):
|
||||||
|
error_messages.append(f"Error! Input type `{type(v)}` is not `Bathing`")
|
||||||
|
else:
|
||||||
|
match += 1
|
||||||
|
if match > 1:
|
||||||
|
# more than 1 match
|
||||||
|
raise ValueError("Multiple matches found when setting `actual_instance` in TaskActivity with oneOf schemas: Bathing, Feeding, PoopCleaning. Details: " + ", ".join(error_messages))
|
||||||
|
elif match == 0:
|
||||||
|
# no match
|
||||||
|
raise ValueError("No match found when setting `actual_instance` in TaskActivity with oneOf schemas: Bathing, Feeding, PoopCleaning. Details: " + ", ".join(error_messages))
|
||||||
|
else:
|
||||||
|
return v
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
||||||
|
return cls.from_json(json.dumps(obj))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> Self:
|
||||||
|
"""Returns the object represented by the json string"""
|
||||||
|
instance = cls.model_construct()
|
||||||
|
error_messages = []
|
||||||
|
match = 0
|
||||||
|
|
||||||
|
# deserialize data into PoopCleaning
|
||||||
|
try:
|
||||||
|
instance.actual_instance = PoopCleaning.from_json(json_str)
|
||||||
|
match += 1
|
||||||
|
except (ValidationError, ValueError) as e:
|
||||||
|
error_messages.append(str(e))
|
||||||
|
# deserialize data into Feeding
|
||||||
|
try:
|
||||||
|
instance.actual_instance = Feeding.from_json(json_str)
|
||||||
|
match += 1
|
||||||
|
except (ValidationError, ValueError) as e:
|
||||||
|
error_messages.append(str(e))
|
||||||
|
# deserialize data into Bathing
|
||||||
|
try:
|
||||||
|
instance.actual_instance = Bathing.from_json(json_str)
|
||||||
|
match += 1
|
||||||
|
except (ValidationError, ValueError) as e:
|
||||||
|
error_messages.append(str(e))
|
||||||
|
|
||||||
|
if match > 1:
|
||||||
|
# more than 1 match
|
||||||
|
raise ValueError("Multiple matches found when deserializing the JSON string into TaskActivity with oneOf schemas: Bathing, Feeding, PoopCleaning. Details: " + ", ".join(error_messages))
|
||||||
|
elif match == 0:
|
||||||
|
# no match
|
||||||
|
raise ValueError("No match found when deserializing the JSON string into TaskActivity with oneOf schemas: Bathing, Feeding, PoopCleaning. Details: " + ", ".join(error_messages))
|
||||||
|
else:
|
||||||
|
return instance
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the actual instance"""
|
||||||
|
if self.actual_instance is None:
|
||||||
|
return "null"
|
||||||
|
|
||||||
|
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
||||||
|
return self.actual_instance.to_json()
|
||||||
|
else:
|
||||||
|
return json.dumps(self.actual_instance)
|
||||||
|
|
||||||
|
def to_dict(self) -> Optional[Union[Dict[str, Any], Bathing, Feeding, PoopCleaning]]:
|
||||||
|
"""Returns the dict representation of the actual instance"""
|
||||||
|
if self.actual_instance is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
||||||
|
return self.actual_instance.to_dict()
|
||||||
|
else:
|
||||||
|
# primitive type
|
||||||
|
return self.actual_instance
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the actual instance"""
|
||||||
|
return pprint.pformat(self.model_dump())
|
||||||
|
|
||||||
|
|
@ -0,0 +1,57 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.bathing import Bathing
|
||||||
|
|
||||||
|
class TestBathing(unittest.TestCase):
|
||||||
|
"""Bathing unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> Bathing:
|
||||||
|
"""Test Bathing
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `Bathing`
|
||||||
|
"""
|
||||||
|
model = Bathing()
|
||||||
|
if include_optional:
|
||||||
|
return Bathing(
|
||||||
|
task_name = 'cleaning_deep',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = ''
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return Bathing(
|
||||||
|
task_name = 'cleaning_deep',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = '',
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testBathing(self):
|
||||||
|
"""Test Bathing"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -0,0 +1,57 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.feeding import Feeding
|
||||||
|
|
||||||
|
class TestFeeding(unittest.TestCase):
|
||||||
|
"""Feeding unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> Feeding:
|
||||||
|
"""Test Feeding
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `Feeding`
|
||||||
|
"""
|
||||||
|
model = Feeding()
|
||||||
|
if include_optional:
|
||||||
|
return Feeding(
|
||||||
|
task_name = 'cleaning',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = ''
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return Feeding(
|
||||||
|
task_name = 'cleaning',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = '',
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testFeeding(self):
|
||||||
|
"""Test Feeding"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -0,0 +1,57 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.poop_cleaning import PoopCleaning
|
||||||
|
|
||||||
|
class TestPoopCleaning(unittest.TestCase):
|
||||||
|
"""PoopCleaning unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> PoopCleaning:
|
||||||
|
"""Test PoopCleaning
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `PoopCleaning`
|
||||||
|
"""
|
||||||
|
model = PoopCleaning()
|
||||||
|
if include_optional:
|
||||||
|
return PoopCleaning(
|
||||||
|
task_name = 'cleaning',
|
||||||
|
function_name = 'care',
|
||||||
|
content = ''
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return PoopCleaning(
|
||||||
|
task_name = 'cleaning',
|
||||||
|
function_name = 'care',
|
||||||
|
content = '',
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testPoopCleaning(self):
|
||||||
|
"""Test PoopCleaning"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -0,0 +1,55 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.task import Task
|
||||||
|
|
||||||
|
class TestTask(unittest.TestCase):
|
||||||
|
"""Task unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> Task:
|
||||||
|
"""Test Task
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `Task`
|
||||||
|
"""
|
||||||
|
model = Task()
|
||||||
|
if include_optional:
|
||||||
|
return Task(
|
||||||
|
id = '',
|
||||||
|
activity = None
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return Task(
|
||||||
|
id = '',
|
||||||
|
activity = None,
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testTask(self):
|
||||||
|
"""Test Task"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -0,0 +1,57 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.task_activity import TaskActivity
|
||||||
|
|
||||||
|
class TestTaskActivity(unittest.TestCase):
|
||||||
|
"""TaskActivity unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> TaskActivity:
|
||||||
|
"""Test TaskActivity
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `TaskActivity`
|
||||||
|
"""
|
||||||
|
model = TaskActivity()
|
||||||
|
if include_optional:
|
||||||
|
return TaskActivity(
|
||||||
|
task_name = 'cleaning_deep',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = ''
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return TaskActivity(
|
||||||
|
task_name = 'cleaning_deep',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = '',
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testTaskActivity(self):
|
||||||
|
"""Test TaskActivity"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -18,6 +18,7 @@ docs/ArrayOfArrayOfNumberOnly.md
|
|||||||
docs/ArrayOfNumberOnly.md
|
docs/ArrayOfNumberOnly.md
|
||||||
docs/ArrayTest.md
|
docs/ArrayTest.md
|
||||||
docs/BasquePig.md
|
docs/BasquePig.md
|
||||||
|
docs/Bathing.md
|
||||||
docs/Capitalization.md
|
docs/Capitalization.md
|
||||||
docs/Cat.md
|
docs/Cat.md
|
||||||
docs/Category.md
|
docs/Category.md
|
||||||
@ -39,6 +40,7 @@ docs/EnumString2.md
|
|||||||
docs/EnumTest.md
|
docs/EnumTest.md
|
||||||
docs/FakeApi.md
|
docs/FakeApi.md
|
||||||
docs/FakeClassnameTags123Api.md
|
docs/FakeClassnameTags123Api.md
|
||||||
|
docs/Feeding.md
|
||||||
docs/File.md
|
docs/File.md
|
||||||
docs/FileSchemaTestClass.md
|
docs/FileSchemaTestClass.md
|
||||||
docs/FirstRef.md
|
docs/FirstRef.md
|
||||||
@ -74,6 +76,7 @@ docs/ParentWithOptionalDict.md
|
|||||||
docs/Pet.md
|
docs/Pet.md
|
||||||
docs/PetApi.md
|
docs/PetApi.md
|
||||||
docs/Pig.md
|
docs/Pig.md
|
||||||
|
docs/PoopCleaning.md
|
||||||
docs/PropertyNameCollision.md
|
docs/PropertyNameCollision.md
|
||||||
docs/ReadOnlyFirst.md
|
docs/ReadOnlyFirst.md
|
||||||
docs/SecondRef.md
|
docs/SecondRef.md
|
||||||
@ -84,6 +87,8 @@ docs/SpecialModelName.md
|
|||||||
docs/SpecialName.md
|
docs/SpecialName.md
|
||||||
docs/StoreApi.md
|
docs/StoreApi.md
|
||||||
docs/Tag.md
|
docs/Tag.md
|
||||||
|
docs/Task.md
|
||||||
|
docs/TaskActivity.md
|
||||||
docs/TestErrorResponsesWithModel400Response.md
|
docs/TestErrorResponsesWithModel400Response.md
|
||||||
docs/TestErrorResponsesWithModel404Response.md
|
docs/TestErrorResponsesWithModel404Response.md
|
||||||
docs/TestInlineFreeformAdditionalPropertiesRequest.md
|
docs/TestInlineFreeformAdditionalPropertiesRequest.md
|
||||||
@ -122,6 +127,7 @@ petstore_api/models/array_of_array_of_number_only.py
|
|||||||
petstore_api/models/array_of_number_only.py
|
petstore_api/models/array_of_number_only.py
|
||||||
petstore_api/models/array_test.py
|
petstore_api/models/array_test.py
|
||||||
petstore_api/models/basque_pig.py
|
petstore_api/models/basque_pig.py
|
||||||
|
petstore_api/models/bathing.py
|
||||||
petstore_api/models/capitalization.py
|
petstore_api/models/capitalization.py
|
||||||
petstore_api/models/cat.py
|
petstore_api/models/cat.py
|
||||||
petstore_api/models/category.py
|
petstore_api/models/category.py
|
||||||
@ -140,6 +146,7 @@ petstore_api/models/enum_class.py
|
|||||||
petstore_api/models/enum_string1.py
|
petstore_api/models/enum_string1.py
|
||||||
petstore_api/models/enum_string2.py
|
petstore_api/models/enum_string2.py
|
||||||
petstore_api/models/enum_test.py
|
petstore_api/models/enum_test.py
|
||||||
|
petstore_api/models/feeding.py
|
||||||
petstore_api/models/file.py
|
petstore_api/models/file.py
|
||||||
petstore_api/models/file_schema_test_class.py
|
petstore_api/models/file_schema_test_class.py
|
||||||
petstore_api/models/first_ref.py
|
petstore_api/models/first_ref.py
|
||||||
@ -174,6 +181,7 @@ petstore_api/models/parent.py
|
|||||||
petstore_api/models/parent_with_optional_dict.py
|
petstore_api/models/parent_with_optional_dict.py
|
||||||
petstore_api/models/pet.py
|
petstore_api/models/pet.py
|
||||||
petstore_api/models/pig.py
|
petstore_api/models/pig.py
|
||||||
|
petstore_api/models/poop_cleaning.py
|
||||||
petstore_api/models/property_name_collision.py
|
petstore_api/models/property_name_collision.py
|
||||||
petstore_api/models/read_only_first.py
|
petstore_api/models/read_only_first.py
|
||||||
petstore_api/models/second_ref.py
|
petstore_api/models/second_ref.py
|
||||||
@ -183,6 +191,8 @@ petstore_api/models/special_character_enum.py
|
|||||||
petstore_api/models/special_model_name.py
|
petstore_api/models/special_model_name.py
|
||||||
petstore_api/models/special_name.py
|
petstore_api/models/special_name.py
|
||||||
petstore_api/models/tag.py
|
petstore_api/models/tag.py
|
||||||
|
petstore_api/models/task.py
|
||||||
|
petstore_api/models/task_activity.py
|
||||||
petstore_api/models/test_error_responses_with_model400_response.py
|
petstore_api/models/test_error_responses_with_model400_response.py
|
||||||
petstore_api/models/test_error_responses_with_model404_response.py
|
petstore_api/models/test_error_responses_with_model404_response.py
|
||||||
petstore_api/models/test_inline_freeform_additional_properties_request.py
|
petstore_api/models/test_inline_freeform_additional_properties_request.py
|
||||||
|
@ -154,6 +154,7 @@ Class | Method | HTTP request | Description
|
|||||||
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
||||||
- [ArrayTest](docs/ArrayTest.md)
|
- [ArrayTest](docs/ArrayTest.md)
|
||||||
- [BasquePig](docs/BasquePig.md)
|
- [BasquePig](docs/BasquePig.md)
|
||||||
|
- [Bathing](docs/Bathing.md)
|
||||||
- [Capitalization](docs/Capitalization.md)
|
- [Capitalization](docs/Capitalization.md)
|
||||||
- [Cat](docs/Cat.md)
|
- [Cat](docs/Cat.md)
|
||||||
- [Category](docs/Category.md)
|
- [Category](docs/Category.md)
|
||||||
@ -172,6 +173,7 @@ Class | Method | HTTP request | Description
|
|||||||
- [EnumString1](docs/EnumString1.md)
|
- [EnumString1](docs/EnumString1.md)
|
||||||
- [EnumString2](docs/EnumString2.md)
|
- [EnumString2](docs/EnumString2.md)
|
||||||
- [EnumTest](docs/EnumTest.md)
|
- [EnumTest](docs/EnumTest.md)
|
||||||
|
- [Feeding](docs/Feeding.md)
|
||||||
- [File](docs/File.md)
|
- [File](docs/File.md)
|
||||||
- [FileSchemaTestClass](docs/FileSchemaTestClass.md)
|
- [FileSchemaTestClass](docs/FileSchemaTestClass.md)
|
||||||
- [FirstRef](docs/FirstRef.md)
|
- [FirstRef](docs/FirstRef.md)
|
||||||
@ -206,6 +208,7 @@ Class | Method | HTTP request | Description
|
|||||||
- [ParentWithOptionalDict](docs/ParentWithOptionalDict.md)
|
- [ParentWithOptionalDict](docs/ParentWithOptionalDict.md)
|
||||||
- [Pet](docs/Pet.md)
|
- [Pet](docs/Pet.md)
|
||||||
- [Pig](docs/Pig.md)
|
- [Pig](docs/Pig.md)
|
||||||
|
- [PoopCleaning](docs/PoopCleaning.md)
|
||||||
- [PropertyNameCollision](docs/PropertyNameCollision.md)
|
- [PropertyNameCollision](docs/PropertyNameCollision.md)
|
||||||
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
||||||
- [SecondRef](docs/SecondRef.md)
|
- [SecondRef](docs/SecondRef.md)
|
||||||
@ -215,6 +218,8 @@ Class | Method | HTTP request | Description
|
|||||||
- [SpecialModelName](docs/SpecialModelName.md)
|
- [SpecialModelName](docs/SpecialModelName.md)
|
||||||
- [SpecialName](docs/SpecialName.md)
|
- [SpecialName](docs/SpecialName.md)
|
||||||
- [Tag](docs/Tag.md)
|
- [Tag](docs/Tag.md)
|
||||||
|
- [Task](docs/Task.md)
|
||||||
|
- [TaskActivity](docs/TaskActivity.md)
|
||||||
- [TestErrorResponsesWithModel400Response](docs/TestErrorResponsesWithModel400Response.md)
|
- [TestErrorResponsesWithModel400Response](docs/TestErrorResponsesWithModel400Response.md)
|
||||||
- [TestErrorResponsesWithModel404Response](docs/TestErrorResponsesWithModel404Response.md)
|
- [TestErrorResponsesWithModel404Response](docs/TestErrorResponsesWithModel404Response.md)
|
||||||
- [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md)
|
- [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md)
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
# Bathing
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**task_name** | **str** | |
|
||||||
|
**function_name** | **str** | |
|
||||||
|
**content** | **str** | |
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.bathing import Bathing
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of Bathing from a JSON string
|
||||||
|
bathing_instance = Bathing.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print Bathing.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
bathing_dict = bathing_instance.to_dict()
|
||||||
|
# create an instance of Bathing from a dict
|
||||||
|
bathing_form_dict = bathing.from_dict(bathing_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
# Feeding
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**task_name** | **str** | |
|
||||||
|
**function_name** | **str** | |
|
||||||
|
**content** | **str** | |
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.feeding import Feeding
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of Feeding from a JSON string
|
||||||
|
feeding_instance = Feeding.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print Feeding.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
feeding_dict = feeding_instance.to_dict()
|
||||||
|
# create an instance of Feeding from a dict
|
||||||
|
feeding_form_dict = feeding.from_dict(feeding_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
# PoopCleaning
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**task_name** | **str** | |
|
||||||
|
**function_name** | **str** | |
|
||||||
|
**content** | **str** | |
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.poop_cleaning import PoopCleaning
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of PoopCleaning from a JSON string
|
||||||
|
poop_cleaning_instance = PoopCleaning.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print PoopCleaning.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
poop_cleaning_dict = poop_cleaning_instance.to_dict()
|
||||||
|
# create an instance of PoopCleaning from a dict
|
||||||
|
poop_cleaning_form_dict = poop_cleaning.from_dict(poop_cleaning_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
# Task
|
||||||
|
|
||||||
|
Used to test oneOf enums with only one string value.
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**id** | **str** | |
|
||||||
|
**activity** | [**TaskActivity**](TaskActivity.md) | |
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.task import Task
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of Task from a JSON string
|
||||||
|
task_instance = Task.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print Task.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
task_dict = task_instance.to_dict()
|
||||||
|
# create an instance of Task from a dict
|
||||||
|
task_form_dict = task.from_dict(task_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
# TaskActivity
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**task_name** | **str** | |
|
||||||
|
**function_name** | **str** | |
|
||||||
|
**content** | **str** | |
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.task_activity import TaskActivity
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of TaskActivity from a JSON string
|
||||||
|
task_activity_instance = TaskActivity.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print TaskActivity.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
task_activity_dict = task_activity_instance.to_dict()
|
||||||
|
# create an instance of TaskActivity from a dict
|
||||||
|
task_activity_form_dict = task_activity.from_dict(task_activity_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -52,6 +52,7 @@ from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumb
|
|||||||
from petstore_api.models.array_of_number_only import ArrayOfNumberOnly
|
from petstore_api.models.array_of_number_only import ArrayOfNumberOnly
|
||||||
from petstore_api.models.array_test import ArrayTest
|
from petstore_api.models.array_test import ArrayTest
|
||||||
from petstore_api.models.basque_pig import BasquePig
|
from petstore_api.models.basque_pig import BasquePig
|
||||||
|
from petstore_api.models.bathing import Bathing
|
||||||
from petstore_api.models.capitalization import Capitalization
|
from petstore_api.models.capitalization import Capitalization
|
||||||
from petstore_api.models.cat import Cat
|
from petstore_api.models.cat import Cat
|
||||||
from petstore_api.models.category import Category
|
from petstore_api.models.category import Category
|
||||||
@ -70,6 +71,7 @@ from petstore_api.models.enum_class import EnumClass
|
|||||||
from petstore_api.models.enum_string1 import EnumString1
|
from petstore_api.models.enum_string1 import EnumString1
|
||||||
from petstore_api.models.enum_string2 import EnumString2
|
from petstore_api.models.enum_string2 import EnumString2
|
||||||
from petstore_api.models.enum_test import EnumTest
|
from petstore_api.models.enum_test import EnumTest
|
||||||
|
from petstore_api.models.feeding import Feeding
|
||||||
from petstore_api.models.file import File
|
from petstore_api.models.file import File
|
||||||
from petstore_api.models.file_schema_test_class import FileSchemaTestClass
|
from petstore_api.models.file_schema_test_class import FileSchemaTestClass
|
||||||
from petstore_api.models.first_ref import FirstRef
|
from petstore_api.models.first_ref import FirstRef
|
||||||
@ -104,6 +106,7 @@ from petstore_api.models.parent import Parent
|
|||||||
from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict
|
from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict
|
||||||
from petstore_api.models.pet import Pet
|
from petstore_api.models.pet import Pet
|
||||||
from petstore_api.models.pig import Pig
|
from petstore_api.models.pig import Pig
|
||||||
|
from petstore_api.models.poop_cleaning import PoopCleaning
|
||||||
from petstore_api.models.property_name_collision import PropertyNameCollision
|
from petstore_api.models.property_name_collision import PropertyNameCollision
|
||||||
from petstore_api.models.read_only_first import ReadOnlyFirst
|
from petstore_api.models.read_only_first import ReadOnlyFirst
|
||||||
from petstore_api.models.second_ref import SecondRef
|
from petstore_api.models.second_ref import SecondRef
|
||||||
@ -113,6 +116,8 @@ from petstore_api.models.special_character_enum import SpecialCharacterEnum
|
|||||||
from petstore_api.models.special_model_name import SpecialModelName
|
from petstore_api.models.special_model_name import SpecialModelName
|
||||||
from petstore_api.models.special_name import SpecialName
|
from petstore_api.models.special_name import SpecialName
|
||||||
from petstore_api.models.tag import Tag
|
from petstore_api.models.tag import Tag
|
||||||
|
from petstore_api.models.task import Task
|
||||||
|
from petstore_api.models.task_activity import TaskActivity
|
||||||
from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response
|
from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response
|
||||||
from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response
|
from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response
|
||||||
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
||||||
|
@ -28,6 +28,7 @@ from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumb
|
|||||||
from petstore_api.models.array_of_number_only import ArrayOfNumberOnly
|
from petstore_api.models.array_of_number_only import ArrayOfNumberOnly
|
||||||
from petstore_api.models.array_test import ArrayTest
|
from petstore_api.models.array_test import ArrayTest
|
||||||
from petstore_api.models.basque_pig import BasquePig
|
from petstore_api.models.basque_pig import BasquePig
|
||||||
|
from petstore_api.models.bathing import Bathing
|
||||||
from petstore_api.models.capitalization import Capitalization
|
from petstore_api.models.capitalization import Capitalization
|
||||||
from petstore_api.models.cat import Cat
|
from petstore_api.models.cat import Cat
|
||||||
from petstore_api.models.category import Category
|
from petstore_api.models.category import Category
|
||||||
@ -46,6 +47,7 @@ from petstore_api.models.enum_class import EnumClass
|
|||||||
from petstore_api.models.enum_string1 import EnumString1
|
from petstore_api.models.enum_string1 import EnumString1
|
||||||
from petstore_api.models.enum_string2 import EnumString2
|
from petstore_api.models.enum_string2 import EnumString2
|
||||||
from petstore_api.models.enum_test import EnumTest
|
from petstore_api.models.enum_test import EnumTest
|
||||||
|
from petstore_api.models.feeding import Feeding
|
||||||
from petstore_api.models.file import File
|
from petstore_api.models.file import File
|
||||||
from petstore_api.models.file_schema_test_class import FileSchemaTestClass
|
from petstore_api.models.file_schema_test_class import FileSchemaTestClass
|
||||||
from petstore_api.models.first_ref import FirstRef
|
from petstore_api.models.first_ref import FirstRef
|
||||||
@ -80,6 +82,7 @@ from petstore_api.models.parent import Parent
|
|||||||
from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict
|
from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict
|
||||||
from petstore_api.models.pet import Pet
|
from petstore_api.models.pet import Pet
|
||||||
from petstore_api.models.pig import Pig
|
from petstore_api.models.pig import Pig
|
||||||
|
from petstore_api.models.poop_cleaning import PoopCleaning
|
||||||
from petstore_api.models.property_name_collision import PropertyNameCollision
|
from petstore_api.models.property_name_collision import PropertyNameCollision
|
||||||
from petstore_api.models.read_only_first import ReadOnlyFirst
|
from petstore_api.models.read_only_first import ReadOnlyFirst
|
||||||
from petstore_api.models.second_ref import SecondRef
|
from petstore_api.models.second_ref import SecondRef
|
||||||
@ -89,6 +92,8 @@ from petstore_api.models.special_character_enum import SpecialCharacterEnum
|
|||||||
from petstore_api.models.special_model_name import SpecialModelName
|
from petstore_api.models.special_model_name import SpecialModelName
|
||||||
from petstore_api.models.special_name import SpecialName
|
from petstore_api.models.special_name import SpecialName
|
||||||
from petstore_api.models.tag import Tag
|
from petstore_api.models.tag import Tag
|
||||||
|
from petstore_api.models.task import Task
|
||||||
|
from petstore_api.models.task_activity import TaskActivity
|
||||||
from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response
|
from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response
|
||||||
from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response
|
from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response
|
||||||
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
||||||
|
@ -0,0 +1,89 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
from pydantic import BaseModel, Field, StrictStr, validator
|
||||||
|
|
||||||
|
class Bathing(BaseModel):
|
||||||
|
"""
|
||||||
|
Bathing
|
||||||
|
"""
|
||||||
|
task_name: StrictStr = Field(...)
|
||||||
|
function_name: StrictStr = Field(...)
|
||||||
|
content: StrictStr = Field(...)
|
||||||
|
__properties = ["task_name", "function_name", "content"]
|
||||||
|
|
||||||
|
@validator('task_name')
|
||||||
|
def task_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in ('cleaning_deep'):
|
||||||
|
raise ValueError("must be one of enum values ('cleaning_deep')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
@validator('function_name')
|
||||||
|
def function_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in ('care_nourish'):
|
||||||
|
raise ValueError("must be one of enum values ('care_nourish')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
"""Pydantic configuration"""
|
||||||
|
allow_population_by_field_name = True
|
||||||
|
validate_assignment = True
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.dict(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> Bathing:
|
||||||
|
"""Create an instance of Bathing from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
"""Returns the dictionary representation of the model using alias"""
|
||||||
|
_dict = self.dict(by_alias=True,
|
||||||
|
exclude={
|
||||||
|
},
|
||||||
|
exclude_none=True)
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: dict) -> Bathing:
|
||||||
|
"""Create an instance of Bathing from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return Bathing.parse_obj(obj)
|
||||||
|
|
||||||
|
_obj = Bathing.parse_obj({
|
||||||
|
"task_name": obj.get("task_name"),
|
||||||
|
"function_name": obj.get("function_name"),
|
||||||
|
"content": obj.get("content")
|
||||||
|
})
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -0,0 +1,89 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
from pydantic import BaseModel, Field, StrictStr, validator
|
||||||
|
|
||||||
|
class Feeding(BaseModel):
|
||||||
|
"""
|
||||||
|
Feeding
|
||||||
|
"""
|
||||||
|
task_name: StrictStr = Field(...)
|
||||||
|
function_name: StrictStr = Field(...)
|
||||||
|
content: StrictStr = Field(...)
|
||||||
|
__properties = ["task_name", "function_name", "content"]
|
||||||
|
|
||||||
|
@validator('task_name')
|
||||||
|
def task_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in ('cleaning'):
|
||||||
|
raise ValueError("must be one of enum values ('cleaning')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
@validator('function_name')
|
||||||
|
def function_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in ('care_nourish'):
|
||||||
|
raise ValueError("must be one of enum values ('care_nourish')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
"""Pydantic configuration"""
|
||||||
|
allow_population_by_field_name = True
|
||||||
|
validate_assignment = True
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.dict(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> Feeding:
|
||||||
|
"""Create an instance of Feeding from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
"""Returns the dictionary representation of the model using alias"""
|
||||||
|
_dict = self.dict(by_alias=True,
|
||||||
|
exclude={
|
||||||
|
},
|
||||||
|
exclude_none=True)
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: dict) -> Feeding:
|
||||||
|
"""Create an instance of Feeding from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return Feeding.parse_obj(obj)
|
||||||
|
|
||||||
|
_obj = Feeding.parse_obj({
|
||||||
|
"task_name": obj.get("task_name"),
|
||||||
|
"function_name": obj.get("function_name"),
|
||||||
|
"content": obj.get("content")
|
||||||
|
})
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -0,0 +1,89 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
from pydantic import BaseModel, Field, StrictStr, validator
|
||||||
|
|
||||||
|
class PoopCleaning(BaseModel):
|
||||||
|
"""
|
||||||
|
PoopCleaning
|
||||||
|
"""
|
||||||
|
task_name: StrictStr = Field(...)
|
||||||
|
function_name: StrictStr = Field(...)
|
||||||
|
content: StrictStr = Field(...)
|
||||||
|
__properties = ["task_name", "function_name", "content"]
|
||||||
|
|
||||||
|
@validator('task_name')
|
||||||
|
def task_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in ('cleaning'):
|
||||||
|
raise ValueError("must be one of enum values ('cleaning')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
@validator('function_name')
|
||||||
|
def function_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in ('care'):
|
||||||
|
raise ValueError("must be one of enum values ('care')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
"""Pydantic configuration"""
|
||||||
|
allow_population_by_field_name = True
|
||||||
|
validate_assignment = True
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.dict(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> PoopCleaning:
|
||||||
|
"""Create an instance of PoopCleaning from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
"""Returns the dictionary representation of the model using alias"""
|
||||||
|
_dict = self.dict(by_alias=True,
|
||||||
|
exclude={
|
||||||
|
},
|
||||||
|
exclude_none=True)
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: dict) -> PoopCleaning:
|
||||||
|
"""Create an instance of PoopCleaning from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return PoopCleaning.parse_obj(obj)
|
||||||
|
|
||||||
|
_obj = PoopCleaning.parse_obj({
|
||||||
|
"task_name": obj.get("task_name"),
|
||||||
|
"function_name": obj.get("function_name"),
|
||||||
|
"content": obj.get("content")
|
||||||
|
})
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -0,0 +1,77 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
from pydantic import BaseModel, Field, StrictStr
|
||||||
|
from petstore_api.models.task_activity import TaskActivity
|
||||||
|
|
||||||
|
class Task(BaseModel):
|
||||||
|
"""
|
||||||
|
Used to test oneOf enums with only one string value. # noqa: E501
|
||||||
|
"""
|
||||||
|
id: StrictStr = Field(...)
|
||||||
|
activity: TaskActivity = Field(...)
|
||||||
|
__properties = ["id", "activity"]
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
"""Pydantic configuration"""
|
||||||
|
allow_population_by_field_name = True
|
||||||
|
validate_assignment = True
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.dict(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> Task:
|
||||||
|
"""Create an instance of Task from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
"""Returns the dictionary representation of the model using alias"""
|
||||||
|
_dict = self.dict(by_alias=True,
|
||||||
|
exclude={
|
||||||
|
},
|
||||||
|
exclude_none=True)
|
||||||
|
# override the default output from pydantic by calling `to_dict()` of activity
|
||||||
|
if self.activity:
|
||||||
|
_dict['activity'] = self.activity.to_dict()
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: dict) -> Task:
|
||||||
|
"""Create an instance of Task from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return Task.parse_obj(obj)
|
||||||
|
|
||||||
|
_obj = Task.parse_obj({
|
||||||
|
"id": obj.get("id"),
|
||||||
|
"activity": TaskActivity.from_dict(obj.get("activity")) if obj.get("activity") is not None else None
|
||||||
|
})
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -0,0 +1,155 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
from inspect import getfullargspec
|
||||||
|
import json
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
|
||||||
|
from typing import Any, List, Optional
|
||||||
|
from pydantic import BaseModel, Field, StrictStr, ValidationError, validator
|
||||||
|
from petstore_api.models.bathing import Bathing
|
||||||
|
from petstore_api.models.feeding import Feeding
|
||||||
|
from petstore_api.models.poop_cleaning import PoopCleaning
|
||||||
|
from typing import Union, Any, List, TYPE_CHECKING
|
||||||
|
from pydantic import StrictStr, Field
|
||||||
|
|
||||||
|
TASKACTIVITY_ONE_OF_SCHEMAS = ["Bathing", "Feeding", "PoopCleaning"]
|
||||||
|
|
||||||
|
class TaskActivity(BaseModel):
|
||||||
|
"""
|
||||||
|
TaskActivity
|
||||||
|
"""
|
||||||
|
# data type: PoopCleaning
|
||||||
|
oneof_schema_1_validator: Optional[PoopCleaning] = None
|
||||||
|
# data type: Feeding
|
||||||
|
oneof_schema_2_validator: Optional[Feeding] = None
|
||||||
|
# data type: Bathing
|
||||||
|
oneof_schema_3_validator: Optional[Bathing] = None
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
actual_instance: Union[Bathing, Feeding, PoopCleaning]
|
||||||
|
else:
|
||||||
|
actual_instance: Any
|
||||||
|
one_of_schemas: List[str] = Field(TASKACTIVITY_ONE_OF_SCHEMAS, const=True)
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
validate_assignment = True
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs) -> None:
|
||||||
|
if args:
|
||||||
|
if len(args) > 1:
|
||||||
|
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
||||||
|
if kwargs:
|
||||||
|
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
||||||
|
super().__init__(actual_instance=args[0])
|
||||||
|
else:
|
||||||
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
|
@validator('actual_instance')
|
||||||
|
def actual_instance_must_validate_oneof(cls, v):
|
||||||
|
instance = TaskActivity.construct()
|
||||||
|
error_messages = []
|
||||||
|
match = 0
|
||||||
|
# validate data type: PoopCleaning
|
||||||
|
if not isinstance(v, PoopCleaning):
|
||||||
|
error_messages.append(f"Error! Input type `{type(v)}` is not `PoopCleaning`")
|
||||||
|
else:
|
||||||
|
match += 1
|
||||||
|
# validate data type: Feeding
|
||||||
|
if not isinstance(v, Feeding):
|
||||||
|
error_messages.append(f"Error! Input type `{type(v)}` is not `Feeding`")
|
||||||
|
else:
|
||||||
|
match += 1
|
||||||
|
# validate data type: Bathing
|
||||||
|
if not isinstance(v, Bathing):
|
||||||
|
error_messages.append(f"Error! Input type `{type(v)}` is not `Bathing`")
|
||||||
|
else:
|
||||||
|
match += 1
|
||||||
|
if match > 1:
|
||||||
|
# more than 1 match
|
||||||
|
raise ValueError("Multiple matches found when setting `actual_instance` in TaskActivity with oneOf schemas: Bathing, Feeding, PoopCleaning. Details: " + ", ".join(error_messages))
|
||||||
|
elif match == 0:
|
||||||
|
# no match
|
||||||
|
raise ValueError("No match found when setting `actual_instance` in TaskActivity with oneOf schemas: Bathing, Feeding, PoopCleaning. Details: " + ", ".join(error_messages))
|
||||||
|
else:
|
||||||
|
return v
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: dict) -> TaskActivity:
|
||||||
|
return cls.from_json(json.dumps(obj))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> TaskActivity:
|
||||||
|
"""Returns the object represented by the json string"""
|
||||||
|
instance = TaskActivity.construct()
|
||||||
|
error_messages = []
|
||||||
|
match = 0
|
||||||
|
|
||||||
|
# deserialize data into PoopCleaning
|
||||||
|
try:
|
||||||
|
instance.actual_instance = PoopCleaning.from_json(json_str)
|
||||||
|
match += 1
|
||||||
|
except (ValidationError, ValueError) as e:
|
||||||
|
error_messages.append(str(e))
|
||||||
|
# deserialize data into Feeding
|
||||||
|
try:
|
||||||
|
instance.actual_instance = Feeding.from_json(json_str)
|
||||||
|
match += 1
|
||||||
|
except (ValidationError, ValueError) as e:
|
||||||
|
error_messages.append(str(e))
|
||||||
|
# deserialize data into Bathing
|
||||||
|
try:
|
||||||
|
instance.actual_instance = Bathing.from_json(json_str)
|
||||||
|
match += 1
|
||||||
|
except (ValidationError, ValueError) as e:
|
||||||
|
error_messages.append(str(e))
|
||||||
|
|
||||||
|
if match > 1:
|
||||||
|
# more than 1 match
|
||||||
|
raise ValueError("Multiple matches found when deserializing the JSON string into TaskActivity with oneOf schemas: Bathing, Feeding, PoopCleaning. Details: " + ", ".join(error_messages))
|
||||||
|
elif match == 0:
|
||||||
|
# no match
|
||||||
|
raise ValueError("No match found when deserializing the JSON string into TaskActivity with oneOf schemas: Bathing, Feeding, PoopCleaning. Details: " + ", ".join(error_messages))
|
||||||
|
else:
|
||||||
|
return instance
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the actual instance"""
|
||||||
|
if self.actual_instance is None:
|
||||||
|
return "null"
|
||||||
|
|
||||||
|
to_json = getattr(self.actual_instance, "to_json", None)
|
||||||
|
if callable(to_json):
|
||||||
|
return self.actual_instance.to_json()
|
||||||
|
else:
|
||||||
|
return json.dumps(self.actual_instance)
|
||||||
|
|
||||||
|
def to_dict(self) -> dict:
|
||||||
|
"""Returns the dict representation of the actual instance"""
|
||||||
|
if self.actual_instance is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
to_dict = getattr(self.actual_instance, "to_dict", None)
|
||||||
|
if callable(to_dict):
|
||||||
|
return self.actual_instance.to_dict()
|
||||||
|
else:
|
||||||
|
# primitive type
|
||||||
|
return self.actual_instance
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the actual instance"""
|
||||||
|
return pprint.pformat(self.dict())
|
||||||
|
|
||||||
|
|
@ -0,0 +1,57 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.bathing import Bathing # noqa: E501
|
||||||
|
|
||||||
|
class TestBathing(unittest.TestCase):
|
||||||
|
"""Bathing unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> Bathing:
|
||||||
|
"""Test Bathing
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `Bathing`
|
||||||
|
"""
|
||||||
|
model = Bathing() # noqa: E501
|
||||||
|
if include_optional:
|
||||||
|
return Bathing(
|
||||||
|
task_name = 'cleaning_deep',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = ''
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return Bathing(
|
||||||
|
task_name = 'cleaning_deep',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = '',
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testBathing(self):
|
||||||
|
"""Test Bathing"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -0,0 +1,57 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.feeding import Feeding # noqa: E501
|
||||||
|
|
||||||
|
class TestFeeding(unittest.TestCase):
|
||||||
|
"""Feeding unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> Feeding:
|
||||||
|
"""Test Feeding
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `Feeding`
|
||||||
|
"""
|
||||||
|
model = Feeding() # noqa: E501
|
||||||
|
if include_optional:
|
||||||
|
return Feeding(
|
||||||
|
task_name = 'cleaning',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = ''
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return Feeding(
|
||||||
|
task_name = 'cleaning',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = '',
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testFeeding(self):
|
||||||
|
"""Test Feeding"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -0,0 +1,57 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.poop_cleaning import PoopCleaning # noqa: E501
|
||||||
|
|
||||||
|
class TestPoopCleaning(unittest.TestCase):
|
||||||
|
"""PoopCleaning unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> PoopCleaning:
|
||||||
|
"""Test PoopCleaning
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `PoopCleaning`
|
||||||
|
"""
|
||||||
|
model = PoopCleaning() # noqa: E501
|
||||||
|
if include_optional:
|
||||||
|
return PoopCleaning(
|
||||||
|
task_name = 'cleaning',
|
||||||
|
function_name = 'care',
|
||||||
|
content = ''
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return PoopCleaning(
|
||||||
|
task_name = 'cleaning',
|
||||||
|
function_name = 'care',
|
||||||
|
content = '',
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testPoopCleaning(self):
|
||||||
|
"""Test PoopCleaning"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -0,0 +1,55 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.task import Task # noqa: E501
|
||||||
|
|
||||||
|
class TestTask(unittest.TestCase):
|
||||||
|
"""Task unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> Task:
|
||||||
|
"""Test Task
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `Task`
|
||||||
|
"""
|
||||||
|
model = Task() # noqa: E501
|
||||||
|
if include_optional:
|
||||||
|
return Task(
|
||||||
|
id = '',
|
||||||
|
activity = None
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return Task(
|
||||||
|
id = '',
|
||||||
|
activity = None,
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testTask(self):
|
||||||
|
"""Test Task"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -0,0 +1,57 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.task_activity import TaskActivity # noqa: E501
|
||||||
|
|
||||||
|
class TestTaskActivity(unittest.TestCase):
|
||||||
|
"""TaskActivity unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> TaskActivity:
|
||||||
|
"""Test TaskActivity
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `TaskActivity`
|
||||||
|
"""
|
||||||
|
model = TaskActivity() # noqa: E501
|
||||||
|
if include_optional:
|
||||||
|
return TaskActivity(
|
||||||
|
task_name = 'cleaning_deep',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = ''
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return TaskActivity(
|
||||||
|
task_name = 'cleaning_deep',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = '',
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testTaskActivity(self):
|
||||||
|
"""Test TaskActivity"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -18,6 +18,7 @@ docs/ArrayOfArrayOfNumberOnly.md
|
|||||||
docs/ArrayOfNumberOnly.md
|
docs/ArrayOfNumberOnly.md
|
||||||
docs/ArrayTest.md
|
docs/ArrayTest.md
|
||||||
docs/BasquePig.md
|
docs/BasquePig.md
|
||||||
|
docs/Bathing.md
|
||||||
docs/Capitalization.md
|
docs/Capitalization.md
|
||||||
docs/Cat.md
|
docs/Cat.md
|
||||||
docs/Category.md
|
docs/Category.md
|
||||||
@ -39,6 +40,7 @@ docs/EnumString2.md
|
|||||||
docs/EnumTest.md
|
docs/EnumTest.md
|
||||||
docs/FakeApi.md
|
docs/FakeApi.md
|
||||||
docs/FakeClassnameTags123Api.md
|
docs/FakeClassnameTags123Api.md
|
||||||
|
docs/Feeding.md
|
||||||
docs/File.md
|
docs/File.md
|
||||||
docs/FileSchemaTestClass.md
|
docs/FileSchemaTestClass.md
|
||||||
docs/FirstRef.md
|
docs/FirstRef.md
|
||||||
@ -74,6 +76,7 @@ docs/ParentWithOptionalDict.md
|
|||||||
docs/Pet.md
|
docs/Pet.md
|
||||||
docs/PetApi.md
|
docs/PetApi.md
|
||||||
docs/Pig.md
|
docs/Pig.md
|
||||||
|
docs/PoopCleaning.md
|
||||||
docs/PropertyNameCollision.md
|
docs/PropertyNameCollision.md
|
||||||
docs/ReadOnlyFirst.md
|
docs/ReadOnlyFirst.md
|
||||||
docs/SecondRef.md
|
docs/SecondRef.md
|
||||||
@ -84,6 +87,8 @@ docs/SpecialModelName.md
|
|||||||
docs/SpecialName.md
|
docs/SpecialName.md
|
||||||
docs/StoreApi.md
|
docs/StoreApi.md
|
||||||
docs/Tag.md
|
docs/Tag.md
|
||||||
|
docs/Task.md
|
||||||
|
docs/TaskActivity.md
|
||||||
docs/TestErrorResponsesWithModel400Response.md
|
docs/TestErrorResponsesWithModel400Response.md
|
||||||
docs/TestErrorResponsesWithModel404Response.md
|
docs/TestErrorResponsesWithModel404Response.md
|
||||||
docs/TestInlineFreeformAdditionalPropertiesRequest.md
|
docs/TestInlineFreeformAdditionalPropertiesRequest.md
|
||||||
@ -122,6 +127,7 @@ petstore_api/models/array_of_array_of_number_only.py
|
|||||||
petstore_api/models/array_of_number_only.py
|
petstore_api/models/array_of_number_only.py
|
||||||
petstore_api/models/array_test.py
|
petstore_api/models/array_test.py
|
||||||
petstore_api/models/basque_pig.py
|
petstore_api/models/basque_pig.py
|
||||||
|
petstore_api/models/bathing.py
|
||||||
petstore_api/models/capitalization.py
|
petstore_api/models/capitalization.py
|
||||||
petstore_api/models/cat.py
|
petstore_api/models/cat.py
|
||||||
petstore_api/models/category.py
|
petstore_api/models/category.py
|
||||||
@ -140,6 +146,7 @@ petstore_api/models/enum_class.py
|
|||||||
petstore_api/models/enum_string1.py
|
petstore_api/models/enum_string1.py
|
||||||
petstore_api/models/enum_string2.py
|
petstore_api/models/enum_string2.py
|
||||||
petstore_api/models/enum_test.py
|
petstore_api/models/enum_test.py
|
||||||
|
petstore_api/models/feeding.py
|
||||||
petstore_api/models/file.py
|
petstore_api/models/file.py
|
||||||
petstore_api/models/file_schema_test_class.py
|
petstore_api/models/file_schema_test_class.py
|
||||||
petstore_api/models/first_ref.py
|
petstore_api/models/first_ref.py
|
||||||
@ -174,6 +181,7 @@ petstore_api/models/parent.py
|
|||||||
petstore_api/models/parent_with_optional_dict.py
|
petstore_api/models/parent_with_optional_dict.py
|
||||||
petstore_api/models/pet.py
|
petstore_api/models/pet.py
|
||||||
petstore_api/models/pig.py
|
petstore_api/models/pig.py
|
||||||
|
petstore_api/models/poop_cleaning.py
|
||||||
petstore_api/models/property_name_collision.py
|
petstore_api/models/property_name_collision.py
|
||||||
petstore_api/models/read_only_first.py
|
petstore_api/models/read_only_first.py
|
||||||
petstore_api/models/second_ref.py
|
petstore_api/models/second_ref.py
|
||||||
@ -183,6 +191,8 @@ petstore_api/models/special_character_enum.py
|
|||||||
petstore_api/models/special_model_name.py
|
petstore_api/models/special_model_name.py
|
||||||
petstore_api/models/special_name.py
|
petstore_api/models/special_name.py
|
||||||
petstore_api/models/tag.py
|
petstore_api/models/tag.py
|
||||||
|
petstore_api/models/task.py
|
||||||
|
petstore_api/models/task_activity.py
|
||||||
petstore_api/models/test_error_responses_with_model400_response.py
|
petstore_api/models/test_error_responses_with_model400_response.py
|
||||||
petstore_api/models/test_error_responses_with_model404_response.py
|
petstore_api/models/test_error_responses_with_model404_response.py
|
||||||
petstore_api/models/test_inline_freeform_additional_properties_request.py
|
petstore_api/models/test_inline_freeform_additional_properties_request.py
|
||||||
|
@ -154,6 +154,7 @@ Class | Method | HTTP request | Description
|
|||||||
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
||||||
- [ArrayTest](docs/ArrayTest.md)
|
- [ArrayTest](docs/ArrayTest.md)
|
||||||
- [BasquePig](docs/BasquePig.md)
|
- [BasquePig](docs/BasquePig.md)
|
||||||
|
- [Bathing](docs/Bathing.md)
|
||||||
- [Capitalization](docs/Capitalization.md)
|
- [Capitalization](docs/Capitalization.md)
|
||||||
- [Cat](docs/Cat.md)
|
- [Cat](docs/Cat.md)
|
||||||
- [Category](docs/Category.md)
|
- [Category](docs/Category.md)
|
||||||
@ -172,6 +173,7 @@ Class | Method | HTTP request | Description
|
|||||||
- [EnumString1](docs/EnumString1.md)
|
- [EnumString1](docs/EnumString1.md)
|
||||||
- [EnumString2](docs/EnumString2.md)
|
- [EnumString2](docs/EnumString2.md)
|
||||||
- [EnumTest](docs/EnumTest.md)
|
- [EnumTest](docs/EnumTest.md)
|
||||||
|
- [Feeding](docs/Feeding.md)
|
||||||
- [File](docs/File.md)
|
- [File](docs/File.md)
|
||||||
- [FileSchemaTestClass](docs/FileSchemaTestClass.md)
|
- [FileSchemaTestClass](docs/FileSchemaTestClass.md)
|
||||||
- [FirstRef](docs/FirstRef.md)
|
- [FirstRef](docs/FirstRef.md)
|
||||||
@ -206,6 +208,7 @@ Class | Method | HTTP request | Description
|
|||||||
- [ParentWithOptionalDict](docs/ParentWithOptionalDict.md)
|
- [ParentWithOptionalDict](docs/ParentWithOptionalDict.md)
|
||||||
- [Pet](docs/Pet.md)
|
- [Pet](docs/Pet.md)
|
||||||
- [Pig](docs/Pig.md)
|
- [Pig](docs/Pig.md)
|
||||||
|
- [PoopCleaning](docs/PoopCleaning.md)
|
||||||
- [PropertyNameCollision](docs/PropertyNameCollision.md)
|
- [PropertyNameCollision](docs/PropertyNameCollision.md)
|
||||||
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
||||||
- [SecondRef](docs/SecondRef.md)
|
- [SecondRef](docs/SecondRef.md)
|
||||||
@ -215,6 +218,8 @@ Class | Method | HTTP request | Description
|
|||||||
- [SpecialModelName](docs/SpecialModelName.md)
|
- [SpecialModelName](docs/SpecialModelName.md)
|
||||||
- [SpecialName](docs/SpecialName.md)
|
- [SpecialName](docs/SpecialName.md)
|
||||||
- [Tag](docs/Tag.md)
|
- [Tag](docs/Tag.md)
|
||||||
|
- [Task](docs/Task.md)
|
||||||
|
- [TaskActivity](docs/TaskActivity.md)
|
||||||
- [TestErrorResponsesWithModel400Response](docs/TestErrorResponsesWithModel400Response.md)
|
- [TestErrorResponsesWithModel400Response](docs/TestErrorResponsesWithModel400Response.md)
|
||||||
- [TestErrorResponsesWithModel404Response](docs/TestErrorResponsesWithModel404Response.md)
|
- [TestErrorResponsesWithModel404Response](docs/TestErrorResponsesWithModel404Response.md)
|
||||||
- [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md)
|
- [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md)
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
# Bathing
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**task_name** | **str** | |
|
||||||
|
**function_name** | **str** | |
|
||||||
|
**content** | **str** | |
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.bathing import Bathing
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of Bathing from a JSON string
|
||||||
|
bathing_instance = Bathing.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print Bathing.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
bathing_dict = bathing_instance.to_dict()
|
||||||
|
# create an instance of Bathing from a dict
|
||||||
|
bathing_form_dict = bathing.from_dict(bathing_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
# Feeding
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**task_name** | **str** | |
|
||||||
|
**function_name** | **str** | |
|
||||||
|
**content** | **str** | |
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.feeding import Feeding
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of Feeding from a JSON string
|
||||||
|
feeding_instance = Feeding.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print Feeding.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
feeding_dict = feeding_instance.to_dict()
|
||||||
|
# create an instance of Feeding from a dict
|
||||||
|
feeding_form_dict = feeding.from_dict(feeding_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
# PoopCleaning
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**task_name** | **str** | |
|
||||||
|
**function_name** | **str** | |
|
||||||
|
**content** | **str** | |
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.poop_cleaning import PoopCleaning
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of PoopCleaning from a JSON string
|
||||||
|
poop_cleaning_instance = PoopCleaning.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print PoopCleaning.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
poop_cleaning_dict = poop_cleaning_instance.to_dict()
|
||||||
|
# create an instance of PoopCleaning from a dict
|
||||||
|
poop_cleaning_form_dict = poop_cleaning.from_dict(poop_cleaning_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
# Task
|
||||||
|
|
||||||
|
Used to test oneOf enums with only one string value.
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**id** | **str** | |
|
||||||
|
**activity** | [**TaskActivity**](TaskActivity.md) | |
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.task import Task
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of Task from a JSON string
|
||||||
|
task_instance = Task.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print Task.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
task_dict = task_instance.to_dict()
|
||||||
|
# create an instance of Task from a dict
|
||||||
|
task_form_dict = task.from_dict(task_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
# TaskActivity
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**task_name** | **str** | |
|
||||||
|
**function_name** | **str** | |
|
||||||
|
**content** | **str** | |
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.task_activity import TaskActivity
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of TaskActivity from a JSON string
|
||||||
|
task_activity_instance = TaskActivity.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print TaskActivity.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
task_activity_dict = task_activity_instance.to_dict()
|
||||||
|
# create an instance of TaskActivity from a dict
|
||||||
|
task_activity_form_dict = task_activity.from_dict(task_activity_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -52,6 +52,7 @@ from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumb
|
|||||||
from petstore_api.models.array_of_number_only import ArrayOfNumberOnly
|
from petstore_api.models.array_of_number_only import ArrayOfNumberOnly
|
||||||
from petstore_api.models.array_test import ArrayTest
|
from petstore_api.models.array_test import ArrayTest
|
||||||
from petstore_api.models.basque_pig import BasquePig
|
from petstore_api.models.basque_pig import BasquePig
|
||||||
|
from petstore_api.models.bathing import Bathing
|
||||||
from petstore_api.models.capitalization import Capitalization
|
from petstore_api.models.capitalization import Capitalization
|
||||||
from petstore_api.models.cat import Cat
|
from petstore_api.models.cat import Cat
|
||||||
from petstore_api.models.category import Category
|
from petstore_api.models.category import Category
|
||||||
@ -70,6 +71,7 @@ from petstore_api.models.enum_class import EnumClass
|
|||||||
from petstore_api.models.enum_string1 import EnumString1
|
from petstore_api.models.enum_string1 import EnumString1
|
||||||
from petstore_api.models.enum_string2 import EnumString2
|
from petstore_api.models.enum_string2 import EnumString2
|
||||||
from petstore_api.models.enum_test import EnumTest
|
from petstore_api.models.enum_test import EnumTest
|
||||||
|
from petstore_api.models.feeding import Feeding
|
||||||
from petstore_api.models.file import File
|
from petstore_api.models.file import File
|
||||||
from petstore_api.models.file_schema_test_class import FileSchemaTestClass
|
from petstore_api.models.file_schema_test_class import FileSchemaTestClass
|
||||||
from petstore_api.models.first_ref import FirstRef
|
from petstore_api.models.first_ref import FirstRef
|
||||||
@ -104,6 +106,7 @@ from petstore_api.models.parent import Parent
|
|||||||
from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict
|
from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict
|
||||||
from petstore_api.models.pet import Pet
|
from petstore_api.models.pet import Pet
|
||||||
from petstore_api.models.pig import Pig
|
from petstore_api.models.pig import Pig
|
||||||
|
from petstore_api.models.poop_cleaning import PoopCleaning
|
||||||
from petstore_api.models.property_name_collision import PropertyNameCollision
|
from petstore_api.models.property_name_collision import PropertyNameCollision
|
||||||
from petstore_api.models.read_only_first import ReadOnlyFirst
|
from petstore_api.models.read_only_first import ReadOnlyFirst
|
||||||
from petstore_api.models.second_ref import SecondRef
|
from petstore_api.models.second_ref import SecondRef
|
||||||
@ -113,6 +116,8 @@ from petstore_api.models.special_character_enum import SpecialCharacterEnum
|
|||||||
from petstore_api.models.special_model_name import SpecialModelName
|
from petstore_api.models.special_model_name import SpecialModelName
|
||||||
from petstore_api.models.special_name import SpecialName
|
from petstore_api.models.special_name import SpecialName
|
||||||
from petstore_api.models.tag import Tag
|
from petstore_api.models.tag import Tag
|
||||||
|
from petstore_api.models.task import Task
|
||||||
|
from petstore_api.models.task_activity import TaskActivity
|
||||||
from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response
|
from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response
|
||||||
from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response
|
from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response
|
||||||
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
||||||
|
@ -28,6 +28,7 @@ from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumb
|
|||||||
from petstore_api.models.array_of_number_only import ArrayOfNumberOnly
|
from petstore_api.models.array_of_number_only import ArrayOfNumberOnly
|
||||||
from petstore_api.models.array_test import ArrayTest
|
from petstore_api.models.array_test import ArrayTest
|
||||||
from petstore_api.models.basque_pig import BasquePig
|
from petstore_api.models.basque_pig import BasquePig
|
||||||
|
from petstore_api.models.bathing import Bathing
|
||||||
from petstore_api.models.capitalization import Capitalization
|
from petstore_api.models.capitalization import Capitalization
|
||||||
from petstore_api.models.cat import Cat
|
from petstore_api.models.cat import Cat
|
||||||
from petstore_api.models.category import Category
|
from petstore_api.models.category import Category
|
||||||
@ -46,6 +47,7 @@ from petstore_api.models.enum_class import EnumClass
|
|||||||
from petstore_api.models.enum_string1 import EnumString1
|
from petstore_api.models.enum_string1 import EnumString1
|
||||||
from petstore_api.models.enum_string2 import EnumString2
|
from petstore_api.models.enum_string2 import EnumString2
|
||||||
from petstore_api.models.enum_test import EnumTest
|
from petstore_api.models.enum_test import EnumTest
|
||||||
|
from petstore_api.models.feeding import Feeding
|
||||||
from petstore_api.models.file import File
|
from petstore_api.models.file import File
|
||||||
from petstore_api.models.file_schema_test_class import FileSchemaTestClass
|
from petstore_api.models.file_schema_test_class import FileSchemaTestClass
|
||||||
from petstore_api.models.first_ref import FirstRef
|
from petstore_api.models.first_ref import FirstRef
|
||||||
@ -80,6 +82,7 @@ from petstore_api.models.parent import Parent
|
|||||||
from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict
|
from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict
|
||||||
from petstore_api.models.pet import Pet
|
from petstore_api.models.pet import Pet
|
||||||
from petstore_api.models.pig import Pig
|
from petstore_api.models.pig import Pig
|
||||||
|
from petstore_api.models.poop_cleaning import PoopCleaning
|
||||||
from petstore_api.models.property_name_collision import PropertyNameCollision
|
from petstore_api.models.property_name_collision import PropertyNameCollision
|
||||||
from petstore_api.models.read_only_first import ReadOnlyFirst
|
from petstore_api.models.read_only_first import ReadOnlyFirst
|
||||||
from petstore_api.models.second_ref import SecondRef
|
from petstore_api.models.second_ref import SecondRef
|
||||||
@ -89,6 +92,8 @@ from petstore_api.models.special_character_enum import SpecialCharacterEnum
|
|||||||
from petstore_api.models.special_model_name import SpecialModelName
|
from petstore_api.models.special_model_name import SpecialModelName
|
||||||
from petstore_api.models.special_name import SpecialName
|
from petstore_api.models.special_name import SpecialName
|
||||||
from petstore_api.models.tag import Tag
|
from petstore_api.models.tag import Tag
|
||||||
|
from petstore_api.models.task import Task
|
||||||
|
from petstore_api.models.task_activity import TaskActivity
|
||||||
from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response
|
from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response
|
||||||
from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response
|
from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response
|
||||||
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
||||||
|
@ -0,0 +1,101 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
from typing import Any, Dict
|
||||||
|
from pydantic import BaseModel, Field, StrictStr, validator
|
||||||
|
|
||||||
|
class Bathing(BaseModel):
|
||||||
|
"""
|
||||||
|
Bathing
|
||||||
|
"""
|
||||||
|
task_name: StrictStr = Field(...)
|
||||||
|
function_name: StrictStr = Field(...)
|
||||||
|
content: StrictStr = Field(...)
|
||||||
|
additional_properties: Dict[str, Any] = {}
|
||||||
|
__properties = ["task_name", "function_name", "content"]
|
||||||
|
|
||||||
|
@validator('task_name')
|
||||||
|
def task_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in ('cleaning_deep'):
|
||||||
|
raise ValueError("must be one of enum values ('cleaning_deep')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
@validator('function_name')
|
||||||
|
def function_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in ('care_nourish'):
|
||||||
|
raise ValueError("must be one of enum values ('care_nourish')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
"""Pydantic configuration"""
|
||||||
|
allow_population_by_field_name = True
|
||||||
|
validate_assignment = True
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.dict(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> Bathing:
|
||||||
|
"""Create an instance of Bathing from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
"""Returns the dictionary representation of the model using alias"""
|
||||||
|
_dict = self.dict(by_alias=True,
|
||||||
|
exclude={
|
||||||
|
"additional_properties"
|
||||||
|
},
|
||||||
|
exclude_none=True)
|
||||||
|
# puts key-value pairs in additional_properties in the top level
|
||||||
|
if self.additional_properties is not None:
|
||||||
|
for _key, _value in self.additional_properties.items():
|
||||||
|
_dict[_key] = _value
|
||||||
|
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: dict) -> Bathing:
|
||||||
|
"""Create an instance of Bathing from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return Bathing.parse_obj(obj)
|
||||||
|
|
||||||
|
_obj = Bathing.parse_obj({
|
||||||
|
"task_name": obj.get("task_name"),
|
||||||
|
"function_name": obj.get("function_name"),
|
||||||
|
"content": obj.get("content")
|
||||||
|
})
|
||||||
|
# store additional fields in additional_properties
|
||||||
|
for _key in obj.keys():
|
||||||
|
if _key not in cls.__properties:
|
||||||
|
_obj.additional_properties[_key] = obj.get(_key)
|
||||||
|
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -0,0 +1,101 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
from typing import Any, Dict
|
||||||
|
from pydantic import BaseModel, Field, StrictStr, validator
|
||||||
|
|
||||||
|
class Feeding(BaseModel):
|
||||||
|
"""
|
||||||
|
Feeding
|
||||||
|
"""
|
||||||
|
task_name: StrictStr = Field(...)
|
||||||
|
function_name: StrictStr = Field(...)
|
||||||
|
content: StrictStr = Field(...)
|
||||||
|
additional_properties: Dict[str, Any] = {}
|
||||||
|
__properties = ["task_name", "function_name", "content"]
|
||||||
|
|
||||||
|
@validator('task_name')
|
||||||
|
def task_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in ('cleaning'):
|
||||||
|
raise ValueError("must be one of enum values ('cleaning')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
@validator('function_name')
|
||||||
|
def function_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in ('care_nourish'):
|
||||||
|
raise ValueError("must be one of enum values ('care_nourish')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
"""Pydantic configuration"""
|
||||||
|
allow_population_by_field_name = True
|
||||||
|
validate_assignment = True
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.dict(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> Feeding:
|
||||||
|
"""Create an instance of Feeding from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
"""Returns the dictionary representation of the model using alias"""
|
||||||
|
_dict = self.dict(by_alias=True,
|
||||||
|
exclude={
|
||||||
|
"additional_properties"
|
||||||
|
},
|
||||||
|
exclude_none=True)
|
||||||
|
# puts key-value pairs in additional_properties in the top level
|
||||||
|
if self.additional_properties is not None:
|
||||||
|
for _key, _value in self.additional_properties.items():
|
||||||
|
_dict[_key] = _value
|
||||||
|
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: dict) -> Feeding:
|
||||||
|
"""Create an instance of Feeding from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return Feeding.parse_obj(obj)
|
||||||
|
|
||||||
|
_obj = Feeding.parse_obj({
|
||||||
|
"task_name": obj.get("task_name"),
|
||||||
|
"function_name": obj.get("function_name"),
|
||||||
|
"content": obj.get("content")
|
||||||
|
})
|
||||||
|
# store additional fields in additional_properties
|
||||||
|
for _key in obj.keys():
|
||||||
|
if _key not in cls.__properties:
|
||||||
|
_obj.additional_properties[_key] = obj.get(_key)
|
||||||
|
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -0,0 +1,101 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
from typing import Any, Dict
|
||||||
|
from pydantic import BaseModel, Field, StrictStr, validator
|
||||||
|
|
||||||
|
class PoopCleaning(BaseModel):
|
||||||
|
"""
|
||||||
|
PoopCleaning
|
||||||
|
"""
|
||||||
|
task_name: StrictStr = Field(...)
|
||||||
|
function_name: StrictStr = Field(...)
|
||||||
|
content: StrictStr = Field(...)
|
||||||
|
additional_properties: Dict[str, Any] = {}
|
||||||
|
__properties = ["task_name", "function_name", "content"]
|
||||||
|
|
||||||
|
@validator('task_name')
|
||||||
|
def task_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in ('cleaning'):
|
||||||
|
raise ValueError("must be one of enum values ('cleaning')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
@validator('function_name')
|
||||||
|
def function_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in ('care'):
|
||||||
|
raise ValueError("must be one of enum values ('care')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
"""Pydantic configuration"""
|
||||||
|
allow_population_by_field_name = True
|
||||||
|
validate_assignment = True
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.dict(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> PoopCleaning:
|
||||||
|
"""Create an instance of PoopCleaning from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
"""Returns the dictionary representation of the model using alias"""
|
||||||
|
_dict = self.dict(by_alias=True,
|
||||||
|
exclude={
|
||||||
|
"additional_properties"
|
||||||
|
},
|
||||||
|
exclude_none=True)
|
||||||
|
# puts key-value pairs in additional_properties in the top level
|
||||||
|
if self.additional_properties is not None:
|
||||||
|
for _key, _value in self.additional_properties.items():
|
||||||
|
_dict[_key] = _value
|
||||||
|
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: dict) -> PoopCleaning:
|
||||||
|
"""Create an instance of PoopCleaning from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return PoopCleaning.parse_obj(obj)
|
||||||
|
|
||||||
|
_obj = PoopCleaning.parse_obj({
|
||||||
|
"task_name": obj.get("task_name"),
|
||||||
|
"function_name": obj.get("function_name"),
|
||||||
|
"content": obj.get("content")
|
||||||
|
})
|
||||||
|
# store additional fields in additional_properties
|
||||||
|
for _key in obj.keys():
|
||||||
|
if _key not in cls.__properties:
|
||||||
|
_obj.additional_properties[_key] = obj.get(_key)
|
||||||
|
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -0,0 +1,89 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
from typing import Any, Dict
|
||||||
|
from pydantic import BaseModel, Field, StrictStr
|
||||||
|
from petstore_api.models.task_activity import TaskActivity
|
||||||
|
|
||||||
|
class Task(BaseModel):
|
||||||
|
"""
|
||||||
|
Used to test oneOf enums with only one string value. # noqa: E501
|
||||||
|
"""
|
||||||
|
id: StrictStr = Field(...)
|
||||||
|
activity: TaskActivity = Field(...)
|
||||||
|
additional_properties: Dict[str, Any] = {}
|
||||||
|
__properties = ["id", "activity"]
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
"""Pydantic configuration"""
|
||||||
|
allow_population_by_field_name = True
|
||||||
|
validate_assignment = True
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.dict(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> Task:
|
||||||
|
"""Create an instance of Task from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
"""Returns the dictionary representation of the model using alias"""
|
||||||
|
_dict = self.dict(by_alias=True,
|
||||||
|
exclude={
|
||||||
|
"additional_properties"
|
||||||
|
},
|
||||||
|
exclude_none=True)
|
||||||
|
# override the default output from pydantic by calling `to_dict()` of activity
|
||||||
|
if self.activity:
|
||||||
|
_dict['activity'] = self.activity.to_dict()
|
||||||
|
# puts key-value pairs in additional_properties in the top level
|
||||||
|
if self.additional_properties is not None:
|
||||||
|
for _key, _value in self.additional_properties.items():
|
||||||
|
_dict[_key] = _value
|
||||||
|
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: dict) -> Task:
|
||||||
|
"""Create an instance of Task from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return Task.parse_obj(obj)
|
||||||
|
|
||||||
|
_obj = Task.parse_obj({
|
||||||
|
"id": obj.get("id"),
|
||||||
|
"activity": TaskActivity.from_dict(obj.get("activity")) if obj.get("activity") is not None else None
|
||||||
|
})
|
||||||
|
# store additional fields in additional_properties
|
||||||
|
for _key in obj.keys():
|
||||||
|
if _key not in cls.__properties:
|
||||||
|
_obj.additional_properties[_key] = obj.get(_key)
|
||||||
|
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -0,0 +1,155 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
from inspect import getfullargspec
|
||||||
|
import json
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
|
||||||
|
from typing import Any, List, Optional
|
||||||
|
from pydantic import BaseModel, Field, StrictStr, ValidationError, validator
|
||||||
|
from petstore_api.models.bathing import Bathing
|
||||||
|
from petstore_api.models.feeding import Feeding
|
||||||
|
from petstore_api.models.poop_cleaning import PoopCleaning
|
||||||
|
from typing import Union, Any, List, TYPE_CHECKING
|
||||||
|
from pydantic import StrictStr, Field
|
||||||
|
|
||||||
|
TASKACTIVITY_ONE_OF_SCHEMAS = ["Bathing", "Feeding", "PoopCleaning"]
|
||||||
|
|
||||||
|
class TaskActivity(BaseModel):
|
||||||
|
"""
|
||||||
|
TaskActivity
|
||||||
|
"""
|
||||||
|
# data type: PoopCleaning
|
||||||
|
oneof_schema_1_validator: Optional[PoopCleaning] = None
|
||||||
|
# data type: Feeding
|
||||||
|
oneof_schema_2_validator: Optional[Feeding] = None
|
||||||
|
# data type: Bathing
|
||||||
|
oneof_schema_3_validator: Optional[Bathing] = None
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
actual_instance: Union[Bathing, Feeding, PoopCleaning]
|
||||||
|
else:
|
||||||
|
actual_instance: Any
|
||||||
|
one_of_schemas: List[str] = Field(TASKACTIVITY_ONE_OF_SCHEMAS, const=True)
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
validate_assignment = True
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs) -> None:
|
||||||
|
if args:
|
||||||
|
if len(args) > 1:
|
||||||
|
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
||||||
|
if kwargs:
|
||||||
|
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
||||||
|
super().__init__(actual_instance=args[0])
|
||||||
|
else:
|
||||||
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
|
@validator('actual_instance')
|
||||||
|
def actual_instance_must_validate_oneof(cls, v):
|
||||||
|
instance = TaskActivity.construct()
|
||||||
|
error_messages = []
|
||||||
|
match = 0
|
||||||
|
# validate data type: PoopCleaning
|
||||||
|
if not isinstance(v, PoopCleaning):
|
||||||
|
error_messages.append(f"Error! Input type `{type(v)}` is not `PoopCleaning`")
|
||||||
|
else:
|
||||||
|
match += 1
|
||||||
|
# validate data type: Feeding
|
||||||
|
if not isinstance(v, Feeding):
|
||||||
|
error_messages.append(f"Error! Input type `{type(v)}` is not `Feeding`")
|
||||||
|
else:
|
||||||
|
match += 1
|
||||||
|
# validate data type: Bathing
|
||||||
|
if not isinstance(v, Bathing):
|
||||||
|
error_messages.append(f"Error! Input type `{type(v)}` is not `Bathing`")
|
||||||
|
else:
|
||||||
|
match += 1
|
||||||
|
if match > 1:
|
||||||
|
# more than 1 match
|
||||||
|
raise ValueError("Multiple matches found when setting `actual_instance` in TaskActivity with oneOf schemas: Bathing, Feeding, PoopCleaning. Details: " + ", ".join(error_messages))
|
||||||
|
elif match == 0:
|
||||||
|
# no match
|
||||||
|
raise ValueError("No match found when setting `actual_instance` in TaskActivity with oneOf schemas: Bathing, Feeding, PoopCleaning. Details: " + ", ".join(error_messages))
|
||||||
|
else:
|
||||||
|
return v
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: dict) -> TaskActivity:
|
||||||
|
return cls.from_json(json.dumps(obj))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> TaskActivity:
|
||||||
|
"""Returns the object represented by the json string"""
|
||||||
|
instance = TaskActivity.construct()
|
||||||
|
error_messages = []
|
||||||
|
match = 0
|
||||||
|
|
||||||
|
# deserialize data into PoopCleaning
|
||||||
|
try:
|
||||||
|
instance.actual_instance = PoopCleaning.from_json(json_str)
|
||||||
|
match += 1
|
||||||
|
except (ValidationError, ValueError) as e:
|
||||||
|
error_messages.append(str(e))
|
||||||
|
# deserialize data into Feeding
|
||||||
|
try:
|
||||||
|
instance.actual_instance = Feeding.from_json(json_str)
|
||||||
|
match += 1
|
||||||
|
except (ValidationError, ValueError) as e:
|
||||||
|
error_messages.append(str(e))
|
||||||
|
# deserialize data into Bathing
|
||||||
|
try:
|
||||||
|
instance.actual_instance = Bathing.from_json(json_str)
|
||||||
|
match += 1
|
||||||
|
except (ValidationError, ValueError) as e:
|
||||||
|
error_messages.append(str(e))
|
||||||
|
|
||||||
|
if match > 1:
|
||||||
|
# more than 1 match
|
||||||
|
raise ValueError("Multiple matches found when deserializing the JSON string into TaskActivity with oneOf schemas: Bathing, Feeding, PoopCleaning. Details: " + ", ".join(error_messages))
|
||||||
|
elif match == 0:
|
||||||
|
# no match
|
||||||
|
raise ValueError("No match found when deserializing the JSON string into TaskActivity with oneOf schemas: Bathing, Feeding, PoopCleaning. Details: " + ", ".join(error_messages))
|
||||||
|
else:
|
||||||
|
return instance
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the actual instance"""
|
||||||
|
if self.actual_instance is None:
|
||||||
|
return "null"
|
||||||
|
|
||||||
|
to_json = getattr(self.actual_instance, "to_json", None)
|
||||||
|
if callable(to_json):
|
||||||
|
return self.actual_instance.to_json()
|
||||||
|
else:
|
||||||
|
return json.dumps(self.actual_instance)
|
||||||
|
|
||||||
|
def to_dict(self) -> dict:
|
||||||
|
"""Returns the dict representation of the actual instance"""
|
||||||
|
if self.actual_instance is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
to_dict = getattr(self.actual_instance, "to_dict", None)
|
||||||
|
if callable(to_dict):
|
||||||
|
return self.actual_instance.to_dict()
|
||||||
|
else:
|
||||||
|
# primitive type
|
||||||
|
return self.actual_instance
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the actual instance"""
|
||||||
|
return pprint.pformat(self.dict())
|
||||||
|
|
||||||
|
|
@ -0,0 +1,57 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.bathing import Bathing # noqa: E501
|
||||||
|
|
||||||
|
class TestBathing(unittest.TestCase):
|
||||||
|
"""Bathing unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> Bathing:
|
||||||
|
"""Test Bathing
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `Bathing`
|
||||||
|
"""
|
||||||
|
model = Bathing() # noqa: E501
|
||||||
|
if include_optional:
|
||||||
|
return Bathing(
|
||||||
|
task_name = 'cleaning_deep',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = ''
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return Bathing(
|
||||||
|
task_name = 'cleaning_deep',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = '',
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testBathing(self):
|
||||||
|
"""Test Bathing"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -0,0 +1,57 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.feeding import Feeding # noqa: E501
|
||||||
|
|
||||||
|
class TestFeeding(unittest.TestCase):
|
||||||
|
"""Feeding unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> Feeding:
|
||||||
|
"""Test Feeding
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `Feeding`
|
||||||
|
"""
|
||||||
|
model = Feeding() # noqa: E501
|
||||||
|
if include_optional:
|
||||||
|
return Feeding(
|
||||||
|
task_name = 'cleaning',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = ''
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return Feeding(
|
||||||
|
task_name = 'cleaning',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = '',
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testFeeding(self):
|
||||||
|
"""Test Feeding"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -0,0 +1,57 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.poop_cleaning import PoopCleaning # noqa: E501
|
||||||
|
|
||||||
|
class TestPoopCleaning(unittest.TestCase):
|
||||||
|
"""PoopCleaning unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> PoopCleaning:
|
||||||
|
"""Test PoopCleaning
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `PoopCleaning`
|
||||||
|
"""
|
||||||
|
model = PoopCleaning() # noqa: E501
|
||||||
|
if include_optional:
|
||||||
|
return PoopCleaning(
|
||||||
|
task_name = 'cleaning',
|
||||||
|
function_name = 'care',
|
||||||
|
content = ''
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return PoopCleaning(
|
||||||
|
task_name = 'cleaning',
|
||||||
|
function_name = 'care',
|
||||||
|
content = '',
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testPoopCleaning(self):
|
||||||
|
"""Test PoopCleaning"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -0,0 +1,55 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.task import Task # noqa: E501
|
||||||
|
|
||||||
|
class TestTask(unittest.TestCase):
|
||||||
|
"""Task unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> Task:
|
||||||
|
"""Test Task
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `Task`
|
||||||
|
"""
|
||||||
|
model = Task() # noqa: E501
|
||||||
|
if include_optional:
|
||||||
|
return Task(
|
||||||
|
id = '',
|
||||||
|
activity = None
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return Task(
|
||||||
|
id = '',
|
||||||
|
activity = None,
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testTask(self):
|
||||||
|
"""Test Task"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -0,0 +1,57 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.task_activity import TaskActivity # noqa: E501
|
||||||
|
|
||||||
|
class TestTaskActivity(unittest.TestCase):
|
||||||
|
"""TaskActivity unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> TaskActivity:
|
||||||
|
"""Test TaskActivity
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `TaskActivity`
|
||||||
|
"""
|
||||||
|
model = TaskActivity() # noqa: E501
|
||||||
|
if include_optional:
|
||||||
|
return TaskActivity(
|
||||||
|
task_name = 'cleaning_deep',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = ''
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return TaskActivity(
|
||||||
|
task_name = 'cleaning_deep',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = '',
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testTaskActivity(self):
|
||||||
|
"""Test TaskActivity"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -17,6 +17,7 @@ docs/ArrayOfArrayOfNumberOnly.md
|
|||||||
docs/ArrayOfNumberOnly.md
|
docs/ArrayOfNumberOnly.md
|
||||||
docs/ArrayTest.md
|
docs/ArrayTest.md
|
||||||
docs/BasquePig.md
|
docs/BasquePig.md
|
||||||
|
docs/Bathing.md
|
||||||
docs/Capitalization.md
|
docs/Capitalization.md
|
||||||
docs/Cat.md
|
docs/Cat.md
|
||||||
docs/Category.md
|
docs/Category.md
|
||||||
@ -38,6 +39,7 @@ docs/EnumString2.md
|
|||||||
docs/EnumTest.md
|
docs/EnumTest.md
|
||||||
docs/FakeApi.md
|
docs/FakeApi.md
|
||||||
docs/FakeClassnameTags123Api.md
|
docs/FakeClassnameTags123Api.md
|
||||||
|
docs/Feeding.md
|
||||||
docs/File.md
|
docs/File.md
|
||||||
docs/FileSchemaTestClass.md
|
docs/FileSchemaTestClass.md
|
||||||
docs/FirstRef.md
|
docs/FirstRef.md
|
||||||
@ -74,6 +76,7 @@ docs/ParentWithOptionalDict.md
|
|||||||
docs/Pet.md
|
docs/Pet.md
|
||||||
docs/PetApi.md
|
docs/PetApi.md
|
||||||
docs/Pig.md
|
docs/Pig.md
|
||||||
|
docs/PoopCleaning.md
|
||||||
docs/PropertyNameCollision.md
|
docs/PropertyNameCollision.md
|
||||||
docs/ReadOnlyFirst.md
|
docs/ReadOnlyFirst.md
|
||||||
docs/SecondRef.md
|
docs/SecondRef.md
|
||||||
@ -84,6 +87,8 @@ docs/SpecialModelName.md
|
|||||||
docs/SpecialName.md
|
docs/SpecialName.md
|
||||||
docs/StoreApi.md
|
docs/StoreApi.md
|
||||||
docs/Tag.md
|
docs/Tag.md
|
||||||
|
docs/Task.md
|
||||||
|
docs/TaskActivity.md
|
||||||
docs/TestErrorResponsesWithModel400Response.md
|
docs/TestErrorResponsesWithModel400Response.md
|
||||||
docs/TestErrorResponsesWithModel404Response.md
|
docs/TestErrorResponsesWithModel404Response.md
|
||||||
docs/TestInlineFreeformAdditionalPropertiesRequest.md
|
docs/TestInlineFreeformAdditionalPropertiesRequest.md
|
||||||
@ -121,6 +126,7 @@ petstore_api/models/array_of_array_of_number_only.py
|
|||||||
petstore_api/models/array_of_number_only.py
|
petstore_api/models/array_of_number_only.py
|
||||||
petstore_api/models/array_test.py
|
petstore_api/models/array_test.py
|
||||||
petstore_api/models/basque_pig.py
|
petstore_api/models/basque_pig.py
|
||||||
|
petstore_api/models/bathing.py
|
||||||
petstore_api/models/capitalization.py
|
petstore_api/models/capitalization.py
|
||||||
petstore_api/models/cat.py
|
petstore_api/models/cat.py
|
||||||
petstore_api/models/category.py
|
petstore_api/models/category.py
|
||||||
@ -139,6 +145,7 @@ petstore_api/models/enum_class.py
|
|||||||
petstore_api/models/enum_string1.py
|
petstore_api/models/enum_string1.py
|
||||||
petstore_api/models/enum_string2.py
|
petstore_api/models/enum_string2.py
|
||||||
petstore_api/models/enum_test.py
|
petstore_api/models/enum_test.py
|
||||||
|
petstore_api/models/feeding.py
|
||||||
petstore_api/models/file.py
|
petstore_api/models/file.py
|
||||||
petstore_api/models/file_schema_test_class.py
|
petstore_api/models/file_schema_test_class.py
|
||||||
petstore_api/models/first_ref.py
|
petstore_api/models/first_ref.py
|
||||||
@ -174,6 +181,7 @@ petstore_api/models/parent.py
|
|||||||
petstore_api/models/parent_with_optional_dict.py
|
petstore_api/models/parent_with_optional_dict.py
|
||||||
petstore_api/models/pet.py
|
petstore_api/models/pet.py
|
||||||
petstore_api/models/pig.py
|
petstore_api/models/pig.py
|
||||||
|
petstore_api/models/poop_cleaning.py
|
||||||
petstore_api/models/property_name_collision.py
|
petstore_api/models/property_name_collision.py
|
||||||
petstore_api/models/read_only_first.py
|
petstore_api/models/read_only_first.py
|
||||||
petstore_api/models/second_ref.py
|
petstore_api/models/second_ref.py
|
||||||
@ -183,6 +191,8 @@ petstore_api/models/special_character_enum.py
|
|||||||
petstore_api/models/special_model_name.py
|
petstore_api/models/special_model_name.py
|
||||||
petstore_api/models/special_name.py
|
petstore_api/models/special_name.py
|
||||||
petstore_api/models/tag.py
|
petstore_api/models/tag.py
|
||||||
|
petstore_api/models/task.py
|
||||||
|
petstore_api/models/task_activity.py
|
||||||
petstore_api/models/test_error_responses_with_model400_response.py
|
petstore_api/models/test_error_responses_with_model400_response.py
|
||||||
petstore_api/models/test_error_responses_with_model404_response.py
|
petstore_api/models/test_error_responses_with_model404_response.py
|
||||||
petstore_api/models/test_inline_freeform_additional_properties_request.py
|
petstore_api/models/test_inline_freeform_additional_properties_request.py
|
||||||
|
@ -152,6 +152,7 @@ Class | Method | HTTP request | Description
|
|||||||
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
||||||
- [ArrayTest](docs/ArrayTest.md)
|
- [ArrayTest](docs/ArrayTest.md)
|
||||||
- [BasquePig](docs/BasquePig.md)
|
- [BasquePig](docs/BasquePig.md)
|
||||||
|
- [Bathing](docs/Bathing.md)
|
||||||
- [Capitalization](docs/Capitalization.md)
|
- [Capitalization](docs/Capitalization.md)
|
||||||
- [Cat](docs/Cat.md)
|
- [Cat](docs/Cat.md)
|
||||||
- [Category](docs/Category.md)
|
- [Category](docs/Category.md)
|
||||||
@ -170,6 +171,7 @@ Class | Method | HTTP request | Description
|
|||||||
- [EnumString1](docs/EnumString1.md)
|
- [EnumString1](docs/EnumString1.md)
|
||||||
- [EnumString2](docs/EnumString2.md)
|
- [EnumString2](docs/EnumString2.md)
|
||||||
- [EnumTest](docs/EnumTest.md)
|
- [EnumTest](docs/EnumTest.md)
|
||||||
|
- [Feeding](docs/Feeding.md)
|
||||||
- [File](docs/File.md)
|
- [File](docs/File.md)
|
||||||
- [FileSchemaTestClass](docs/FileSchemaTestClass.md)
|
- [FileSchemaTestClass](docs/FileSchemaTestClass.md)
|
||||||
- [FirstRef](docs/FirstRef.md)
|
- [FirstRef](docs/FirstRef.md)
|
||||||
@ -205,6 +207,7 @@ Class | Method | HTTP request | Description
|
|||||||
- [ParentWithOptionalDict](docs/ParentWithOptionalDict.md)
|
- [ParentWithOptionalDict](docs/ParentWithOptionalDict.md)
|
||||||
- [Pet](docs/Pet.md)
|
- [Pet](docs/Pet.md)
|
||||||
- [Pig](docs/Pig.md)
|
- [Pig](docs/Pig.md)
|
||||||
|
- [PoopCleaning](docs/PoopCleaning.md)
|
||||||
- [PropertyNameCollision](docs/PropertyNameCollision.md)
|
- [PropertyNameCollision](docs/PropertyNameCollision.md)
|
||||||
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
||||||
- [SecondRef](docs/SecondRef.md)
|
- [SecondRef](docs/SecondRef.md)
|
||||||
@ -214,6 +217,8 @@ Class | Method | HTTP request | Description
|
|||||||
- [SpecialModelName](docs/SpecialModelName.md)
|
- [SpecialModelName](docs/SpecialModelName.md)
|
||||||
- [SpecialName](docs/SpecialName.md)
|
- [SpecialName](docs/SpecialName.md)
|
||||||
- [Tag](docs/Tag.md)
|
- [Tag](docs/Tag.md)
|
||||||
|
- [Task](docs/Task.md)
|
||||||
|
- [TaskActivity](docs/TaskActivity.md)
|
||||||
- [TestErrorResponsesWithModel400Response](docs/TestErrorResponsesWithModel400Response.md)
|
- [TestErrorResponsesWithModel400Response](docs/TestErrorResponsesWithModel400Response.md)
|
||||||
- [TestErrorResponsesWithModel404Response](docs/TestErrorResponsesWithModel404Response.md)
|
- [TestErrorResponsesWithModel404Response](docs/TestErrorResponsesWithModel404Response.md)
|
||||||
- [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md)
|
- [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md)
|
||||||
|
31
samples/openapi3/client/petstore/python/docs/Bathing.md
Normal file
31
samples/openapi3/client/petstore/python/docs/Bathing.md
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# Bathing
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**task_name** | **str** | |
|
||||||
|
**function_name** | **str** | |
|
||||||
|
**content** | **str** | |
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.bathing import Bathing
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of Bathing from a JSON string
|
||||||
|
bathing_instance = Bathing.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print Bathing.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
bathing_dict = bathing_instance.to_dict()
|
||||||
|
# create an instance of Bathing from a dict
|
||||||
|
bathing_form_dict = bathing.from_dict(bathing_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
31
samples/openapi3/client/petstore/python/docs/Feeding.md
Normal file
31
samples/openapi3/client/petstore/python/docs/Feeding.md
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# Feeding
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**task_name** | **str** | |
|
||||||
|
**function_name** | **str** | |
|
||||||
|
**content** | **str** | |
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.feeding import Feeding
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of Feeding from a JSON string
|
||||||
|
feeding_instance = Feeding.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print Feeding.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
feeding_dict = feeding_instance.to_dict()
|
||||||
|
# create an instance of Feeding from a dict
|
||||||
|
feeding_form_dict = feeding.from_dict(feeding_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
31
samples/openapi3/client/petstore/python/docs/PoopCleaning.md
Normal file
31
samples/openapi3/client/petstore/python/docs/PoopCleaning.md
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# PoopCleaning
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**task_name** | **str** | |
|
||||||
|
**function_name** | **str** | |
|
||||||
|
**content** | **str** | |
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.poop_cleaning import PoopCleaning
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of PoopCleaning from a JSON string
|
||||||
|
poop_cleaning_instance = PoopCleaning.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print PoopCleaning.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
poop_cleaning_dict = poop_cleaning_instance.to_dict()
|
||||||
|
# create an instance of PoopCleaning from a dict
|
||||||
|
poop_cleaning_form_dict = poop_cleaning.from_dict(poop_cleaning_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
31
samples/openapi3/client/petstore/python/docs/Task.md
Normal file
31
samples/openapi3/client/petstore/python/docs/Task.md
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# Task
|
||||||
|
|
||||||
|
Used to test oneOf enums with only one string value.
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**id** | **str** | |
|
||||||
|
**activity** | [**TaskActivity**](TaskActivity.md) | |
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.task import Task
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of Task from a JSON string
|
||||||
|
task_instance = Task.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print Task.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
task_dict = task_instance.to_dict()
|
||||||
|
# create an instance of Task from a dict
|
||||||
|
task_form_dict = task.from_dict(task_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
31
samples/openapi3/client/petstore/python/docs/TaskActivity.md
Normal file
31
samples/openapi3/client/petstore/python/docs/TaskActivity.md
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# TaskActivity
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**task_name** | **str** | |
|
||||||
|
**function_name** | **str** | |
|
||||||
|
**content** | **str** | |
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from petstore_api.models.task_activity import TaskActivity
|
||||||
|
|
||||||
|
# TODO update the JSON string below
|
||||||
|
json = "{}"
|
||||||
|
# create an instance of TaskActivity from a JSON string
|
||||||
|
task_activity_instance = TaskActivity.from_json(json)
|
||||||
|
# print the JSON string representation of the object
|
||||||
|
print TaskActivity.to_json()
|
||||||
|
|
||||||
|
# convert the object into a dict
|
||||||
|
task_activity_dict = task_activity_instance.to_dict()
|
||||||
|
# create an instance of TaskActivity from a dict
|
||||||
|
task_activity_form_dict = task_activity.from_dict(task_activity_dict)
|
||||||
|
```
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -51,6 +51,7 @@ from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumb
|
|||||||
from petstore_api.models.array_of_number_only import ArrayOfNumberOnly
|
from petstore_api.models.array_of_number_only import ArrayOfNumberOnly
|
||||||
from petstore_api.models.array_test import ArrayTest
|
from petstore_api.models.array_test import ArrayTest
|
||||||
from petstore_api.models.basque_pig import BasquePig
|
from petstore_api.models.basque_pig import BasquePig
|
||||||
|
from petstore_api.models.bathing import Bathing
|
||||||
from petstore_api.models.capitalization import Capitalization
|
from petstore_api.models.capitalization import Capitalization
|
||||||
from petstore_api.models.cat import Cat
|
from petstore_api.models.cat import Cat
|
||||||
from petstore_api.models.category import Category
|
from petstore_api.models.category import Category
|
||||||
@ -69,6 +70,7 @@ from petstore_api.models.enum_class import EnumClass
|
|||||||
from petstore_api.models.enum_string1 import EnumString1
|
from petstore_api.models.enum_string1 import EnumString1
|
||||||
from petstore_api.models.enum_string2 import EnumString2
|
from petstore_api.models.enum_string2 import EnumString2
|
||||||
from petstore_api.models.enum_test import EnumTest
|
from petstore_api.models.enum_test import EnumTest
|
||||||
|
from petstore_api.models.feeding import Feeding
|
||||||
from petstore_api.models.file import File
|
from petstore_api.models.file import File
|
||||||
from petstore_api.models.file_schema_test_class import FileSchemaTestClass
|
from petstore_api.models.file_schema_test_class import FileSchemaTestClass
|
||||||
from petstore_api.models.first_ref import FirstRef
|
from petstore_api.models.first_ref import FirstRef
|
||||||
@ -104,6 +106,7 @@ from petstore_api.models.parent import Parent
|
|||||||
from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict
|
from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict
|
||||||
from petstore_api.models.pet import Pet
|
from petstore_api.models.pet import Pet
|
||||||
from petstore_api.models.pig import Pig
|
from petstore_api.models.pig import Pig
|
||||||
|
from petstore_api.models.poop_cleaning import PoopCleaning
|
||||||
from petstore_api.models.property_name_collision import PropertyNameCollision
|
from petstore_api.models.property_name_collision import PropertyNameCollision
|
||||||
from petstore_api.models.read_only_first import ReadOnlyFirst
|
from petstore_api.models.read_only_first import ReadOnlyFirst
|
||||||
from petstore_api.models.second_ref import SecondRef
|
from petstore_api.models.second_ref import SecondRef
|
||||||
@ -113,6 +116,8 @@ from petstore_api.models.special_character_enum import SpecialCharacterEnum
|
|||||||
from petstore_api.models.special_model_name import SpecialModelName
|
from petstore_api.models.special_model_name import SpecialModelName
|
||||||
from petstore_api.models.special_name import SpecialName
|
from petstore_api.models.special_name import SpecialName
|
||||||
from petstore_api.models.tag import Tag
|
from petstore_api.models.tag import Tag
|
||||||
|
from petstore_api.models.task import Task
|
||||||
|
from petstore_api.models.task_activity import TaskActivity
|
||||||
from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response
|
from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response
|
||||||
from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response
|
from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response
|
||||||
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
||||||
|
@ -27,6 +27,7 @@ from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumb
|
|||||||
from petstore_api.models.array_of_number_only import ArrayOfNumberOnly
|
from petstore_api.models.array_of_number_only import ArrayOfNumberOnly
|
||||||
from petstore_api.models.array_test import ArrayTest
|
from petstore_api.models.array_test import ArrayTest
|
||||||
from petstore_api.models.basque_pig import BasquePig
|
from petstore_api.models.basque_pig import BasquePig
|
||||||
|
from petstore_api.models.bathing import Bathing
|
||||||
from petstore_api.models.capitalization import Capitalization
|
from petstore_api.models.capitalization import Capitalization
|
||||||
from petstore_api.models.cat import Cat
|
from petstore_api.models.cat import Cat
|
||||||
from petstore_api.models.category import Category
|
from petstore_api.models.category import Category
|
||||||
@ -45,6 +46,7 @@ from petstore_api.models.enum_class import EnumClass
|
|||||||
from petstore_api.models.enum_string1 import EnumString1
|
from petstore_api.models.enum_string1 import EnumString1
|
||||||
from petstore_api.models.enum_string2 import EnumString2
|
from petstore_api.models.enum_string2 import EnumString2
|
||||||
from petstore_api.models.enum_test import EnumTest
|
from petstore_api.models.enum_test import EnumTest
|
||||||
|
from petstore_api.models.feeding import Feeding
|
||||||
from petstore_api.models.file import File
|
from petstore_api.models.file import File
|
||||||
from petstore_api.models.file_schema_test_class import FileSchemaTestClass
|
from petstore_api.models.file_schema_test_class import FileSchemaTestClass
|
||||||
from petstore_api.models.first_ref import FirstRef
|
from petstore_api.models.first_ref import FirstRef
|
||||||
@ -80,6 +82,7 @@ from petstore_api.models.parent import Parent
|
|||||||
from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict
|
from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict
|
||||||
from petstore_api.models.pet import Pet
|
from petstore_api.models.pet import Pet
|
||||||
from petstore_api.models.pig import Pig
|
from petstore_api.models.pig import Pig
|
||||||
|
from petstore_api.models.poop_cleaning import PoopCleaning
|
||||||
from petstore_api.models.property_name_collision import PropertyNameCollision
|
from petstore_api.models.property_name_collision import PropertyNameCollision
|
||||||
from petstore_api.models.read_only_first import ReadOnlyFirst
|
from petstore_api.models.read_only_first import ReadOnlyFirst
|
||||||
from petstore_api.models.second_ref import SecondRef
|
from petstore_api.models.second_ref import SecondRef
|
||||||
@ -89,6 +92,8 @@ from petstore_api.models.special_character_enum import SpecialCharacterEnum
|
|||||||
from petstore_api.models.special_model_name import SpecialModelName
|
from petstore_api.models.special_model_name import SpecialModelName
|
||||||
from petstore_api.models.special_name import SpecialName
|
from petstore_api.models.special_name import SpecialName
|
||||||
from petstore_api.models.tag import Tag
|
from petstore_api.models.tag import Tag
|
||||||
|
from petstore_api.models.task import Task
|
||||||
|
from petstore_api.models.task_activity import TaskActivity
|
||||||
from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response
|
from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response
|
||||||
from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response
|
from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response
|
||||||
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest
|
||||||
|
@ -0,0 +1,118 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
from pydantic import BaseModel, StrictStr, field_validator
|
||||||
|
from typing import Any, ClassVar, Dict, List
|
||||||
|
from typing import Optional, Set
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
class Bathing(BaseModel):
|
||||||
|
"""
|
||||||
|
Bathing
|
||||||
|
""" # noqa: E501
|
||||||
|
task_name: StrictStr
|
||||||
|
function_name: StrictStr
|
||||||
|
content: StrictStr
|
||||||
|
additional_properties: Dict[str, Any] = {}
|
||||||
|
__properties: ClassVar[List[str]] = ["task_name", "function_name", "content"]
|
||||||
|
|
||||||
|
@field_validator('task_name')
|
||||||
|
def task_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in set(['cleaning_deep']):
|
||||||
|
raise ValueError("must be one of enum values ('cleaning_deep')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
@field_validator('function_name')
|
||||||
|
def function_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in set(['care_nourish']):
|
||||||
|
raise ValueError("must be one of enum values ('care_nourish')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
model_config = {
|
||||||
|
"populate_by_name": True,
|
||||||
|
"validate_assignment": True,
|
||||||
|
"protected_namespaces": (),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.model_dump(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||||
|
"""Create an instance of Bathing from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
|
"""Return the dictionary representation of the model using alias.
|
||||||
|
|
||||||
|
This has the following differences from calling pydantic's
|
||||||
|
`self.model_dump(by_alias=True)`:
|
||||||
|
|
||||||
|
* `None` is only added to the output dict for nullable fields that
|
||||||
|
were set at model initialization. Other fields with value `None`
|
||||||
|
are ignored.
|
||||||
|
* Fields in `self.additional_properties` are added to the output dict.
|
||||||
|
"""
|
||||||
|
excluded_fields: Set[str] = set([
|
||||||
|
"additional_properties",
|
||||||
|
])
|
||||||
|
|
||||||
|
_dict = self.model_dump(
|
||||||
|
by_alias=True,
|
||||||
|
exclude=excluded_fields,
|
||||||
|
exclude_none=True,
|
||||||
|
)
|
||||||
|
# puts key-value pairs in additional_properties in the top level
|
||||||
|
if self.additional_properties is not None:
|
||||||
|
for _key, _value in self.additional_properties.items():
|
||||||
|
_dict[_key] = _value
|
||||||
|
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||||
|
"""Create an instance of Bathing from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return cls.model_validate(obj)
|
||||||
|
|
||||||
|
_obj = cls.model_validate({
|
||||||
|
"task_name": obj.get("task_name"),
|
||||||
|
"function_name": obj.get("function_name"),
|
||||||
|
"content": obj.get("content")
|
||||||
|
})
|
||||||
|
# store additional fields in additional_properties
|
||||||
|
for _key in obj.keys():
|
||||||
|
if _key not in cls.__properties:
|
||||||
|
_obj.additional_properties[_key] = obj.get(_key)
|
||||||
|
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -37,7 +37,7 @@ class EnumArrays(BaseModel):
|
|||||||
if value is None:
|
if value is None:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
if value not in ('>=', '$'):
|
if value not in set(['>=', '$']):
|
||||||
raise ValueError("must be one of enum values ('>=', '$')")
|
raise ValueError("must be one of enum values ('>=', '$')")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ class EnumArrays(BaseModel):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
for i in value:
|
for i in value:
|
||||||
if i not in ('fish', 'crab'):
|
if i not in set(['fish', 'crab']):
|
||||||
raise ValueError("each list item must be one of ('fish', 'crab')")
|
raise ValueError("each list item must be one of ('fish', 'crab')")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
@ -48,14 +48,14 @@ class EnumTest(BaseModel):
|
|||||||
if value is None:
|
if value is None:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
if value not in ('UPPER', 'lower', ''):
|
if value not in set(['UPPER', 'lower', '']):
|
||||||
raise ValueError("must be one of enum values ('UPPER', 'lower', '')")
|
raise ValueError("must be one of enum values ('UPPER', 'lower', '')")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@field_validator('enum_string_required')
|
@field_validator('enum_string_required')
|
||||||
def enum_string_required_validate_enum(cls, value):
|
def enum_string_required_validate_enum(cls, value):
|
||||||
"""Validates the enum"""
|
"""Validates the enum"""
|
||||||
if value not in ('UPPER', 'lower', ''):
|
if value not in set(['UPPER', 'lower', '']):
|
||||||
raise ValueError("must be one of enum values ('UPPER', 'lower', '')")
|
raise ValueError("must be one of enum values ('UPPER', 'lower', '')")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ class EnumTest(BaseModel):
|
|||||||
if value is None:
|
if value is None:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
if value not in (1, 5, 14):
|
if value not in set([1, 5, 14]):
|
||||||
raise ValueError("must be one of enum values (1, 5, 14)")
|
raise ValueError("must be one of enum values (1, 5, 14)")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ class EnumTest(BaseModel):
|
|||||||
if value is None:
|
if value is None:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
if value not in (1, -1):
|
if value not in set([1, -1]):
|
||||||
raise ValueError("must be one of enum values (1, -1)")
|
raise ValueError("must be one of enum values (1, -1)")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ class EnumTest(BaseModel):
|
|||||||
if value is None:
|
if value is None:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
if value not in (1.1, -1.2):
|
if value not in set([1.1, -1.2]):
|
||||||
raise ValueError("must be one of enum values (1.1, -1.2)")
|
raise ValueError("must be one of enum values (1.1, -1.2)")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
@ -0,0 +1,118 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
from pydantic import BaseModel, StrictStr, field_validator
|
||||||
|
from typing import Any, ClassVar, Dict, List
|
||||||
|
from typing import Optional, Set
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
class Feeding(BaseModel):
|
||||||
|
"""
|
||||||
|
Feeding
|
||||||
|
""" # noqa: E501
|
||||||
|
task_name: StrictStr
|
||||||
|
function_name: StrictStr
|
||||||
|
content: StrictStr
|
||||||
|
additional_properties: Dict[str, Any] = {}
|
||||||
|
__properties: ClassVar[List[str]] = ["task_name", "function_name", "content"]
|
||||||
|
|
||||||
|
@field_validator('task_name')
|
||||||
|
def task_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in set(['cleaning']):
|
||||||
|
raise ValueError("must be one of enum values ('cleaning')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
@field_validator('function_name')
|
||||||
|
def function_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in set(['care_nourish']):
|
||||||
|
raise ValueError("must be one of enum values ('care_nourish')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
model_config = {
|
||||||
|
"populate_by_name": True,
|
||||||
|
"validate_assignment": True,
|
||||||
|
"protected_namespaces": (),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.model_dump(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||||
|
"""Create an instance of Feeding from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
|
"""Return the dictionary representation of the model using alias.
|
||||||
|
|
||||||
|
This has the following differences from calling pydantic's
|
||||||
|
`self.model_dump(by_alias=True)`:
|
||||||
|
|
||||||
|
* `None` is only added to the output dict for nullable fields that
|
||||||
|
were set at model initialization. Other fields with value `None`
|
||||||
|
are ignored.
|
||||||
|
* Fields in `self.additional_properties` are added to the output dict.
|
||||||
|
"""
|
||||||
|
excluded_fields: Set[str] = set([
|
||||||
|
"additional_properties",
|
||||||
|
])
|
||||||
|
|
||||||
|
_dict = self.model_dump(
|
||||||
|
by_alias=True,
|
||||||
|
exclude=excluded_fields,
|
||||||
|
exclude_none=True,
|
||||||
|
)
|
||||||
|
# puts key-value pairs in additional_properties in the top level
|
||||||
|
if self.additional_properties is not None:
|
||||||
|
for _key, _value in self.additional_properties.items():
|
||||||
|
_dict[_key] = _value
|
||||||
|
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||||
|
"""Create an instance of Feeding from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return cls.model_validate(obj)
|
||||||
|
|
||||||
|
_obj = cls.model_validate({
|
||||||
|
"task_name": obj.get("task_name"),
|
||||||
|
"function_name": obj.get("function_name"),
|
||||||
|
"content": obj.get("content")
|
||||||
|
})
|
||||||
|
# store additional fields in additional_properties
|
||||||
|
for _key in obj.keys():
|
||||||
|
if _key not in cls.__properties:
|
||||||
|
_obj.additional_properties[_key] = obj.get(_key)
|
||||||
|
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -39,7 +39,7 @@ class MapTest(BaseModel):
|
|||||||
if value is None:
|
if value is None:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
if value not in ('UPPER', 'lower'):
|
if value not in set(['UPPER', 'lower']):
|
||||||
raise ValueError("must be one of enum values ('UPPER', 'lower')")
|
raise ValueError("must be one of enum values ('UPPER', 'lower')")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class Order(BaseModel):
|
|||||||
if value is None:
|
if value is None:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
if value not in ('placed', 'approved', 'delivered'):
|
if value not in set(['placed', 'approved', 'delivered']):
|
||||||
raise ValueError("must be one of enum values ('placed', 'approved', 'delivered')")
|
raise ValueError("must be one of enum values ('placed', 'approved', 'delivered')")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class Pet(BaseModel):
|
|||||||
if value is None:
|
if value is None:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
if value not in ('available', 'pending', 'sold'):
|
if value not in set(['available', 'pending', 'sold']):
|
||||||
raise ValueError("must be one of enum values ('available', 'pending', 'sold')")
|
raise ValueError("must be one of enum values ('available', 'pending', 'sold')")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
@ -0,0 +1,118 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
from pydantic import BaseModel, StrictStr, field_validator
|
||||||
|
from typing import Any, ClassVar, Dict, List
|
||||||
|
from typing import Optional, Set
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
class PoopCleaning(BaseModel):
|
||||||
|
"""
|
||||||
|
PoopCleaning
|
||||||
|
""" # noqa: E501
|
||||||
|
task_name: StrictStr
|
||||||
|
function_name: StrictStr
|
||||||
|
content: StrictStr
|
||||||
|
additional_properties: Dict[str, Any] = {}
|
||||||
|
__properties: ClassVar[List[str]] = ["task_name", "function_name", "content"]
|
||||||
|
|
||||||
|
@field_validator('task_name')
|
||||||
|
def task_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in set(['cleaning']):
|
||||||
|
raise ValueError("must be one of enum values ('cleaning')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
@field_validator('function_name')
|
||||||
|
def function_name_validate_enum(cls, value):
|
||||||
|
"""Validates the enum"""
|
||||||
|
if value not in set(['care']):
|
||||||
|
raise ValueError("must be one of enum values ('care')")
|
||||||
|
return value
|
||||||
|
|
||||||
|
model_config = {
|
||||||
|
"populate_by_name": True,
|
||||||
|
"validate_assignment": True,
|
||||||
|
"protected_namespaces": (),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.model_dump(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||||
|
"""Create an instance of PoopCleaning from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
|
"""Return the dictionary representation of the model using alias.
|
||||||
|
|
||||||
|
This has the following differences from calling pydantic's
|
||||||
|
`self.model_dump(by_alias=True)`:
|
||||||
|
|
||||||
|
* `None` is only added to the output dict for nullable fields that
|
||||||
|
were set at model initialization. Other fields with value `None`
|
||||||
|
are ignored.
|
||||||
|
* Fields in `self.additional_properties` are added to the output dict.
|
||||||
|
"""
|
||||||
|
excluded_fields: Set[str] = set([
|
||||||
|
"additional_properties",
|
||||||
|
])
|
||||||
|
|
||||||
|
_dict = self.model_dump(
|
||||||
|
by_alias=True,
|
||||||
|
exclude=excluded_fields,
|
||||||
|
exclude_none=True,
|
||||||
|
)
|
||||||
|
# puts key-value pairs in additional_properties in the top level
|
||||||
|
if self.additional_properties is not None:
|
||||||
|
for _key, _value in self.additional_properties.items():
|
||||||
|
_dict[_key] = _value
|
||||||
|
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||||
|
"""Create an instance of PoopCleaning from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return cls.model_validate(obj)
|
||||||
|
|
||||||
|
_obj = cls.model_validate({
|
||||||
|
"task_name": obj.get("task_name"),
|
||||||
|
"function_name": obj.get("function_name"),
|
||||||
|
"content": obj.get("content")
|
||||||
|
})
|
||||||
|
# store additional fields in additional_properties
|
||||||
|
for _key in obj.keys():
|
||||||
|
if _key not in cls.__properties:
|
||||||
|
_obj.additional_properties[_key] = obj.get(_key)
|
||||||
|
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -39,7 +39,7 @@ class SpecialName(BaseModel):
|
|||||||
if value is None:
|
if value is None:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
if value not in ('available', 'pending', 'sold'):
|
if value not in set(['available', 'pending', 'sold']):
|
||||||
raise ValueError("must be one of enum values ('available', 'pending', 'sold')")
|
raise ValueError("must be one of enum values ('available', 'pending', 'sold')")
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
@ -0,0 +1,106 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import pprint
|
||||||
|
import re # noqa: F401
|
||||||
|
import json
|
||||||
|
|
||||||
|
from pydantic import BaseModel, StrictStr
|
||||||
|
from typing import Any, ClassVar, Dict, List
|
||||||
|
from petstore_api.models.task_activity import TaskActivity
|
||||||
|
from typing import Optional, Set
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
class Task(BaseModel):
|
||||||
|
"""
|
||||||
|
Used to test oneOf enums with only one string value.
|
||||||
|
""" # noqa: E501
|
||||||
|
id: StrictStr
|
||||||
|
activity: TaskActivity
|
||||||
|
additional_properties: Dict[str, Any] = {}
|
||||||
|
__properties: ClassVar[List[str]] = ["id", "activity"]
|
||||||
|
|
||||||
|
model_config = {
|
||||||
|
"populate_by_name": True,
|
||||||
|
"validate_assignment": True,
|
||||||
|
"protected_namespaces": (),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the model using alias"""
|
||||||
|
return pprint.pformat(self.model_dump(by_alias=True))
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the model using alias"""
|
||||||
|
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||||
|
return json.dumps(self.to_dict())
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||||
|
"""Create an instance of Task from a JSON string"""
|
||||||
|
return cls.from_dict(json.loads(json_str))
|
||||||
|
|
||||||
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
|
"""Return the dictionary representation of the model using alias.
|
||||||
|
|
||||||
|
This has the following differences from calling pydantic's
|
||||||
|
`self.model_dump(by_alias=True)`:
|
||||||
|
|
||||||
|
* `None` is only added to the output dict for nullable fields that
|
||||||
|
were set at model initialization. Other fields with value `None`
|
||||||
|
are ignored.
|
||||||
|
* Fields in `self.additional_properties` are added to the output dict.
|
||||||
|
"""
|
||||||
|
excluded_fields: Set[str] = set([
|
||||||
|
"additional_properties",
|
||||||
|
])
|
||||||
|
|
||||||
|
_dict = self.model_dump(
|
||||||
|
by_alias=True,
|
||||||
|
exclude=excluded_fields,
|
||||||
|
exclude_none=True,
|
||||||
|
)
|
||||||
|
# override the default output from pydantic by calling `to_dict()` of activity
|
||||||
|
if self.activity:
|
||||||
|
_dict['activity'] = self.activity.to_dict()
|
||||||
|
# puts key-value pairs in additional_properties in the top level
|
||||||
|
if self.additional_properties is not None:
|
||||||
|
for _key, _value in self.additional_properties.items():
|
||||||
|
_dict[_key] = _value
|
||||||
|
|
||||||
|
return _dict
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||||
|
"""Create an instance of Task from a dict"""
|
||||||
|
if obj is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if not isinstance(obj, dict):
|
||||||
|
return cls.model_validate(obj)
|
||||||
|
|
||||||
|
_obj = cls.model_validate({
|
||||||
|
"id": obj.get("id"),
|
||||||
|
"activity": TaskActivity.from_dict(obj["activity"]) if obj.get("activity") is not None else None
|
||||||
|
})
|
||||||
|
# store additional fields in additional_properties
|
||||||
|
for _key in obj.keys():
|
||||||
|
if _key not in cls.__properties:
|
||||||
|
_obj.additional_properties[_key] = obj.get(_key)
|
||||||
|
|
||||||
|
return _obj
|
||||||
|
|
||||||
|
|
@ -0,0 +1,151 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
import json
|
||||||
|
import pprint
|
||||||
|
from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
|
||||||
|
from typing import Any, List, Optional
|
||||||
|
from petstore_api.models.bathing import Bathing
|
||||||
|
from petstore_api.models.feeding import Feeding
|
||||||
|
from petstore_api.models.poop_cleaning import PoopCleaning
|
||||||
|
from pydantic import StrictStr, Field
|
||||||
|
from typing import Union, List, Optional, Dict
|
||||||
|
from typing_extensions import Literal, Self
|
||||||
|
|
||||||
|
TASKACTIVITY_ONE_OF_SCHEMAS = ["Bathing", "Feeding", "PoopCleaning"]
|
||||||
|
|
||||||
|
class TaskActivity(BaseModel):
|
||||||
|
"""
|
||||||
|
TaskActivity
|
||||||
|
"""
|
||||||
|
# data type: PoopCleaning
|
||||||
|
oneof_schema_1_validator: Optional[PoopCleaning] = None
|
||||||
|
# data type: Feeding
|
||||||
|
oneof_schema_2_validator: Optional[Feeding] = None
|
||||||
|
# data type: Bathing
|
||||||
|
oneof_schema_3_validator: Optional[Bathing] = None
|
||||||
|
actual_instance: Optional[Union[Bathing, Feeding, PoopCleaning]] = None
|
||||||
|
one_of_schemas: List[str] = Field(default=Literal["Bathing", "Feeding", "PoopCleaning"])
|
||||||
|
|
||||||
|
model_config = {
|
||||||
|
"validate_assignment": True,
|
||||||
|
"protected_namespaces": (),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs) -> None:
|
||||||
|
if args:
|
||||||
|
if len(args) > 1:
|
||||||
|
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
||||||
|
if kwargs:
|
||||||
|
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
||||||
|
super().__init__(actual_instance=args[0])
|
||||||
|
else:
|
||||||
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
|
@field_validator('actual_instance')
|
||||||
|
def actual_instance_must_validate_oneof(cls, v):
|
||||||
|
instance = TaskActivity.model_construct()
|
||||||
|
error_messages = []
|
||||||
|
match = 0
|
||||||
|
# validate data type: PoopCleaning
|
||||||
|
if not isinstance(v, PoopCleaning):
|
||||||
|
error_messages.append(f"Error! Input type `{type(v)}` is not `PoopCleaning`")
|
||||||
|
else:
|
||||||
|
match += 1
|
||||||
|
# validate data type: Feeding
|
||||||
|
if not isinstance(v, Feeding):
|
||||||
|
error_messages.append(f"Error! Input type `{type(v)}` is not `Feeding`")
|
||||||
|
else:
|
||||||
|
match += 1
|
||||||
|
# validate data type: Bathing
|
||||||
|
if not isinstance(v, Bathing):
|
||||||
|
error_messages.append(f"Error! Input type `{type(v)}` is not `Bathing`")
|
||||||
|
else:
|
||||||
|
match += 1
|
||||||
|
if match > 1:
|
||||||
|
# more than 1 match
|
||||||
|
raise ValueError("Multiple matches found when setting `actual_instance` in TaskActivity with oneOf schemas: Bathing, Feeding, PoopCleaning. Details: " + ", ".join(error_messages))
|
||||||
|
elif match == 0:
|
||||||
|
# no match
|
||||||
|
raise ValueError("No match found when setting `actual_instance` in TaskActivity with oneOf schemas: Bathing, Feeding, PoopCleaning. Details: " + ", ".join(error_messages))
|
||||||
|
else:
|
||||||
|
return v
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
||||||
|
return cls.from_json(json.dumps(obj))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_json(cls, json_str: str) -> Self:
|
||||||
|
"""Returns the object represented by the json string"""
|
||||||
|
instance = cls.model_construct()
|
||||||
|
error_messages = []
|
||||||
|
match = 0
|
||||||
|
|
||||||
|
# deserialize data into PoopCleaning
|
||||||
|
try:
|
||||||
|
instance.actual_instance = PoopCleaning.from_json(json_str)
|
||||||
|
match += 1
|
||||||
|
except (ValidationError, ValueError) as e:
|
||||||
|
error_messages.append(str(e))
|
||||||
|
# deserialize data into Feeding
|
||||||
|
try:
|
||||||
|
instance.actual_instance = Feeding.from_json(json_str)
|
||||||
|
match += 1
|
||||||
|
except (ValidationError, ValueError) as e:
|
||||||
|
error_messages.append(str(e))
|
||||||
|
# deserialize data into Bathing
|
||||||
|
try:
|
||||||
|
instance.actual_instance = Bathing.from_json(json_str)
|
||||||
|
match += 1
|
||||||
|
except (ValidationError, ValueError) as e:
|
||||||
|
error_messages.append(str(e))
|
||||||
|
|
||||||
|
if match > 1:
|
||||||
|
# more than 1 match
|
||||||
|
raise ValueError("Multiple matches found when deserializing the JSON string into TaskActivity with oneOf schemas: Bathing, Feeding, PoopCleaning. Details: " + ", ".join(error_messages))
|
||||||
|
elif match == 0:
|
||||||
|
# no match
|
||||||
|
raise ValueError("No match found when deserializing the JSON string into TaskActivity with oneOf schemas: Bathing, Feeding, PoopCleaning. Details: " + ", ".join(error_messages))
|
||||||
|
else:
|
||||||
|
return instance
|
||||||
|
|
||||||
|
def to_json(self) -> str:
|
||||||
|
"""Returns the JSON representation of the actual instance"""
|
||||||
|
if self.actual_instance is None:
|
||||||
|
return "null"
|
||||||
|
|
||||||
|
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
||||||
|
return self.actual_instance.to_json()
|
||||||
|
else:
|
||||||
|
return json.dumps(self.actual_instance)
|
||||||
|
|
||||||
|
def to_dict(self) -> Optional[Union[Dict[str, Any], Bathing, Feeding, PoopCleaning]]:
|
||||||
|
"""Returns the dict representation of the actual instance"""
|
||||||
|
if self.actual_instance is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
||||||
|
return self.actual_instance.to_dict()
|
||||||
|
else:
|
||||||
|
# primitive type
|
||||||
|
return self.actual_instance
|
||||||
|
|
||||||
|
def to_str(self) -> str:
|
||||||
|
"""Returns the string representation of the actual instance"""
|
||||||
|
return pprint.pformat(self.model_dump())
|
||||||
|
|
||||||
|
|
57
samples/openapi3/client/petstore/python/test/test_bathing.py
Normal file
57
samples/openapi3/client/petstore/python/test/test_bathing.py
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.bathing import Bathing
|
||||||
|
|
||||||
|
class TestBathing(unittest.TestCase):
|
||||||
|
"""Bathing unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> Bathing:
|
||||||
|
"""Test Bathing
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `Bathing`
|
||||||
|
"""
|
||||||
|
model = Bathing()
|
||||||
|
if include_optional:
|
||||||
|
return Bathing(
|
||||||
|
task_name = 'cleaning_deep',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = ''
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return Bathing(
|
||||||
|
task_name = 'cleaning_deep',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = '',
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testBathing(self):
|
||||||
|
"""Test Bathing"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
57
samples/openapi3/client/petstore/python/test/test_feeding.py
Normal file
57
samples/openapi3/client/petstore/python/test/test_feeding.py
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.feeding import Feeding
|
||||||
|
|
||||||
|
class TestFeeding(unittest.TestCase):
|
||||||
|
"""Feeding unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> Feeding:
|
||||||
|
"""Test Feeding
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `Feeding`
|
||||||
|
"""
|
||||||
|
model = Feeding()
|
||||||
|
if include_optional:
|
||||||
|
return Feeding(
|
||||||
|
task_name = 'cleaning',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = ''
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return Feeding(
|
||||||
|
task_name = 'cleaning',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = '',
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testFeeding(self):
|
||||||
|
"""Test Feeding"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -0,0 +1,57 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.poop_cleaning import PoopCleaning
|
||||||
|
|
||||||
|
class TestPoopCleaning(unittest.TestCase):
|
||||||
|
"""PoopCleaning unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> PoopCleaning:
|
||||||
|
"""Test PoopCleaning
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `PoopCleaning`
|
||||||
|
"""
|
||||||
|
model = PoopCleaning()
|
||||||
|
if include_optional:
|
||||||
|
return PoopCleaning(
|
||||||
|
task_name = 'cleaning',
|
||||||
|
function_name = 'care',
|
||||||
|
content = ''
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return PoopCleaning(
|
||||||
|
task_name = 'cleaning',
|
||||||
|
function_name = 'care',
|
||||||
|
content = '',
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testPoopCleaning(self):
|
||||||
|
"""Test PoopCleaning"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
55
samples/openapi3/client/petstore/python/test/test_task.py
Normal file
55
samples/openapi3/client/petstore/python/test/test_task.py
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.task import Task
|
||||||
|
|
||||||
|
class TestTask(unittest.TestCase):
|
||||||
|
"""Task unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> Task:
|
||||||
|
"""Test Task
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `Task`
|
||||||
|
"""
|
||||||
|
model = Task()
|
||||||
|
if include_optional:
|
||||||
|
return Task(
|
||||||
|
id = '',
|
||||||
|
activity = None
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return Task(
|
||||||
|
id = '',
|
||||||
|
activity = None,
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testTask(self):
|
||||||
|
"""Test Task"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
@ -0,0 +1,57 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
OpenAPI Petstore
|
||||||
|
|
||||||
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 1.0.0
|
||||||
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
Do not edit the class manually.
|
||||||
|
""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from petstore_api.models.task_activity import TaskActivity
|
||||||
|
|
||||||
|
class TestTaskActivity(unittest.TestCase):
|
||||||
|
"""TaskActivity unit test stubs"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def make_instance(self, include_optional) -> TaskActivity:
|
||||||
|
"""Test TaskActivity
|
||||||
|
include_option is a boolean, when False only required
|
||||||
|
params are included, when True both required and
|
||||||
|
optional params are included """
|
||||||
|
# uncomment below to create an instance of `TaskActivity`
|
||||||
|
"""
|
||||||
|
model = TaskActivity()
|
||||||
|
if include_optional:
|
||||||
|
return TaskActivity(
|
||||||
|
task_name = 'cleaning_deep',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = ''
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return TaskActivity(
|
||||||
|
task_name = 'cleaning_deep',
|
||||||
|
function_name = 'care_nourish',
|
||||||
|
content = '',
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def testTaskActivity(self):
|
||||||
|
"""Test TaskActivity"""
|
||||||
|
# inst_req_only = self.make_instance(include_optional=False)
|
||||||
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
Loading…
x
Reference in New Issue
Block a user