Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2919,3 +2919,10 @@ components:
type: string
enum: [JSON, CSV, XML]
default: JSON
UuidWithPattern:
type: object
properties:
id:
type: string
format: uuid
pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ docs/UnnamedDictWithAdditionalStringListProperties.md
docs/UploadFileWithAdditionalPropertiesRequestObject.md
docs/User.md
docs/UserApi.md
docs/UuidWithPattern.md
docs/WithNestedOneOf.md
git_push.sh
petstore_api/__init__.py
Expand Down Expand Up @@ -250,6 +251,7 @@ petstore_api/models/unnamed_dict_with_additional_model_list_properties.py
petstore_api/models/unnamed_dict_with_additional_string_list_properties.py
petstore_api/models/upload_file_with_additional_properties_request_object.py
petstore_api/models/user.py
petstore_api/models/uuid_with_pattern.py
petstore_api/models/with_nested_one_of.py
petstore_api/py.typed
petstore_api/rest.py
Expand Down
1 change: 1 addition & 0 deletions samples/openapi3/client/petstore/python-aiohttp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ Class | Method | HTTP request | Description
- [UnnamedDictWithAdditionalStringListProperties](docs/UnnamedDictWithAdditionalStringListProperties.md)
- [UploadFileWithAdditionalPropertiesRequestObject](docs/UploadFileWithAdditionalPropertiesRequestObject.md)
- [User](docs/User.md)
- [UuidWithPattern](docs/UuidWithPattern.md)
- [WithNestedOneOf](docs/WithNestedOneOf.md)


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# UuidWithPattern


## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **UUID** | | [optional]

## Example

```python
from petstore_api.models.uuid_with_pattern import UuidWithPattern

# TODO update the JSON string below
json = "{}"
# create an instance of UuidWithPattern from a JSON string
uuid_with_pattern_instance = UuidWithPattern.from_json(json)
# print the JSON string representation of the object
print(UuidWithPattern.to_json())

# convert the object into a dict
uuid_with_pattern_dict = uuid_with_pattern_instance.to_dict()
# create an instance of UuidWithPattern from a dict
uuid_with_pattern_from_dict = UuidWithPattern.from_dict(uuid_with_pattern_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)


Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
"UnnamedDictWithAdditionalStringListProperties",
"UploadFileWithAdditionalPropertiesRequestObject",
"User",
"UuidWithPattern",
"WithNestedOneOf",
]

Expand Down Expand Up @@ -284,5 +285,6 @@
from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties as UnnamedDictWithAdditionalStringListProperties
from petstore_api.models.upload_file_with_additional_properties_request_object import UploadFileWithAdditionalPropertiesRequestObject as UploadFileWithAdditionalPropertiesRequestObject
from petstore_api.models.user import User as User
from petstore_api.models.uuid_with_pattern import UuidWithPattern as UuidWithPattern
from petstore_api.models.with_nested_one_of import WithNestedOneOf as WithNestedOneOf

Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,6 @@
from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties
from petstore_api.models.upload_file_with_additional_properties_request_object import UploadFileWithAdditionalPropertiesRequestObject
from petstore_api.models.user import User
from petstore_api.models.uuid_with_pattern import UuidWithPattern
from petstore_api.models.with_nested_one_of import WithNestedOneOf

Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# 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, ConfigDict, field_validator
from typing import Any, ClassVar, Dict, List, Optional
from uuid import UUID
from typing import Optional, Set
from typing_extensions import Self

class UuidWithPattern(BaseModel):
"""
UuidWithPattern
""" # noqa: E501
id: Optional[UUID] = None
__properties: ClassVar[List[str]] = ["id"]

@field_validator('id')
def id_validate_regular_expression(cls, value):
"""Validates the regular expression"""
if value is None:
return value

if not re.match(r"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$", value):
raise ValueError(r"must validate the regular expression /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/")
return value

model_config = ConfigDict(
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 UuidWithPattern 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 UuidWithPattern 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")
})
return _obj


Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# 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

from petstore_api.models.uuid_with_pattern import UuidWithPattern

class TestUuidWithPattern(unittest.TestCase):
"""UuidWithPattern unit test stubs"""

def setUp(self):
pass

def tearDown(self):
pass

def make_instance(self, include_optional) -> UuidWithPattern:
"""Test UuidWithPattern
include_optional 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 `UuidWithPattern`
"""
model = UuidWithPattern()
if include_optional:
return UuidWithPattern(
id = '62ECB020-8429-430c-a01F-FCCfeEe150AC'
)
else:
return UuidWithPattern(
)
"""

def testUuidWithPattern(self):
"""Test UuidWithPattern"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)

if __name__ == '__main__':
unittest.main()
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ docs/UnnamedDictWithAdditionalStringListProperties.md
docs/UploadFileWithAdditionalPropertiesRequestObject.md
docs/User.md
docs/UserApi.md
docs/UuidWithPattern.md
docs/WithNestedOneOf.md
git_push.sh
petstore_api/__init__.py
Expand Down Expand Up @@ -250,6 +251,7 @@ petstore_api/models/unnamed_dict_with_additional_model_list_properties.py
petstore_api/models/unnamed_dict_with_additional_string_list_properties.py
petstore_api/models/upload_file_with_additional_properties_request_object.py
petstore_api/models/user.py
petstore_api/models/uuid_with_pattern.py
petstore_api/models/with_nested_one_of.py
petstore_api/py.typed
petstore_api/rest.py
Expand Down
1 change: 1 addition & 0 deletions samples/openapi3/client/petstore/python-httpx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ Class | Method | HTTP request | Description
- [UnnamedDictWithAdditionalStringListProperties](docs/UnnamedDictWithAdditionalStringListProperties.md)
- [UploadFileWithAdditionalPropertiesRequestObject](docs/UploadFileWithAdditionalPropertiesRequestObject.md)
- [User](docs/User.md)
- [UuidWithPattern](docs/UuidWithPattern.md)
- [WithNestedOneOf](docs/WithNestedOneOf.md)


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# UuidWithPattern


## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **UUID** | | [optional]

## Example

```python
from petstore_api.models.uuid_with_pattern import UuidWithPattern

# TODO update the JSON string below
json = "{}"
# create an instance of UuidWithPattern from a JSON string
uuid_with_pattern_instance = UuidWithPattern.from_json(json)
# print the JSON string representation of the object
print(UuidWithPattern.to_json())

# convert the object into a dict
uuid_with_pattern_dict = uuid_with_pattern_instance.to_dict()
# create an instance of UuidWithPattern from a dict
uuid_with_pattern_from_dict = UuidWithPattern.from_dict(uuid_with_pattern_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)


Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
"UnnamedDictWithAdditionalStringListProperties",
"UploadFileWithAdditionalPropertiesRequestObject",
"User",
"UuidWithPattern",
"WithNestedOneOf",
]

Expand Down Expand Up @@ -284,5 +285,6 @@
from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties as UnnamedDictWithAdditionalStringListProperties
from petstore_api.models.upload_file_with_additional_properties_request_object import UploadFileWithAdditionalPropertiesRequestObject as UploadFileWithAdditionalPropertiesRequestObject
from petstore_api.models.user import User as User
from petstore_api.models.uuid_with_pattern import UuidWithPattern as UuidWithPattern
from petstore_api.models.with_nested_one_of import WithNestedOneOf as WithNestedOneOf

Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,6 @@
from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties
from petstore_api.models.upload_file_with_additional_properties_request_object import UploadFileWithAdditionalPropertiesRequestObject
from petstore_api.models.user import User
from petstore_api.models.uuid_with_pattern import UuidWithPattern
from petstore_api.models.with_nested_one_of import WithNestedOneOf

Loading
Loading