Chirag Jain 67af02ccc8
python-pydantic-v1: Keep trailing commas for enum validation tuples (#19985)
* python-pydantic-v1: Keep trailing commas for tuples when enum has just single member

* Update samples

* Add test for single member enums

* Refactor test name
2024-11-02 15:26:19 +08:00

1.7 KiB

EnumTest

Properties

Name Type Description Notes
enum_string str [optional]
enum_string_required str
enum_integer_default int [optional] [default to 5]
enum_integer int [optional]
enum_number float [optional]
enum_number_vendor_ext int [optional]
enum_string_vendor_ext str [optional]
enum_string_single_member str [optional]
enum_integer_single_member int [optional]
outer_enum OuterEnum [optional]
outer_enum_integer OuterEnumInteger [optional]
outer_enum_default_value OuterEnumDefaultValue [optional] [default to OuterEnumDefaultValue.PLACED]
outer_enum_integer_default_value OuterEnumIntegerDefaultValue [optional] [default to OuterEnumIntegerDefaultValue.NUMBER_0]

Example

from petstore_api.models.enum_test import EnumTest

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

# convert the object into a dict
enum_test_dict = enum_test_instance.to_dict()
# create an instance of EnumTest from a dict
enum_test_from_dict = EnumTest.from_dict(enum_test_dict)

[Back to Model list] [Back to API list] [Back to README]