Skip to content

Commit c176f1d

Browse files
committed
update
1 parent c58b4e5 commit c176f1d

118 files changed

Lines changed: 5323 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2975,3 +2975,30 @@ components:
29752975
type: string
29762976
recursive:
29772977
type: boolean
2978+
2979+
Known:
2980+
type: object
2981+
required:
2982+
- kind
2983+
properties:
2984+
kind:
2985+
type: string
2986+
enum:
2987+
- known
2988+
2989+
Other:
2990+
type: object
2991+
required:
2992+
- kind
2993+
properties:
2994+
kind:
2995+
type: string
2996+
not:
2997+
enum:
2998+
- known
2999+
- reserved
3000+
3001+
TaggedUnion:
3002+
oneOf:
3003+
- $ref: '#/components/schemas/Known'
3004+
- $ref: '#/components/schemas/Other'

‎samples/openapi3/client/petstore/python-aiohttp/.openapi-generator/FILES‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ docs/Info.md
6565
docs/InnerDictWithProperty.md
6666
docs/InputAllOf.md
6767
docs/IntOrString.md
68+
docs/Known.md
6869
docs/ListClass.md
6970
docs/MapOfArrayOfModel.md
7071
docs/MapTest.md
@@ -82,6 +83,7 @@ docs/ObjectToTestAdditionalProperties.md
8283
docs/ObjectWithDeprecatedFields.md
8384
docs/OneOfEnumString.md
8485
docs/Order.md
86+
docs/Other.md
8587
docs/OuterComposite.md
8688
docs/OuterEnum.md
8789
docs/OuterEnumDefaultValue.md
@@ -108,6 +110,7 @@ docs/SpecialModelName.md
108110
docs/SpecialName.md
109111
docs/StoreApi.md
110112
docs/Tag.md
113+
docs/TaggedUnion.md
111114
docs/Task.md
112115
docs/TaskActivity.md
113116
docs/TestEnum.md
@@ -199,6 +202,7 @@ petstore_api/models/info.py
199202
petstore_api/models/inner_dict_with_property.py
200203
petstore_api/models/input_all_of.py
201204
petstore_api/models/int_or_string.py
205+
petstore_api/models/known.py
202206
petstore_api/models/list_class.py
203207
petstore_api/models/map_of_array_of_model.py
204208
petstore_api/models/map_test.py
@@ -216,6 +220,7 @@ petstore_api/models/object_to_test_additional_properties.py
216220
petstore_api/models/object_with_deprecated_fields.py
217221
petstore_api/models/one_of_enum_string.py
218222
petstore_api/models/order.py
223+
petstore_api/models/other.py
219224
petstore_api/models/outer_composite.py
220225
petstore_api/models/outer_enum.py
221226
petstore_api/models/outer_enum_default_value.py
@@ -240,6 +245,7 @@ petstore_api/models/special_character_enum.py
240245
petstore_api/models/special_model_name.py
241246
petstore_api/models/special_name.py
242247
petstore_api/models/tag.py
248+
petstore_api/models/tagged_union.py
243249
petstore_api/models/task.py
244250
petstore_api/models/task_activity.py
245251
petstore_api/models/test_enum.py

‎samples/openapi3/client/petstore/python-aiohttp/README.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ Class | Method | HTTP request | Description
236236
- [InnerDictWithProperty](docs/InnerDictWithProperty.md)
237237
- [InputAllOf](docs/InputAllOf.md)
238238
- [IntOrString](docs/IntOrString.md)
239+
- [Known](docs/Known.md)
239240
- [ListClass](docs/ListClass.md)
240241
- [MapOfArrayOfModel](docs/MapOfArrayOfModel.md)
241242
- [MapTest](docs/MapTest.md)
@@ -253,6 +254,7 @@ Class | Method | HTTP request | Description
253254
- [ObjectWithDeprecatedFields](docs/ObjectWithDeprecatedFields.md)
254255
- [OneOfEnumString](docs/OneOfEnumString.md)
255256
- [Order](docs/Order.md)
257+
- [Other](docs/Other.md)
256258
- [OuterComposite](docs/OuterComposite.md)
257259
- [OuterEnum](docs/OuterEnum.md)
258260
- [OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md)
@@ -277,6 +279,7 @@ Class | Method | HTTP request | Description
277279
- [SpecialModelName](docs/SpecialModelName.md)
278280
- [SpecialName](docs/SpecialName.md)
279281
- [Tag](docs/Tag.md)
282+
- [TaggedUnion](docs/TaggedUnion.md)
280283
- [Task](docs/Task.md)
281284
- [TaskActivity](docs/TaskActivity.md)
282285
- [TestEnum](docs/TestEnum.md)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Known
2+
3+
4+
## Properties
5+
6+
Name | Type | Description | Notes
7+
------------ | ------------- | ------------- | -------------
8+
**kind** | **str** | |
9+
10+
## Example
11+
12+
```python
13+
from petstore_api.models.known import Known
14+
15+
# TODO update the JSON string below
16+
json = "{}"
17+
# create an instance of Known from a JSON string
18+
known_instance = Known.from_json(json)
19+
# print the JSON string representation of the object
20+
print(Known.to_json())
21+
22+
# convert the object into a dict
23+
known_dict = known_instance.to_dict()
24+
# create an instance of Known from a dict
25+
known_from_dict = Known.from_dict(known_dict)
26+
```
27+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
28+
29+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Other
2+
3+
4+
## Properties
5+
6+
Name | Type | Description | Notes
7+
------------ | ------------- | ------------- | -------------
8+
**kind** | **str** | |
9+
10+
## Example
11+
12+
```python
13+
from petstore_api.models.other import Other
14+
15+
# TODO update the JSON string below
16+
json = "{}"
17+
# create an instance of Other from a JSON string
18+
other_instance = Other.from_json(json)
19+
# print the JSON string representation of the object
20+
print(Other.to_json())
21+
22+
# convert the object into a dict
23+
other_dict = other_instance.to_dict()
24+
# create an instance of Other from a dict
25+
other_from_dict = Other.from_dict(other_dict)
26+
```
27+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
28+
29+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# TaggedUnion
2+
3+
4+
## Properties
5+
6+
Name | Type | Description | Notes
7+
------------ | ------------- | ------------- | -------------
8+
**kind** | **str** | |
9+
10+
## Example
11+
12+
```python
13+
from petstore_api.models.tagged_union import TaggedUnion
14+
15+
# TODO update the JSON string below
16+
json = "{}"
17+
# create an instance of TaggedUnion from a JSON string
18+
tagged_union_instance = TaggedUnion.from_json(json)
19+
# print the JSON string representation of the object
20+
print(TaggedUnion.to_json())
21+
22+
# convert the object into a dict
23+
tagged_union_dict = tagged_union_instance.to_dict()
24+
# create an instance of TaggedUnion from a dict
25+
tagged_union_from_dict = TaggedUnion.from_dict(tagged_union_dict)
26+
```
27+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
28+
29+

‎samples/openapi3/client/petstore/python-aiohttp/petstore_api/__init__.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
"InnerDictWithProperty",
9494
"InputAllOf",
9595
"IntOrString",
96+
"Known",
9697
"ListClass",
9798
"MapOfArrayOfModel",
9899
"MapTest",
@@ -110,6 +111,7 @@
110111
"ObjectWithDeprecatedFields",
111112
"OneOfEnumString",
112113
"Order",
114+
"Other",
113115
"OuterComposite",
114116
"OuterEnum",
115117
"OuterEnumDefaultValue",
@@ -134,6 +136,7 @@
134136
"SpecialModelName",
135137
"SpecialName",
136138
"Tag",
139+
"TaggedUnion",
137140
"Task",
138141
"TaskActivity",
139142
"TestEnum",
@@ -233,6 +236,7 @@
233236
from petstore_api.models.inner_dict_with_property import InnerDictWithProperty as InnerDictWithProperty
234237
from petstore_api.models.input_all_of import InputAllOf as InputAllOf
235238
from petstore_api.models.int_or_string import IntOrString as IntOrString
239+
from petstore_api.models.known import Known as Known
236240
from petstore_api.models.list_class import ListClass as ListClass
237241
from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel as MapOfArrayOfModel
238242
from petstore_api.models.map_test import MapTest as MapTest
@@ -250,6 +254,7 @@
250254
from petstore_api.models.object_with_deprecated_fields import ObjectWithDeprecatedFields as ObjectWithDeprecatedFields
251255
from petstore_api.models.one_of_enum_string import OneOfEnumString as OneOfEnumString
252256
from petstore_api.models.order import Order as Order
257+
from petstore_api.models.other import Other as Other
253258
from petstore_api.models.outer_composite import OuterComposite as OuterComposite
254259
from petstore_api.models.outer_enum import OuterEnum as OuterEnum
255260
from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue as OuterEnumDefaultValue
@@ -274,6 +279,7 @@
274279
from petstore_api.models.special_model_name import SpecialModelName as SpecialModelName
275280
from petstore_api.models.special_name import SpecialName as SpecialName
276281
from petstore_api.models.tag import Tag as Tag
282+
from petstore_api.models.tagged_union import TaggedUnion as TaggedUnion
277283
from petstore_api.models.task import Task as Task
278284
from petstore_api.models.task_activity import TaskActivity as TaskActivity
279285
from petstore_api.models.test_enum import TestEnum as TestEnum

‎samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/__init__.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
from petstore_api.models.inner_dict_with_property import InnerDictWithProperty
7171
from petstore_api.models.input_all_of import InputAllOf
7272
from petstore_api.models.int_or_string import IntOrString
73+
from petstore_api.models.known import Known
7374
from petstore_api.models.list_class import ListClass
7475
from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel
7576
from petstore_api.models.map_test import MapTest
@@ -87,6 +88,7 @@
8788
from petstore_api.models.object_with_deprecated_fields import ObjectWithDeprecatedFields
8889
from petstore_api.models.one_of_enum_string import OneOfEnumString
8990
from petstore_api.models.order import Order
91+
from petstore_api.models.other import Other
9092
from petstore_api.models.outer_composite import OuterComposite
9193
from petstore_api.models.outer_enum import OuterEnum
9294
from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue
@@ -111,6 +113,7 @@
111113
from petstore_api.models.special_model_name import SpecialModelName
112114
from petstore_api.models.special_name import SpecialName
113115
from petstore_api.models.tag import Tag
116+
from petstore_api.models.tagged_union import TaggedUnion
114117
from petstore_api.models.task import Task
115118
from petstore_api.models.task_activity import TaskActivity
116119
from petstore_api.models.test_enum import TestEnum
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# coding: utf-8
2+
3+
"""
4+
OpenAPI Petstore
5+
6+
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
7+
8+
The version of the OpenAPI document: 1.0.0
9+
Generated by OpenAPI Generator (https://openapi-generator.tech)
10+
11+
Do not edit the class manually.
12+
""" # noqa: E501
13+
14+
15+
from __future__ import annotations
16+
import pprint
17+
import re # noqa: F401
18+
import json
19+
20+
from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
21+
from typing import Any, ClassVar, Dict, List
22+
from typing import Optional, Set
23+
from typing_extensions import Self
24+
from pydantic_core import to_jsonable_python
25+
26+
class Known(BaseModel):
27+
"""
28+
Known
29+
""" # noqa: E501
30+
kind: StrictStr
31+
__properties: ClassVar[List[str]] = ["kind"]
32+
33+
@field_validator('kind')
34+
def kind_validate_enum(cls, value):
35+
"""Validates the enum"""
36+
if value not in set(['known']):
37+
raise ValueError("must be one of enum values ('known')")
38+
return value
39+
40+
model_config = ConfigDict(
41+
validate_by_name=True,
42+
validate_by_alias=True,
43+
validate_assignment=True,
44+
protected_namespaces=(),
45+
)
46+
47+
48+
def to_str(self) -> str:
49+
"""Returns the string representation of the model using alias"""
50+
return pprint.pformat(self.model_dump(by_alias=True))
51+
52+
def to_json(self) -> str:
53+
"""Returns the JSON representation of the model using alias"""
54+
return json.dumps(to_jsonable_python(self.to_dict()))
55+
56+
@classmethod
57+
def from_json(cls, json_str: str) -> Optional[Self]:
58+
"""Create an instance of Known from a JSON string"""
59+
return cls.from_dict(json.loads(json_str))
60+
61+
def to_dict(self) -> Dict[str, Any]:
62+
"""Return the dictionary representation of the model using alias.
63+
64+
This has the following differences from calling pydantic's
65+
`self.model_dump(by_alias=True)`:
66+
67+
* `None` is only added to the output dict for nullable fields that
68+
were set at model initialization. Other fields with value `None`
69+
are ignored.
70+
"""
71+
excluded_fields: Set[str] = set([
72+
])
73+
74+
_dict = self.model_dump(
75+
by_alias=True,
76+
exclude=excluded_fields,
77+
exclude_none=True,
78+
)
79+
return _dict
80+
81+
@classmethod
82+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83+
"""Create an instance of Known from a dict"""
84+
if obj is None:
85+
return None
86+
87+
if not isinstance(obj, dict):
88+
return cls.model_validate(obj)
89+
90+
_obj = cls.model_validate({
91+
"kind": obj.get("kind")
92+
})
93+
return _obj
94+
95+

0 commit comments

Comments
 (0)