From 3b95f701e5e2821ada6424d067c9953e43c47d52 Mon Sep 17 00:00:00 2001 From: Jonathan Ballet Date: Mon, 25 Sep 2023 06:13:24 +0200 Subject: [PATCH] python: copy the current Python generator into a "pydantic v1" generator (#16656) * Copy the current Python generator into a "pydantic v1" generator This generator will be deprecated over time and the normal generator will focus on Pydantic v2. * add missing doc --- ...ml => samples-python-client-echo-api.yaml} | 2 +- ...es-python-pydantic-v1-client-echo-api.yaml | 44 + .../samples-python-pydantic-v1-petstore.yaml | 59 + bin/configs/python-pydantic-v1-aiohttp.yaml | 8 + bin/configs/python-pydantic-v1-echo-api.yaml | 6 + bin/configs/python-pydantic-v1.yaml | 12 + docs/generators.md | 1 + docs/generators/python-pydantic-v1.md | 232 ++ .../PythonClientPydanticV1Codegen.java | 484 +++ .../org.openapitools.codegen.CodegenConfig | 1 + .../python-pydantic-v1/README.mustache | 59 + .../README_onlypackage.mustache | 44 + .../python-pydantic-v1/__init__.mustache | 0 .../python-pydantic-v1/__init__api.mustache | 5 + .../python-pydantic-v1/__init__model.mustache | 11 + .../__init__package.mustache | 35 + .../resources/python-pydantic-v1/api.mustache | 321 ++ .../python-pydantic-v1/api_client.mustache | 807 ++++ .../python-pydantic-v1/api_doc.mustache | 74 + .../api_doc_example.mustache | 38 + .../python-pydantic-v1/api_response.mustache | 25 + .../python-pydantic-v1/api_test.mustache | 33 + .../python-pydantic-v1/asyncio/rest.mustache | 241 ++ .../python-pydantic-v1/common_README.mustache | 85 + .../python-pydantic-v1/configuration.mustache | 615 +++ .../python-pydantic-v1/exceptions.mustache | 156 + .../python-pydantic-v1/git_push.sh.mustache | 57 + .../github-workflow.mustache | 39 + .../python-pydantic-v1/gitignore.mustache | 66 + .../python-pydantic-v1/gitlab-ci.mustache | 31 + .../python-pydantic-v1/model.mustache | 14 + .../python-pydantic-v1/model_anyof.mustache | 180 + .../python-pydantic-v1/model_doc.mustache | 33 + .../python-pydantic-v1/model_enum.mustache | 36 + .../python-pydantic-v1/model_generic.mustache | 361 ++ .../python-pydantic-v1/model_oneof.mustache | 206 + .../python-pydantic-v1/model_test.mustache | 60 + .../partial_header.mustache | 19 + .../python-pydantic-v1/py.typed.mustache | 0 .../python-pydantic-v1/pyproject.mustache | 40 + .../python_doc_auth_partial.mustache | 108 + .../python-pydantic-v1/requirements.mustache | 11 + .../python-pydantic-v1/rest.mustache | 293 ++ .../python-pydantic-v1/setup.mustache | 56 + .../python-pydantic-v1/setup_cfg.mustache | 2 + .../python-pydantic-v1/signing.mustache | 403 ++ .../test-requirements.mustache | 3 + .../python-pydantic-v1/tornado/rest.mustache | 223 ++ .../resources/python-pydantic-v1/tox.mustache | 9 + .../python-pydantic-v1/travis.mustache | 17 + samples-python-pydantic-v1-petstore.yaml | 59 + .../.github/workflows/python.yml | 38 + .../echo_api/python-pydantic-v1/.gitignore | 66 + .../python-pydantic-v1/.gitlab-ci.yml | 31 + .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 56 + .../.openapi-generator/VERSION | 1 + .../echo_api/python-pydantic-v1/.travis.yml | 17 + .../echo_api/python-pydantic-v1/README.md | 149 + .../python-pydantic-v1/docs/AuthApi.md | 82 + .../echo_api/python-pydantic-v1/docs/Bird.md | 29 + .../python-pydantic-v1/docs/BodyApi.md | 476 +++ .../python-pydantic-v1/docs/Category.md | 29 + .../python-pydantic-v1/docs/DataQuery.md | 30 + .../python-pydantic-v1/docs/DefaultValue.md | 36 + .../python-pydantic-v1/docs/FormApi.md | 156 + .../python-pydantic-v1/docs/HeaderApi.md | 79 + .../docs/NumberPropertiesOnly.md | 30 + .../python-pydantic-v1/docs/PathApi.md | 77 + .../echo_api/python-pydantic-v1/docs/Pet.md | 33 + .../echo_api/python-pydantic-v1/docs/Query.md | 29 + .../python-pydantic-v1/docs/QueryApi.md | 556 +++ .../python-pydantic-v1/docs/StringEnumRef.md | 10 + .../echo_api/python-pydantic-v1/docs/Tag.md | 29 + ...lodeTrueObjectAllOfQueryObjectParameter.md | 31 + ...lodeTrueArrayStringQueryObjectParameter.md | 28 + .../echo_api/python-pydantic-v1/git_push.sh | 57 + .../openapi_client/__init__.py | 50 + .../openapi_client/api/__init__.py | 10 + .../openapi_client/api/auth_api.py | 173 + .../openapi_client/api/body_api.py | 1068 ++++++ .../openapi_client/api/form_api.py | 395 ++ .../openapi_client/api/header_api.py | 201 + .../openapi_client/api/path_api.py | 191 + .../openapi_client/api/query_api.py | 1208 ++++++ .../openapi_client/api_client.py | 760 ++++ .../openapi_client/api_response.py | 25 + .../openapi_client/configuration.py | 459 +++ .../openapi_client/exceptions.py | 167 + .../openapi_client/models/__init__.py | 28 + .../openapi_client/models/bird.py | 74 + .../openapi_client/models/category.py | 74 + .../openapi_client/models/data_query.py | 79 + .../openapi_client/models/default_value.py | 113 + .../models/number_properties_only.py | 76 + .../openapi_client/models/pet.py | 104 + .../openapi_client/models/query.py | 74 + .../openapi_client/models/string_enum_ref.py | 42 + .../openapi_client/models/tag.py | 74 + ...ue_object_all_of_query_object_parameter.py | 78 + ...rue_array_string_query_object_parameter.py | 72 + .../openapi_client/py.typed | 0 .../python-pydantic-v1/openapi_client/rest.py | 304 ++ .../python-pydantic-v1/pyproject.toml | 30 + .../python-pydantic-v1/requirements.txt | 5 + .../echo_api/python-pydantic-v1/setup.cfg | 2 + .../echo_api/python-pydantic-v1/setup.py | 51 + .../python-pydantic-v1/test-requirements.txt | 3 + .../python-pydantic-v1/test/__init__.py | 0 .../python-pydantic-v1/test/test_auth_api.py | 39 + .../python-pydantic-v1/test/test_bird.py | 54 + .../python-pydantic-v1/test/test_body_api.py | 81 + .../python-pydantic-v1/test/test_category.py | 54 + .../test/test_data_query.py | 55 + .../test/test_default_value.py | 74 + .../python-pydantic-v1/test/test_form_api.py | 46 + .../test/test_header_api.py | 39 + .../test/test_number_properties_only.py | 55 + .../python-pydantic-v1/test/test_path_api.py | 39 + .../python-pydantic-v1/test/test_pet.py | 70 + .../python-pydantic-v1/test/test_query.py | 56 + .../python-pydantic-v1/test/test_query_api.py | 88 + .../test/test_string_enum_ref.py | 35 + .../python-pydantic-v1/test/test_tag.py | 54 + ...ue_object_all_of_query_object_parameter.py | 56 + ...rue_array_string_query_object_parameter.py | 55 + .../echo_api/python-pydantic-v1/tox.ini | 9 + .../.github/workflows/python.yml | 38 + .../python-pydantic-v1-aiohttp/.gitignore | 66 + .../python-pydantic-v1-aiohttp/.gitlab-ci.yml | 31 + .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 195 + .../.openapi-generator/VERSION | 1 + .../python-pydantic-v1-aiohttp/.travis.yml | 17 + .../python-pydantic-v1-aiohttp/README.md | 268 ++ .../docs/AdditionalPropertiesAnyType.md | 28 + .../docs/AdditionalPropertiesClass.md | 29 + .../docs/AdditionalPropertiesObject.md | 28 + ...AdditionalPropertiesWithDescriptionOnly.md | 28 + .../docs/AllOfWithSingleRef.md | 29 + .../python-pydantic-v1-aiohttp/docs/Animal.md | 29 + .../docs/AnotherFakeApi.md | 76 + .../docs/AnyOfColor.md | 28 + .../docs/AnyOfPig.md | 30 + .../docs/ApiResponse.md | 30 + .../docs/ArrayOfArrayOfModel.md | 28 + .../docs/ArrayOfArrayOfNumberOnly.md | 28 + .../docs/ArrayOfNumberOnly.md | 28 + .../docs/ArrayTest.md | 30 + .../docs/BasquePig.md | 29 + .../docs/Capitalization.md | 33 + .../python-pydantic-v1-aiohttp/docs/Cat.md | 28 + .../docs/Category.md | 29 + .../docs/CircularReferenceModel.md | 29 + .../docs/ClassModel.md | 29 + .../python-pydantic-v1-aiohttp/docs/Client.md | 28 + .../python-pydantic-v1-aiohttp/docs/Color.md | 28 + .../docs/Creature.md | 29 + .../docs/CreatureInfo.md | 28 + .../docs/DanishPig.md | 29 + .../docs/DefaultApi.md | 69 + .../docs/DeprecatedObject.md | 28 + .../python-pydantic-v1-aiohttp/docs/Dog.md | 28 + .../docs/DummyModel.md | 29 + .../docs/EnumArrays.md | 29 + .../docs/EnumClass.md | 10 + .../docs/EnumString1.md | 10 + .../docs/EnumString2.md | 10 + .../docs/EnumTest.md | 36 + .../docs/FakeApi.md | 1579 ++++++++ .../docs/FakeClassnameTags123Api.md | 87 + .../python-pydantic-v1-aiohttp/docs/File.md | 29 + .../docs/FileSchemaTestClass.md | 29 + .../docs/FirstRef.md | 29 + .../python-pydantic-v1-aiohttp/docs/Foo.md | 28 + .../docs/FooGetDefaultResponse.md | 28 + .../docs/FormatTest.md | 44 + .../docs/HasOnlyReadOnly.md | 29 + .../docs/HealthCheckResult.md | 29 + .../docs/InnerDictWithProperty.md | 28 + .../docs/IntOrString.md | 27 + .../python-pydantic-v1-aiohttp/docs/List.md | 28 + .../docs/MapOfArrayOfModel.md | 28 + .../docs/MapTest.md | 31 + ...dPropertiesAndAdditionalPropertiesClass.md | 30 + .../docs/Model200Response.md | 30 + .../docs/ModelReturn.md | 29 + .../python-pydantic-v1-aiohttp/docs/Name.md | 32 + .../docs/NullableClass.md | 40 + .../docs/NullableProperty.md | 29 + .../docs/NumberOnly.md | 28 + .../docs/ObjectToTestAdditionalProperties.md | 29 + .../docs/ObjectWithDeprecatedFields.md | 31 + .../docs/OneOfEnumString.md | 28 + .../python-pydantic-v1-aiohttp/docs/Order.md | 33 + .../docs/OuterComposite.md | 30 + .../docs/OuterEnum.md | 10 + .../docs/OuterEnumDefaultValue.md | 10 + .../docs/OuterEnumInteger.md | 10 + .../docs/OuterEnumIntegerDefaultValue.md | 10 + .../docs/OuterObjectWithEnumProperty.md | 29 + .../python-pydantic-v1-aiohttp/docs/Parent.md | 28 + .../docs/ParentWithOptionalDict.md | 28 + .../python-pydantic-v1-aiohttp/docs/Pet.md | 33 + .../python-pydantic-v1-aiohttp/docs/PetApi.md | 953 +++++ .../python-pydantic-v1-aiohttp/docs/Pig.md | 30 + .../docs/PropertyNameCollision.md | 30 + .../docs/ReadOnlyFirst.md | 29 + .../docs/SecondRef.md | 29 + .../docs/SelfReferenceModel.md | 29 + .../docs/SingleRefType.md | 10 + .../docs/SpecialCharacterEnum.md | 10 + .../docs/SpecialModelName.md | 28 + .../docs/SpecialName.md | 30 + .../docs/StoreApi.md | 287 ++ .../python-pydantic-v1-aiohttp/docs/Tag.md | 29 + ...lineFreeformAdditionalPropertiesRequest.md | 28 + .../python-pydantic-v1-aiohttp/docs/Tiger.md | 28 + .../python-pydantic-v1-aiohttp/docs/User.md | 35 + .../docs/UserApi.md | 542 +++ .../docs/WithNestedOneOf.md | 30 + .../python-pydantic-v1-aiohttp/git_push.sh | 57 + .../petstore_api/__init__.py | 119 + .../petstore_api/api/__init__.py | 11 + .../petstore_api/api/another_fake_api.py | 176 + .../petstore_api/api/default_api.py | 155 + .../petstore_api/api/fake_api.py | 3028 +++++++++++++++ .../api/fake_classname_tags123_api.py | 176 + .../petstore_api/api/pet_api.py | 1239 ++++++ .../petstore_api/api/store_api.py | 539 +++ .../petstore_api/api/user_api.py | 1055 +++++ .../petstore_api/api_client.py | 737 ++++ .../petstore_api/api_response.py | 25 + .../petstore_api/configuration.py | 601 +++ .../petstore_api/exceptions.py | 166 + .../petstore_api/models/__init__.py | 95 + .../models/additional_properties_any_type.py | 83 + .../models/additional_properties_class.py | 73 + .../models/additional_properties_object.py | 83 + ...tional_properties_with_description_only.py | 83 + .../models/all_of_with_single_ref.py | 74 + .../petstore_api/models/animal.py | 92 + .../petstore_api/models/any_of_color.py | 155 + .../petstore_api/models/any_of_pig.py | 134 + .../petstore_api/models/api_response.py | 75 + .../models/array_of_array_of_model.py | 84 + .../models/array_of_array_of_number_only.py | 71 + .../models/array_of_number_only.py | 71 + .../petstore_api/models/array_test.py | 88 + .../petstore_api/models/basque_pig.py | 73 + .../petstore_api/models/capitalization.py | 81 + .../petstore_api/models/cat.py | 74 + .../petstore_api/models/category.py | 73 + .../models/circular_reference_model.py | 78 + .../petstore_api/models/class_model.py | 71 + .../petstore_api/models/client.py | 71 + .../petstore_api/models/color.py | 170 + .../petstore_api/models/creature.py | 77 + .../petstore_api/models/creature_info.py | 71 + .../petstore_api/models/danish_pig.py | 73 + .../petstore_api/models/deprecated_object.py | 71 + .../petstore_api/models/dog.py | 74 + .../petstore_api/models/dummy_model.py | 78 + .../petstore_api/models/enum_arrays.py | 94 + .../petstore_api/models/enum_class.py | 41 + .../petstore_api/models/enum_string1.py | 40 + .../petstore_api/models/enum_string2.py | 40 + .../petstore_api/models/enum_test.py | 143 + .../petstore_api/models/file.py | 71 + .../models/file_schema_test_class.py | 84 + .../petstore_api/models/first_ref.py | 78 + .../petstore_api/models/foo.py | 71 + .../models/foo_get_default_response.py | 75 + .../petstore_api/models/format_test.py | 143 + .../petstore_api/models/has_only_read_only.py | 75 + .../models/health_check_result.py | 76 + .../models/inner_dict_with_property.py | 71 + .../petstore_api/models/int_or_string.py | 147 + .../petstore_api/models/list.py | 71 + .../models/map_of_array_of_model.py | 88 + .../petstore_api/models/map_test.py | 87 + ...perties_and_additional_properties_class.py | 88 + .../petstore_api/models/model200_response.py | 73 + .../petstore_api/models/model_return.py | 71 + .../petstore_api/models/name.py | 79 + .../petstore_api/models/nullable_class.py | 162 + .../petstore_api/models/nullable_property.py | 88 + .../petstore_api/models/number_only.py | 71 + .../object_to_test_additional_properties.py | 71 + .../models/object_with_deprecated_fields.py | 81 + .../petstore_api/models/one_of_enum_string.py | 141 + .../petstore_api/models/order.py | 91 + .../petstore_api/models/outer_composite.py | 75 + .../petstore_api/models/outer_enum.py | 41 + .../models/outer_enum_default_value.py | 41 + .../petstore_api/models/outer_enum_integer.py | 41 + .../outer_enum_integer_default_value.py | 42 + .../models/outer_object_with_enum_property.py | 80 + .../petstore_api/models/parent.py | 84 + .../models/parent_with_optional_dict.py | 84 + .../petstore_api/models/pet.py | 103 + .../petstore_api/models/pig.py | 144 + .../models/property_name_collision.py | 75 + .../petstore_api/models/read_only_first.py | 74 + .../petstore_api/models/second_ref.py | 78 + .../models/self_reference_model.py | 78 + .../petstore_api/models/single_ref_type.py | 40 + .../models/special_character_enum.py | 48 + .../petstore_api/models/special_model_name.py | 71 + .../petstore_api/models/special_name.py | 89 + .../petstore_api/models/tag.py | 73 + ..._freeform_additional_properties_request.py | 83 + .../petstore_api/models/tiger.py | 71 + .../petstore_api/models/user.py | 85 + .../petstore_api/models/with_nested_one_of.py | 83 + .../petstore_api/py.typed | 0 .../petstore_api/rest.py | 251 ++ .../petstore_api/signing.py | 413 ++ .../python-pydantic-v1-aiohttp/pyproject.toml | 33 + .../requirements.txt | 7 + .../python-pydantic-v1-aiohttp/setup.cfg | 2 + .../python-pydantic-v1-aiohttp/setup.py | 53 + .../test-requirements.txt | 3 + .../test/__init__.py | 0 .../test_additional_properties_any_type.py | 52 + .../test/test_additional_properties_class.py | 59 + .../test/test_additional_properties_object.py | 52 + ...tional_properties_with_description_only.py | 52 + .../test/test_all_of_with_single_ref.py | 53 + .../test/test_animal.py | 54 + .../test/test_another_fake_api.py | 38 + .../test/test_any_of_color.py | 51 + .../test/test_any_of_pig.py | 57 + .../test/test_api_response.py | 54 + .../test/test_array_of_array_of_model.py | 58 + .../test_array_of_array_of_number_only.py | 56 + .../test/test_array_of_number_only.py | 54 + .../test/test_array_test.py | 66 + .../test/test_basque_pig.py | 55 + .../test/test_capitalization.py | 57 + .../test/test_cat.py | 52 + .../test/test_category.py | 54 + .../test/test_circular_reference_model.py | 60 + .../test/test_class_model.py | 52 + .../test/test_client.py | 52 + .../test/test_color.py | 51 + .../test/test_creature.py | 57 + .../test/test_creature_info.py | 53 + .../test/test_danish_pig.py | 55 + .../test/test_default_api.py | 37 + .../test/test_deprecated_object.py | 52 + .../test/test_dog.py | 52 + .../test/test_dummy_model.py | 56 + .../test/test_enum_arrays.py | 55 + .../test/test_enum_class.py | 34 + .../test/test_enum_string1.py | 34 + .../test/test_enum_string2.py | 34 + .../test/test_enum_test.py | 61 + .../test/test_fake_api.py | 175 + .../test/test_fake_classname_tags123_api.py | 38 + .../test/test_file.py | 52 + .../test/test_file_schema_test_class.py | 57 + .../test/test_first_ref.py | 58 + .../test/test_foo.py | 52 + .../test/test_foo_get_default_response.py | 53 + .../test/test_format_test.py | 71 + .../test/test_has_only_read_only.py | 53 + .../test/test_health_check_result.py | 52 + .../test/test_inner_dict_with_property.py | 52 + .../test/test_int_or_string.py | 51 + .../test/test_list.py | 52 + .../test/test_map_of_array_of_model.py | 58 + .../test/test_map_test.py | 65 + ...perties_and_additional_properties_class.py | 58 + .../test/test_model200_response.py | 53 + .../test/test_model_return.py | 52 + .../test/test_name.py | 56 + .../test/test_nullable_class.py | 77 + .../test/test_nullable_property.py | 55 + .../test/test_number_only.py | 52 + ...st_object_to_test_additional_properties.py | 52 + .../test_object_with_deprecated_fields.py | 58 + .../test/test_one_of_enum_string.py | 51 + .../test/test_order.py | 57 + .../test/test_outer_composite.py | 54 + .../test/test_outer_enum.py | 34 + .../test/test_outer_enum_default_value.py | 34 + .../test/test_outer_enum_integer.py | 34 + .../test_outer_enum_integer_default_value.py | 34 + .../test_outer_object_with_enum_property.py | 54 + .../test/test_parent.py | 55 + .../test/test_parent_with_optional_dict.py | 55 + .../test/test_pet.py | 69 + .../test/test_pet_api.py | 94 + .../test/test_pig.py | 57 + .../test/test_property_name_collision.py | 54 + .../test/test_read_only_first.py | 53 + .../test/test_second_ref.py | 58 + .../test/test_self_reference_model.py | 58 + .../test/test_single_ref_type.py | 34 + .../test/test_special_character_enum.py | 34 + .../test/test_special_model_name.py | 52 + .../test/test_special_name.py | 56 + .../test/test_store_api.py | 59 + .../test/test_tag.py | 53 + ..._freeform_additional_properties_request.py | 52 + .../test/test_tiger.py | 52 + .../test/test_user.py | 59 + .../test/test_user_api.py | 87 + .../test/test_with_nested_one_of.py | 54 + .../python-pydantic-v1-aiohttp/tox.ini | 9 + .../.github/workflows/python.yml | 38 + .../petstore/python-pydantic-v1/.gitignore | 66 + .../python-pydantic-v1/.gitlab-ci.yml | 31 + .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 195 + .../.openapi-generator/VERSION | 1 + .../petstore/python-pydantic-v1/.travis.yml | 17 + .../petstore/python-pydantic-v1/README.md | 268 ++ .../docs/AdditionalPropertiesAnyType.md | 28 + .../docs/AdditionalPropertiesClass.md | 29 + .../docs/AdditionalPropertiesObject.md | 28 + ...AdditionalPropertiesWithDescriptionOnly.md | 28 + .../docs/AllOfWithSingleRef.md | 29 + .../python-pydantic-v1/docs/Animal.md | 29 + .../python-pydantic-v1/docs/AnotherFakeApi.md | 76 + .../python-pydantic-v1/docs/AnyOfColor.md | 28 + .../python-pydantic-v1/docs/AnyOfPig.md | 30 + .../python-pydantic-v1/docs/ApiResponse.md | 30 + .../docs/ArrayOfArrayOfModel.md | 28 + .../docs/ArrayOfArrayOfNumberOnly.md | 28 + .../docs/ArrayOfNumberOnly.md | 28 + .../python-pydantic-v1/docs/ArrayTest.md | 30 + .../python-pydantic-v1/docs/BasquePig.md | 29 + .../python-pydantic-v1/docs/Capitalization.md | 33 + .../petstore/python-pydantic-v1/docs/Cat.md | 28 + .../python-pydantic-v1/docs/Category.md | 29 + .../docs/CircularReferenceModel.md | 29 + .../python-pydantic-v1/docs/ClassModel.md | 29 + .../python-pydantic-v1/docs/Client.md | 28 + .../petstore/python-pydantic-v1/docs/Color.md | 28 + .../python-pydantic-v1/docs/Creature.md | 29 + .../python-pydantic-v1/docs/CreatureInfo.md | 28 + .../python-pydantic-v1/docs/DanishPig.md | 29 + .../python-pydantic-v1/docs/DefaultApi.md | 69 + .../docs/DeprecatedObject.md | 28 + .../petstore/python-pydantic-v1/docs/Dog.md | 28 + .../python-pydantic-v1/docs/DummyModel.md | 29 + .../python-pydantic-v1/docs/EnumArrays.md | 29 + .../python-pydantic-v1/docs/EnumClass.md | 10 + .../python-pydantic-v1/docs/EnumString1.md | 10 + .../python-pydantic-v1/docs/EnumString2.md | 10 + .../python-pydantic-v1/docs/EnumTest.md | 36 + .../python-pydantic-v1/docs/FakeApi.md | 1579 ++++++++ .../docs/FakeClassnameTags123Api.md | 87 + .../petstore/python-pydantic-v1/docs/File.md | 29 + .../docs/FileSchemaTestClass.md | 29 + .../python-pydantic-v1/docs/FirstRef.md | 29 + .../petstore/python-pydantic-v1/docs/Foo.md | 28 + .../docs/FooGetDefaultResponse.md | 28 + .../python-pydantic-v1/docs/FormatTest.md | 44 + .../docs/HasOnlyReadOnly.md | 29 + .../docs/HealthCheckResult.md | 29 + .../docs/InnerDictWithProperty.md | 28 + .../python-pydantic-v1/docs/IntOrString.md | 27 + .../petstore/python-pydantic-v1/docs/List.md | 28 + .../docs/MapOfArrayOfModel.md | 28 + .../python-pydantic-v1/docs/MapTest.md | 31 + ...dPropertiesAndAdditionalPropertiesClass.md | 30 + .../docs/Model200Response.md | 30 + .../python-pydantic-v1/docs/ModelReturn.md | 29 + .../petstore/python-pydantic-v1/docs/Name.md | 32 + .../python-pydantic-v1/docs/NullableClass.md | 40 + .../docs/NullableProperty.md | 29 + .../python-pydantic-v1/docs/NumberOnly.md | 28 + .../docs/ObjectToTestAdditionalProperties.md | 29 + .../docs/ObjectWithDeprecatedFields.md | 31 + .../docs/OneOfEnumString.md | 28 + .../petstore/python-pydantic-v1/docs/Order.md | 33 + .../python-pydantic-v1/docs/OuterComposite.md | 30 + .../python-pydantic-v1/docs/OuterEnum.md | 10 + .../docs/OuterEnumDefaultValue.md | 10 + .../docs/OuterEnumInteger.md | 10 + .../docs/OuterEnumIntegerDefaultValue.md | 10 + .../docs/OuterObjectWithEnumProperty.md | 29 + .../python-pydantic-v1/docs/Parent.md | 28 + .../docs/ParentWithOptionalDict.md | 28 + .../petstore/python-pydantic-v1/docs/Pet.md | 33 + .../python-pydantic-v1/docs/PetApi.md | 953 +++++ .../petstore/python-pydantic-v1/docs/Pig.md | 30 + .../docs/PropertyNameCollision.md | 30 + .../python-pydantic-v1/docs/ReadOnlyFirst.md | 29 + .../python-pydantic-v1/docs/SecondRef.md | 29 + .../docs/SelfReferenceModel.md | 29 + .../python-pydantic-v1/docs/SingleRefType.md | 10 + .../docs/SpecialCharacterEnum.md | 10 + .../docs/SpecialModelName.md | 28 + .../python-pydantic-v1/docs/SpecialName.md | 30 + .../python-pydantic-v1/docs/StoreApi.md | 287 ++ .../petstore/python-pydantic-v1/docs/Tag.md | 29 + ...lineFreeformAdditionalPropertiesRequest.md | 28 + .../petstore/python-pydantic-v1/docs/Tiger.md | 28 + .../petstore/python-pydantic-v1/docs/User.md | 35 + .../python-pydantic-v1/docs/UserApi.md | 542 +++ .../docs/WithNestedOneOf.md | 30 + .../petstore/python-pydantic-v1/git_push.sh | 57 + .../petstore_api/__init__.py | 119 + .../petstore_api/api/__init__.py | 11 + .../petstore_api/api/another_fake_api.py | 191 + .../petstore_api/api/default_api.py | 170 + .../petstore_api/api/fake_api.py | 3379 +++++++++++++++++ .../api/fake_classname_tags123_api.py | 191 + .../petstore_api/api/pet_api.py | 1382 +++++++ .../petstore_api/api/store_api.py | 602 +++ .../petstore_api/api/user_api.py | 1182 ++++++ .../petstore_api/api_client.py | 766 ++++ .../petstore_api/api_response.py | 25 + .../petstore_api/configuration.py | 605 +++ .../petstore_api/exceptions.py | 166 + .../petstore_api/models/__init__.py | 95 + .../models/additional_properties_any_type.py | 83 + .../models/additional_properties_class.py | 85 + .../models/additional_properties_object.py | 83 + ...tional_properties_with_description_only.py | 83 + .../models/all_of_with_single_ref.py | 86 + .../petstore_api/models/animal.py | 99 + .../petstore_api/models/any_of_color.py | 155 + .../petstore_api/models/any_of_pig.py | 134 + .../petstore_api/models/api_response.py | 87 + .../models/array_of_array_of_model.py | 96 + .../models/array_of_array_of_number_only.py | 83 + .../models/array_of_number_only.py | 83 + .../petstore_api/models/array_test.py | 100 + .../petstore_api/models/basque_pig.py | 85 + .../petstore_api/models/capitalization.py | 93 + .../petstore_api/models/cat.py | 86 + .../petstore_api/models/category.py | 85 + .../models/circular_reference_model.py | 90 + .../petstore_api/models/class_model.py | 83 + .../petstore_api/models/client.py | 83 + .../petstore_api/models/color.py | 170 + .../petstore_api/models/creature.py | 89 + .../petstore_api/models/creature_info.py | 83 + .../petstore_api/models/danish_pig.py | 85 + .../petstore_api/models/deprecated_object.py | 83 + .../petstore_api/models/dog.py | 86 + .../petstore_api/models/dummy_model.py | 90 + .../petstore_api/models/enum_arrays.py | 106 + .../petstore_api/models/enum_class.py | 41 + .../petstore_api/models/enum_string1.py | 40 + .../petstore_api/models/enum_string2.py | 40 + .../petstore_api/models/enum_test.py | 155 + .../petstore_api/models/file.py | 83 + .../models/file_schema_test_class.py | 96 + .../petstore_api/models/first_ref.py | 90 + .../petstore_api/models/foo.py | 83 + .../models/foo_get_default_response.py | 87 + .../petstore_api/models/format_test.py | 155 + .../petstore_api/models/has_only_read_only.py | 87 + .../models/health_check_result.py | 88 + .../models/inner_dict_with_property.py | 83 + .../petstore_api/models/int_or_string.py | 147 + .../petstore_api/models/list.py | 83 + .../models/map_of_array_of_model.py | 100 + .../petstore_api/models/map_test.py | 99 + ...perties_and_additional_properties_class.py | 100 + .../petstore_api/models/model200_response.py | 85 + .../petstore_api/models/model_return.py | 83 + .../petstore_api/models/name.py | 91 + .../petstore_api/models/nullable_class.py | 162 + .../petstore_api/models/nullable_property.py | 100 + .../petstore_api/models/number_only.py | 83 + .../object_to_test_additional_properties.py | 83 + .../models/object_with_deprecated_fields.py | 93 + .../petstore_api/models/one_of_enum_string.py | 141 + .../petstore_api/models/order.py | 103 + .../petstore_api/models/outer_composite.py | 87 + .../petstore_api/models/outer_enum.py | 41 + .../models/outer_enum_default_value.py | 41 + .../petstore_api/models/outer_enum_integer.py | 41 + .../outer_enum_integer_default_value.py | 42 + .../models/outer_object_with_enum_property.py | 92 + .../petstore_api/models/parent.py | 96 + .../models/parent_with_optional_dict.py | 96 + .../petstore_api/models/pet.py | 115 + .../petstore_api/models/pig.py | 159 + .../models/property_name_collision.py | 87 + .../petstore_api/models/read_only_first.py | 86 + .../petstore_api/models/second_ref.py | 90 + .../models/self_reference_model.py | 90 + .../petstore_api/models/single_ref_type.py | 40 + .../models/special_character_enum.py | 48 + .../petstore_api/models/special_model_name.py | 83 + .../petstore_api/models/special_name.py | 101 + .../petstore_api/models/tag.py | 85 + ..._freeform_additional_properties_request.py | 83 + .../petstore_api/models/tiger.py | 83 + .../petstore_api/models/user.py | 97 + .../petstore_api/models/with_nested_one_of.py | 95 + .../python-pydantic-v1/petstore_api/py.typed | 0 .../python-pydantic-v1/petstore_api/rest.py | 303 ++ .../petstore_api/signing.py | 413 ++ .../python-pydantic-v1/pyproject.toml | 32 + .../python-pydantic-v1/requirements.txt | 6 + .../petstore/python-pydantic-v1/setup.cfg | 2 + .../petstore/python-pydantic-v1/setup.py | 52 + .../python-pydantic-v1/test-requirements.txt | 3 + .../python-pydantic-v1/test/__init__.py | 0 .../test_additional_properties_any_type.py | 52 + .../test/test_additional_properties_class.py | 59 + .../test/test_additional_properties_object.py | 52 + ...tional_properties_with_description_only.py | 52 + .../test/test_all_of_with_single_ref.py | 53 + .../python-pydantic-v1/test/test_animal.py | 54 + .../test/test_another_fake_api.py | 38 + .../test/test_any_of_color.py | 51 + .../test/test_any_of_pig.py | 57 + .../test/test_api_response.py | 54 + .../test/test_array_of_array_of_model.py | 58 + .../test_array_of_array_of_number_only.py | 56 + .../test/test_array_of_number_only.py | 54 + .../test/test_array_test.py | 66 + .../test/test_basque_pig.py | 55 + .../test/test_capitalization.py | 57 + .../python-pydantic-v1/test/test_cat.py | 52 + .../python-pydantic-v1/test/test_category.py | 54 + .../test/test_circular_reference_model.py | 60 + .../test/test_class_model.py | 52 + .../python-pydantic-v1/test/test_client.py | 52 + .../python-pydantic-v1/test/test_color.py | 51 + .../python-pydantic-v1/test/test_creature.py | 57 + .../test/test_creature_info.py | 53 + .../test/test_danish_pig.py | 55 + .../test/test_default_api.py | 37 + .../test/test_deprecated_object.py | 52 + .../python-pydantic-v1/test/test_dog.py | 52 + .../test/test_dummy_model.py | 56 + .../test/test_enum_arrays.py | 55 + .../test/test_enum_class.py | 34 + .../test/test_enum_string1.py | 34 + .../test/test_enum_string2.py | 34 + .../python-pydantic-v1/test/test_enum_test.py | 61 + .../python-pydantic-v1/test/test_fake_api.py | 175 + .../test/test_fake_classname_tags123_api.py | 38 + .../python-pydantic-v1/test/test_file.py | 52 + .../test/test_file_schema_test_class.py | 57 + .../python-pydantic-v1/test/test_first_ref.py | 58 + .../python-pydantic-v1/test/test_foo.py | 52 + .../test/test_foo_get_default_response.py | 53 + .../test/test_format_test.py | 71 + .../test/test_has_only_read_only.py | 53 + .../test/test_health_check_result.py | 52 + .../test/test_inner_dict_with_property.py | 52 + .../test/test_int_or_string.py | 51 + .../python-pydantic-v1/test/test_list.py | 52 + .../test/test_map_of_array_of_model.py | 58 + .../python-pydantic-v1/test/test_map_test.py | 65 + ...perties_and_additional_properties_class.py | 58 + .../test/test_model200_response.py | 53 + .../test/test_model_return.py | 52 + .../python-pydantic-v1/test/test_name.py | 56 + .../test/test_nullable_class.py | 77 + .../test/test_nullable_property.py | 55 + .../test/test_number_only.py | 52 + ...st_object_to_test_additional_properties.py | 52 + .../test_object_with_deprecated_fields.py | 58 + .../test/test_one_of_enum_string.py | 51 + .../python-pydantic-v1/test/test_order.py | 57 + .../test/test_outer_composite.py | 54 + .../test/test_outer_enum.py | 34 + .../test/test_outer_enum_default_value.py | 34 + .../test/test_outer_enum_integer.py | 34 + .../test_outer_enum_integer_default_value.py | 34 + .../test_outer_object_with_enum_property.py | 54 + .../python-pydantic-v1/test/test_parent.py | 55 + .../test/test_parent_with_optional_dict.py | 55 + .../python-pydantic-v1/test/test_pet.py | 69 + .../python-pydantic-v1/test/test_pet_api.py | 94 + .../python-pydantic-v1/test/test_pig.py | 57 + .../test/test_property_name_collision.py | 54 + .../test/test_read_only_first.py | 53 + .../test/test_second_ref.py | 58 + .../test/test_self_reference_model.py | 58 + .../test/test_single_ref_type.py | 34 + .../test/test_special_character_enum.py | 34 + .../test/test_special_model_name.py | 52 + .../test/test_special_name.py | 56 + .../python-pydantic-v1/test/test_store_api.py | 59 + .../python-pydantic-v1/test/test_tag.py | 53 + ..._freeform_additional_properties_request.py | 52 + .../python-pydantic-v1/test/test_tiger.py | 52 + .../python-pydantic-v1/test/test_user.py | 59 + .../python-pydantic-v1/test/test_user_api.py | 87 + .../test/test_with_nested_one_of.py | 54 + .../petstore/python-pydantic-v1/tox.ini | 9 + 695 files changed, 69491 insertions(+), 1 deletion(-) rename .github/workflows/{samples-python-nextgen-client-echo-api.yaml => samples-python-client-echo-api.yaml} (94%) create mode 100644 .github/workflows/samples-python-pydantic-v1-client-echo-api.yaml create mode 100644 .github/workflows/samples-python-pydantic-v1-petstore.yaml create mode 100644 bin/configs/python-pydantic-v1-aiohttp.yaml create mode 100644 bin/configs/python-pydantic-v1-echo-api.yaml create mode 100644 bin/configs/python-pydantic-v1.yaml create mode 100644 docs/generators/python-pydantic-v1.md create mode 100644 modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientPydanticV1Codegen.java create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/README.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/README_onlypackage.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/__init__.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/__init__api.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/__init__model.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/__init__package.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/api.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/api_client.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/api_doc.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/api_doc_example.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/api_response.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/api_test.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/asyncio/rest.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/common_README.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/configuration.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/exceptions.mustache create mode 100755 modules/openapi-generator/src/main/resources/python-pydantic-v1/git_push.sh.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/github-workflow.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/gitignore.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/gitlab-ci.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/model.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/model_anyof.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/model_doc.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/model_enum.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/model_generic.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/model_oneof.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/model_test.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/partial_header.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/py.typed.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/pyproject.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/python_doc_auth_partial.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/requirements.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/rest.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/setup.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/setup_cfg.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/signing.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/test-requirements.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/tornado/rest.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/tox.mustache create mode 100644 modules/openapi-generator/src/main/resources/python-pydantic-v1/travis.mustache create mode 100644 samples-python-pydantic-v1-petstore.yaml create mode 100644 samples/client/echo_api/python-pydantic-v1/.github/workflows/python.yml create mode 100644 samples/client/echo_api/python-pydantic-v1/.gitignore create mode 100644 samples/client/echo_api/python-pydantic-v1/.gitlab-ci.yml create mode 100644 samples/client/echo_api/python-pydantic-v1/.openapi-generator-ignore create mode 100644 samples/client/echo_api/python-pydantic-v1/.openapi-generator/FILES create mode 100644 samples/client/echo_api/python-pydantic-v1/.openapi-generator/VERSION create mode 100644 samples/client/echo_api/python-pydantic-v1/.travis.yml create mode 100644 samples/client/echo_api/python-pydantic-v1/README.md create mode 100644 samples/client/echo_api/python-pydantic-v1/docs/AuthApi.md create mode 100644 samples/client/echo_api/python-pydantic-v1/docs/Bird.md create mode 100644 samples/client/echo_api/python-pydantic-v1/docs/BodyApi.md create mode 100644 samples/client/echo_api/python-pydantic-v1/docs/Category.md create mode 100644 samples/client/echo_api/python-pydantic-v1/docs/DataQuery.md create mode 100644 samples/client/echo_api/python-pydantic-v1/docs/DefaultValue.md create mode 100644 samples/client/echo_api/python-pydantic-v1/docs/FormApi.md create mode 100644 samples/client/echo_api/python-pydantic-v1/docs/HeaderApi.md create mode 100644 samples/client/echo_api/python-pydantic-v1/docs/NumberPropertiesOnly.md create mode 100644 samples/client/echo_api/python-pydantic-v1/docs/PathApi.md create mode 100644 samples/client/echo_api/python-pydantic-v1/docs/Pet.md create mode 100644 samples/client/echo_api/python-pydantic-v1/docs/Query.md create mode 100644 samples/client/echo_api/python-pydantic-v1/docs/QueryApi.md create mode 100644 samples/client/echo_api/python-pydantic-v1/docs/StringEnumRef.md create mode 100644 samples/client/echo_api/python-pydantic-v1/docs/Tag.md create mode 100644 samples/client/echo_api/python-pydantic-v1/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md create mode 100644 samples/client/echo_api/python-pydantic-v1/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md create mode 100644 samples/client/echo_api/python-pydantic-v1/git_push.sh create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/__init__.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/api/__init__.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/api/auth_api.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/api/body_api.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/api/form_api.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/api/header_api.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/api/path_api.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/api/query_api.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/api_client.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/api_response.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/configuration.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/exceptions.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/models/__init__.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/models/bird.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/models/category.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/models/data_query.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/models/default_value.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/models/number_properties_only.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/models/pet.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/models/query.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/models/string_enum_ref.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/models/tag.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/py.typed create mode 100644 samples/client/echo_api/python-pydantic-v1/openapi_client/rest.py create mode 100644 samples/client/echo_api/python-pydantic-v1/pyproject.toml create mode 100644 samples/client/echo_api/python-pydantic-v1/requirements.txt create mode 100644 samples/client/echo_api/python-pydantic-v1/setup.cfg create mode 100644 samples/client/echo_api/python-pydantic-v1/setup.py create mode 100644 samples/client/echo_api/python-pydantic-v1/test-requirements.txt create mode 100644 samples/client/echo_api/python-pydantic-v1/test/__init__.py create mode 100644 samples/client/echo_api/python-pydantic-v1/test/test_auth_api.py create mode 100644 samples/client/echo_api/python-pydantic-v1/test/test_bird.py create mode 100644 samples/client/echo_api/python-pydantic-v1/test/test_body_api.py create mode 100644 samples/client/echo_api/python-pydantic-v1/test/test_category.py create mode 100644 samples/client/echo_api/python-pydantic-v1/test/test_data_query.py create mode 100644 samples/client/echo_api/python-pydantic-v1/test/test_default_value.py create mode 100644 samples/client/echo_api/python-pydantic-v1/test/test_form_api.py create mode 100644 samples/client/echo_api/python-pydantic-v1/test/test_header_api.py create mode 100644 samples/client/echo_api/python-pydantic-v1/test/test_number_properties_only.py create mode 100644 samples/client/echo_api/python-pydantic-v1/test/test_path_api.py create mode 100644 samples/client/echo_api/python-pydantic-v1/test/test_pet.py create mode 100644 samples/client/echo_api/python-pydantic-v1/test/test_query.py create mode 100644 samples/client/echo_api/python-pydantic-v1/test/test_query_api.py create mode 100644 samples/client/echo_api/python-pydantic-v1/test/test_string_enum_ref.py create mode 100644 samples/client/echo_api/python-pydantic-v1/test/test_tag.py create mode 100644 samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py create mode 100644 samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_form_explode_true_array_string_query_object_parameter.py create mode 100644 samples/client/echo_api/python-pydantic-v1/tox.ini create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.github/workflows/python.yml create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.gitignore create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.gitlab-ci.yml create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator-ignore create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/FILES create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/VERSION create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.travis.yml create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesAnyType.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesClass.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesObject.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesWithDescriptionOnly.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AllOfWithSingleRef.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Animal.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnotherFakeApi.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnyOfColor.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnyOfPig.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ApiResponse.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfArrayOfModel.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfArrayOfNumberOnly.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfNumberOnly.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayTest.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/BasquePig.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Capitalization.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Cat.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Category.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/CircularReferenceModel.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ClassModel.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Client.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Color.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Creature.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/CreatureInfo.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DanishPig.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DefaultApi.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DeprecatedObject.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Dog.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DummyModel.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumArrays.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumClass.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumString1.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumString2.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumTest.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeApi.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeClassnameTags123Api.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/File.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FileSchemaTestClass.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FirstRef.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Foo.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FooGetDefaultResponse.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FormatTest.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/HasOnlyReadOnly.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/HealthCheckResult.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/InnerDictWithProperty.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/IntOrString.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/List.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MapOfArrayOfModel.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MapTest.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MixedPropertiesAndAdditionalPropertiesClass.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Model200Response.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ModelReturn.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Name.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NullableClass.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NullableProperty.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NumberOnly.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ObjectToTestAdditionalProperties.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ObjectWithDeprecatedFields.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OneOfEnumString.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Order.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterComposite.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnum.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumDefaultValue.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumInteger.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumIntegerDefaultValue.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterObjectWithEnumProperty.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Parent.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ParentWithOptionalDict.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Pet.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/PetApi.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Pig.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/PropertyNameCollision.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ReadOnlyFirst.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SecondRef.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SelfReferenceModel.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SingleRefType.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialCharacterEnum.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialModelName.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialName.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/StoreApi.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Tag.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/TestInlineFreeformAdditionalPropertiesRequest.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Tiger.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/User.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/UserApi.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/WithNestedOneOf.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/git_push.sh create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/__init__.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/__init__.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/another_fake_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/default_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_classname_tags123_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/pet_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/store_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/user_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api_client.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api_response.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/configuration.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/exceptions.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/__init__.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_any_type.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_object.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_with_description_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/all_of_with_single_ref.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/animal.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/any_of_color.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/any_of_pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/api_response.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_array_of_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_array_of_number_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_number_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/basque_pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/capitalization.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/cat.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/category.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/circular_reference_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/class_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/client.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/color.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/creature.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/creature_info.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/danish_pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/deprecated_object.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/dog.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/dummy_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_arrays.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_string1.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_string2.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/file.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/file_schema_test_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/first_ref.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/foo.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/foo_get_default_response.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/format_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/has_only_read_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/health_check_result.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/inner_dict_with_property.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/int_or_string.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/list.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/map_of_array_of_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/map_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/mixed_properties_and_additional_properties_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/model200_response.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/model_return.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/name.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/nullable_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/nullable_property.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/number_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/object_to_test_additional_properties.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/object_with_deprecated_fields.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/one_of_enum_string.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/order.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_composite.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_default_value.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_integer.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_integer_default_value.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_object_with_enum_property.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/parent.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/parent_with_optional_dict.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/pet.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/property_name_collision.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/read_only_first.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/second_ref.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/self_reference_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/single_ref_type.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_character_enum.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_model_name.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_name.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/tag.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/test_inline_freeform_additional_properties_request.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/tiger.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/user.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/with_nested_one_of.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/py.typed create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/rest.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/signing.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/pyproject.toml create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/requirements.txt create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/setup.cfg create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/setup.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test-requirements.txt create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/__init__.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_any_type.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_object.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_with_description_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_all_of_with_single_ref.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_animal.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_another_fake_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_any_of_color.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_any_of_pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_api_response.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_array_of_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_array_of_number_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_number_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_basque_pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_capitalization.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_cat.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_category.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_circular_reference_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_class_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_client.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_color.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_creature.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_creature_info.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_danish_pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_default_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_deprecated_object.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_dog.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_dummy_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_arrays.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_string1.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_string2.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_classname_tags123_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_file.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_file_schema_test_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_first_ref.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_foo.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_foo_get_default_response.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_format_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_has_only_read_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_health_check_result.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_inner_dict_with_property.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_int_or_string.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_list.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_map_of_array_of_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_map_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_mixed_properties_and_additional_properties_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_model200_response.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_model_return.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_name.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_nullable_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_nullable_property.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_number_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_object_to_test_additional_properties.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_object_with_deprecated_fields.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_one_of_enum_string.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_order.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_composite.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_default_value.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_integer.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_integer_default_value.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_object_with_enum_property.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_parent.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_parent_with_optional_dict.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pet.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pet_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_property_name_collision.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_read_only_first.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_second_ref.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_self_reference_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_single_ref_type.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_character_enum.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_model_name.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_name.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_store_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_tag.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_test_inline_freeform_additional_properties_request.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_tiger.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_user.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_user_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_with_nested_one_of.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/tox.ini create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/.github/workflows/python.yml create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/.gitignore create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/.gitlab-ci.yml create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator-ignore create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator/FILES create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator/VERSION create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/.travis.yml create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/README.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/AdditionalPropertiesAnyType.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/AdditionalPropertiesClass.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/AdditionalPropertiesObject.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/AdditionalPropertiesWithDescriptionOnly.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/AllOfWithSingleRef.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/Animal.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/AnotherFakeApi.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/AnyOfColor.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/AnyOfPig.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/ApiResponse.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/ArrayOfArrayOfModel.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/ArrayOfArrayOfNumberOnly.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/ArrayOfNumberOnly.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/ArrayTest.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/BasquePig.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/Capitalization.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/Cat.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/Category.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/CircularReferenceModel.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/ClassModel.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/Client.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/Color.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/Creature.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/CreatureInfo.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/DanishPig.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/DefaultApi.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/DeprecatedObject.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/Dog.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/DummyModel.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumArrays.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumClass.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumString1.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumString2.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumTest.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/FakeApi.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/FakeClassnameTags123Api.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/File.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/FileSchemaTestClass.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/FirstRef.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/Foo.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/FooGetDefaultResponse.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/FormatTest.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/HasOnlyReadOnly.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/HealthCheckResult.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/InnerDictWithProperty.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/IntOrString.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/List.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/MapOfArrayOfModel.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/MapTest.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/MixedPropertiesAndAdditionalPropertiesClass.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/Model200Response.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/ModelReturn.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/Name.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/NullableClass.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/NullableProperty.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/NumberOnly.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/ObjectToTestAdditionalProperties.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/ObjectWithDeprecatedFields.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/OneOfEnumString.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/Order.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterComposite.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterEnum.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterEnumDefaultValue.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterEnumInteger.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterEnumIntegerDefaultValue.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterObjectWithEnumProperty.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/Parent.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/ParentWithOptionalDict.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/Pet.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/PetApi.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/Pig.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/PropertyNameCollision.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/ReadOnlyFirst.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/SecondRef.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/SelfReferenceModel.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/SingleRefType.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/SpecialCharacterEnum.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/SpecialModelName.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/SpecialName.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/StoreApi.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/Tag.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/TestInlineFreeformAdditionalPropertiesRequest.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/Tiger.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/User.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/UserApi.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/WithNestedOneOf.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/git_push.sh create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/__init__.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/__init__.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/another_fake_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/default_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/fake_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/fake_classname_tags123_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/pet_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/store_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/user_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api_client.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api_response.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/configuration.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/exceptions.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/__init__.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/additional_properties_any_type.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/additional_properties_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/additional_properties_object.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/additional_properties_with_description_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/all_of_with_single_ref.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/animal.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/any_of_color.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/any_of_pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/api_response.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/array_of_array_of_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/array_of_array_of_number_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/array_of_number_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/array_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/basque_pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/capitalization.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/cat.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/category.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/circular_reference_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/class_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/client.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/color.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/creature.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/creature_info.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/danish_pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/deprecated_object.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/dog.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/dummy_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_arrays.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_string1.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_string2.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/file.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/file_schema_test_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/first_ref.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/foo.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/foo_get_default_response.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/format_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/has_only_read_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/health_check_result.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/inner_dict_with_property.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/int_or_string.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/list.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/map_of_array_of_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/map_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/mixed_properties_and_additional_properties_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/model200_response.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/model_return.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/name.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/nullable_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/nullable_property.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/number_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/object_to_test_additional_properties.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/object_with_deprecated_fields.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/one_of_enum_string.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/order.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_composite.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_enum.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_enum_default_value.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_enum_integer.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_enum_integer_default_value.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_object_with_enum_property.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/parent.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/parent_with_optional_dict.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/pet.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/property_name_collision.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/read_only_first.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/second_ref.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/self_reference_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/single_ref_type.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/special_character_enum.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/special_model_name.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/special_name.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/tag.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/test_inline_freeform_additional_properties_request.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/tiger.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/user.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/with_nested_one_of.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/py.typed create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/rest.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/signing.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/pyproject.toml create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/requirements.txt create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/setup.cfg create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/setup.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test-requirements.txt create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/__init__.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_any_type.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_object.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_with_description_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_all_of_with_single_ref.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_animal.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_another_fake_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_color.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_api_response.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_number_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_number_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_basque_pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_capitalization.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_cat.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_category.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_circular_reference_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_class_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_client.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_color.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature_info.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_danish_pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_default_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_deprecated_object.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_dog.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_dummy_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_arrays.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string1.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string2.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_classname_tags123_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_file.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_file_schema_test_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_first_ref.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo_get_default_response.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_format_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_has_only_read_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_health_check_result.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_inner_dict_with_property.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_int_or_string.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_list.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_of_array_of_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_test.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_mixed_properties_and_additional_properties_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_model200_response.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_model_return.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_name.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_property.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_number_only.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_to_test_additional_properties.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_with_deprecated_fields.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_one_of_enum_string.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_order.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_composite.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_default_value.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer_default_value.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_object_with_enum_property.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent_with_optional_dict.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_pig.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_property_name_collision.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_read_only_first.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_second_ref.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_self_reference_model.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_single_ref_type.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_character_enum.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_model_name.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_name.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_store_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_tag.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_test_inline_freeform_additional_properties_request.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_tiger.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_user.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_user_api.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_with_nested_one_of.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/tox.ini diff --git a/.github/workflows/samples-python-nextgen-client-echo-api.yaml b/.github/workflows/samples-python-client-echo-api.yaml similarity index 94% rename from .github/workflows/samples-python-nextgen-client-echo-api.yaml rename to .github/workflows/samples-python-client-echo-api.yaml index 095d034572f..9f39bae9a07 100644 --- a/.github/workflows/samples-python-nextgen-client-echo-api.yaml +++ b/.github/workflows/samples-python-client-echo-api.yaml @@ -4,7 +4,7 @@ on: pull_request: paths: - samples/client/echo_api/python/** - - .github/workflows/samples-python-nextgen-client-echo-api.yaml + - .github/workflows/samples-python-client-echo-api.yaml jobs: build: diff --git a/.github/workflows/samples-python-pydantic-v1-client-echo-api.yaml b/.github/workflows/samples-python-pydantic-v1-client-echo-api.yaml new file mode 100644 index 00000000000..723d5bd9fb1 --- /dev/null +++ b/.github/workflows/samples-python-pydantic-v1-client-echo-api.yaml @@ -0,0 +1,44 @@ +name: Python Client pydantic v1 (Echo API) + +on: + pull_request: + paths: + - samples/client/echo_api/python-pydantic-v1/** + - .github/workflows/samples-python-pydantic-v1-client-echo-api.yaml + +jobs: + build: + name: Test Python client + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + sample: + # clients + - samples/client/echo_api/python + python-version: + - "3.7" + - "3.8" + - "3.9" + - "3.10" + - "3.11" + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Setup node.js + uses: actions/setup-node@v3 + - name: Run echo server + run: | + git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server + (cd http-echo-server && npm install && npm start &) + - name: Install + working-directory: ${{ matrix.sample }} + run: | + pip install -r requirements.txt + pip install -r test-requirements.txt + + - name: Test + working-directory: ${{ matrix.sample }} + run: python -m pytest diff --git a/.github/workflows/samples-python-pydantic-v1-petstore.yaml b/.github/workflows/samples-python-pydantic-v1-petstore.yaml new file mode 100644 index 00000000000..7ec953515ad --- /dev/null +++ b/.github/workflows/samples-python-pydantic-v1-petstore.yaml @@ -0,0 +1,59 @@ +name: "Python Client pydantic v1: Petstore" + +on: + pull_request: + paths: + - samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/** + - samples/openapi3/client/petstore/python-pydantic-v1/** + - .github/workflows/samples-python-pydantic-v1-petstore.yaml + +jobs: + build: + name: Test Python client + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: + - "3.7" + - "3.8" + - "3.9" + - "3.10" + - "3.11" + sample: + - samples/openapi3/client/petstore/python-aiohttp + - samples/openapi3/client/petstore/python + services: + petstore-api: + image: swaggerapi/petstore + ports: + - 80:8080 + env: + SWAGGER_HOST: http://petstore.swagger.io + SWAGGER_BASE_PATH: /v2 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + id: py + with: + python-version: ${{ matrix.python-version }} + + - name: Cache + uses: actions/cache@v3 + with: + key: ${{ runner.os }}-python-${{ steps.py.outputs.python-version }}- + path: | + ~/.cache/pypoetry/virtualenvs/ + ~/.local/pipx/venvs/poetry/ + .mypy_cache/ + + - name: Install poetry + run: pipx install --python '${{ steps.py.outputs.python-path }}' poetry + + - name: Install + working-directory: ${{ matrix.sample }} + run: poetry install + + - name: Test + working-directory: ${{ matrix.sample }} + run: poetry run pytest -v diff --git a/bin/configs/python-pydantic-v1-aiohttp.yaml b/bin/configs/python-pydantic-v1-aiohttp.yaml new file mode 100644 index 00000000000..2ba8f232674 --- /dev/null +++ b/bin/configs/python-pydantic-v1-aiohttp.yaml @@ -0,0 +1,8 @@ +generatorName: python-pydantic-v1 +outputDir: samples/openapi3/client/petstore/python-pydantic-v1-aiohttp +inputSpec: modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml +templateDir: modules/openapi-generator/src/main/resources/python-pydantic-v1 +library: asyncio +additionalProperties: + packageName: petstore_api + mapNumberTo: float diff --git a/bin/configs/python-pydantic-v1-echo-api.yaml b/bin/configs/python-pydantic-v1-echo-api.yaml new file mode 100644 index 00000000000..19020abc3b6 --- /dev/null +++ b/bin/configs/python-pydantic-v1-echo-api.yaml @@ -0,0 +1,6 @@ +generatorName: python-pydantic-v1 +outputDir: samples/client/echo_api/python-pydantic-v1 +inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml +templateDir: modules/openapi-generator/src/main/resources/python-pydantic-v1 +additionalProperties: + hideGenerationTimestamp: "true" diff --git a/bin/configs/python-pydantic-v1.yaml b/bin/configs/python-pydantic-v1.yaml new file mode 100644 index 00000000000..af6786e6633 --- /dev/null +++ b/bin/configs/python-pydantic-v1.yaml @@ -0,0 +1,12 @@ +generatorName: python-pydantic-v1 +outputDir: samples/openapi3/client/petstore/python-pydantic-v1 +inputSpec: modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml +templateDir: modules/openapi-generator/src/main/resources/python-pydantic-v1 +additionalProperties: + packageName: petstore_api + useOneOfDiscriminatorLookup: "true" + disallowAdditionalPropertiesIfNotPresent: false + mapNumberTo: StrictFloat +nameMappings: + _type: underscore_type + type_: type_with_underscore diff --git a/docs/generators.md b/docs/generators.md index a112cae00a5..d07a0bf2abb 100644 --- a/docs/generators.md +++ b/docs/generators.md @@ -53,6 +53,7 @@ The following generators are available: * [php-nextgen (beta)](generators/php-nextgen.md) * [powershell (beta)](generators/powershell.md) * [python](generators/python.md) +* [python-pydantic-v1](generators/python-pydantic-v1.md) * [r](generators/r.md) * [ruby](generators/ruby.md) * [rust](generators/rust.md) diff --git a/docs/generators/python-pydantic-v1.md b/docs/generators/python-pydantic-v1.md new file mode 100644 index 00000000000..e157b9b1a05 --- /dev/null +++ b/docs/generators/python-pydantic-v1.md @@ -0,0 +1,232 @@ +--- +title: Documentation for the python-pydantic-v1 Generator +--- + +## METADATA + +| Property | Value | Notes | +| -------- | ----- | ----- | +| generator name | python-pydantic-v1 | pass this to the generate command after -g | +| generator stability | STABLE | | +| generator type | CLIENT | | +| generator language | Python | | +| generator language version | 3.7+ | | +| generator default templating engine | mustache | | +| helpTxt | Generates a Python client library. | | + +## CONFIG OPTIONS +These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. + +| Option | Description | Values | Default | +| ------ | ----------- | ------ | ------- | +|dateFormat|date format for query parameters| |%Y-%m-%d| +|datetimeFormat|datetime format for query parameters| |%Y-%m-%dT%H:%M:%S%z| +|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| +|generateSourceCodeOnly|Specifies that only a library source code is to be generated.| |false| +|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true| +|library|library template (sub-template) to use: asyncio, tornado (deprecated), urllib3| |urllib3| +|mapNumberTo|Map number to Union[StrictFloat, StrictInt], StrictStr or float.| |Union[StrictFloat, StrictInt]| +|packageName|python package name (convention: snake_case).| |openapi_client| +|packageUrl|python package URL.| |null| +|packageVersion|python package version.| |1.0.0| +|projectName|python project name in setup.py (e.g. petstore-api).| |null| +|recursionLimit|Set the recursion limit. If not set, use the system default value.| |null| +|useOneOfDiscriminatorLookup|Use the discriminator's mapping in oneOf to speed up the model lookup. IMPORTANT: Validation (e.g. one and only one match in oneOf's schemas) will be skipped.| |false| + +## IMPORT MAPPING + +| Type/Alias | Imports | +| ---------- | ------- | + + +## INSTANTIATION TYPES + +| Type/Alias | Instantiated By | +| ---------- | --------------- | + + +## LANGUAGE PRIMITIVES + + + +## RESERVED WORDS + + + +## FEATURE SET + + +### Client Modification Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|BasePath|✗|ToolingExtension +|Authorizations|✗|ToolingExtension +|UserAgent|✗|ToolingExtension +|MockServer|✗|ToolingExtension + +### Data Type Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Custom|✗|OAS2,OAS3 +|Int32|✓|OAS2,OAS3 +|Int64|✓|OAS2,OAS3 +|Float|✓|OAS2,OAS3 +|Double|✓|OAS2,OAS3 +|Decimal|✓|ToolingExtension +|String|✓|OAS2,OAS3 +|Byte|✓|OAS2,OAS3 +|Binary|✓|OAS2,OAS3 +|Boolean|✓|OAS2,OAS3 +|Date|✓|OAS2,OAS3 +|DateTime|✓|OAS2,OAS3 +|Password|✓|OAS2,OAS3 +|File|✓|OAS2 +|Uuid|✗| +|Array|✓|OAS2,OAS3 +|Null|✗|OAS3 +|AnyType|✗|OAS2,OAS3 +|Object|✓|OAS2,OAS3 +|Maps|✓|ToolingExtension +|CollectionFormat|✓|OAS2 +|CollectionFormatMulti|✓|OAS2 +|Enum|✓|OAS2,OAS3 +|ArrayOfEnum|✓|ToolingExtension +|ArrayOfModel|✓|ToolingExtension +|ArrayOfCollectionOfPrimitives|✓|ToolingExtension +|ArrayOfCollectionOfModel|✓|ToolingExtension +|ArrayOfCollectionOfEnum|✓|ToolingExtension +|MapOfEnum|✓|ToolingExtension +|MapOfModel|✓|ToolingExtension +|MapOfCollectionOfPrimitives|✓|ToolingExtension +|MapOfCollectionOfModel|✓|ToolingExtension +|MapOfCollectionOfEnum|✓|ToolingExtension + +### Documentation Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Readme|✓|ToolingExtension +|Model|✓|ToolingExtension +|Api|✓|ToolingExtension + +### Global Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Host|✓|OAS2,OAS3 +|BasePath|✓|OAS2,OAS3 +|Info|✓|OAS2,OAS3 +|Schemes|✗|OAS2,OAS3 +|PartialSchemes|✓|OAS2,OAS3 +|Consumes|✓|OAS2 +|Produces|✓|OAS2 +|ExternalDocumentation|✓|OAS2,OAS3 +|Examples|✓|OAS2,OAS3 +|XMLStructureDefinitions|✗|OAS2,OAS3 +|MultiServer|✗|OAS3 +|ParameterizedServer|✗|OAS3 +|ParameterStyling|✗|OAS3 +|Callbacks|✗|OAS3 +|LinkObjects|✗|OAS3 + +### Parameter Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Path|✓|OAS2,OAS3 +|Query|✓|OAS2,OAS3 +|Header|✓|OAS2,OAS3 +|Body|✓|OAS2 +|FormUnencoded|✓|OAS2 +|FormMultipart|✓|OAS2 +|Cookie|✗|OAS3 + +### Schema Support Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|Simple|✓|OAS2,OAS3 +|Composite|✓|OAS2,OAS3 +|Polymorphism|✓|OAS2,OAS3 +|Union|✗|OAS3 +|allOf|✓|OAS2,OAS3 +|anyOf|✓|OAS3 +|oneOf|✓|OAS3 +|not|✗|OAS3 + +### Security Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|BasicAuth|✓|OAS2,OAS3 +|ApiKey|✓|OAS2,OAS3 +|OpenIDConnect|✗|OAS3 +|BearerToken|✓|OAS3 +|OAuth2_Implicit|✓|OAS2,OAS3 +|OAuth2_Password|✗|OAS2,OAS3 +|OAuth2_ClientCredentials|✗|OAS2,OAS3 +|OAuth2_AuthorizationCode|✗|OAS2,OAS3 +|SignatureAuth|✓|OAS3 + +### Wire Format Feature +| Name | Supported | Defined By | +| ---- | --------- | ---------- | +|JSON|✓|OAS2,OAS3 +|XML|✓|OAS2,OAS3 +|PROTOBUF|✗|ToolingExtension +|Custom|✓|OAS2,OAS3 diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientPydanticV1Codegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientPydanticV1Codegen.java new file mode 100644 index 00000000000..0ef7985e991 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientPydanticV1Codegen.java @@ -0,0 +1,484 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.languages; + +import io.swagger.v3.oas.models.media.ArraySchema; +import io.swagger.v3.oas.models.media.Schema; +import io.swagger.v3.oas.models.security.SecurityScheme; +import org.apache.commons.lang3.StringUtils; +import org.openapitools.codegen.*; +import org.openapitools.codegen.meta.GeneratorMetadata; +import org.openapitools.codegen.meta.Stability; +import org.openapitools.codegen.meta.features.*; +import org.openapitools.codegen.meta.features.*; +import org.openapitools.codegen.model.ModelMap; +import org.openapitools.codegen.model.ModelsMap; +import org.openapitools.codegen.model.OperationMap; +import org.openapitools.codegen.model.OperationsMap; +import org.openapitools.codegen.utils.ModelUtils; +import org.openapitools.codegen.utils.ProcessUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.util.*; + +import static org.openapitools.codegen.utils.StringUtils.escape; +import static org.openapitools.codegen.utils.StringUtils.underscore; + +public class PythonClientPydanticV1Codegen extends AbstractPythonCodegen implements CodegenConfig { + private final Logger LOGGER = LoggerFactory.getLogger(PythonClientCodegen.class); + + public static final String PACKAGE_URL = "packageUrl"; + public static final String DEFAULT_LIBRARY = "urllib3"; + public static final String RECURSION_LIMIT = "recursionLimit"; + public static final String DATETIME_FORMAT = "datetimeFormat"; + public static final String DATE_FORMAT = "dateFormat"; + + protected String packageUrl; + protected String apiDocPath = "docs/"; + protected String modelDocPath = "docs/"; + protected boolean useOneOfDiscriminatorLookup = false; // use oneOf discriminator's mapping for model lookup + protected String datetimeFormat = "%Y-%m-%dT%H:%M:%S.%f%z"; + protected String dateFormat = "%Y-%m-%d"; + + + private String testFolder; + + public PythonClientPydanticV1Codegen() { + super(); + + // force sortParamsByRequiredFlag to true to make the api method signature less complicated + sortParamsByRequiredFlag = true; + + modifyFeatureSet(features -> features + .includeDocumentationFeatures(DocumentationFeature.Readme) + .wireFormatFeatures(EnumSet.of(WireFormatFeature.JSON, WireFormatFeature.XML, WireFormatFeature.Custom)) + .includeSecurityFeatures(SecurityFeature.SignatureAuth) + .excludeGlobalFeatures( + GlobalFeature.XMLStructureDefinitions, + GlobalFeature.Callbacks, + GlobalFeature.LinkObjects, + GlobalFeature.ParameterStyling + ) + .includeSchemaSupportFeatures( + SchemaSupportFeature.Polymorphism, + SchemaSupportFeature.allOf, + SchemaSupportFeature.oneOf, + SchemaSupportFeature.anyOf + ) + .excludeParameterFeatures( + ParameterFeature.Cookie + ) + ); + + generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata) + .stability(Stability.STABLE) + .build(); + + // clear import mapping (from default generator) as python does not use it + // at the moment + importMapping.clear(); + + // override type mapping in abstract python codegen + typeMapping.put("array", "List"); + typeMapping.put("set", "List"); + typeMapping.put("map", "Dict"); + typeMapping.put("decimal", "decimal.Decimal"); + typeMapping.put("file", "bytearray"); + typeMapping.put("binary", "bytearray"); + typeMapping.put("ByteArray", "bytearray"); + + languageSpecificPrimitives.remove("file"); + languageSpecificPrimitives.add("decimal.Decimal"); + languageSpecificPrimitives.add("bytearray"); + languageSpecificPrimitives.add("none_type"); + + supportsInheritance = true; + modelPackage = "models"; + apiPackage = "api"; + outputFolder = "generated-code" + File.separatorChar + "python"; + + modelTemplateFiles.put("model.mustache", ".py"); + apiTemplateFiles.put("api.mustache", ".py"); + + modelTestTemplateFiles.put("model_test.mustache", ".py"); + apiTestTemplateFiles.put("api_test.mustache", ".py"); + + embeddedTemplateDir = templateDir = "python"; + + modelDocTemplateFiles.put("model_doc.mustache", ".md"); + apiDocTemplateFiles.put("api_doc.mustache", ".md"); + + testFolder = "test"; + + // default HIDE_GENERATION_TIMESTAMP to true + hideGenerationTimestamp = Boolean.TRUE; + + // from https://docs.python.org/3/reference/lexical_analysis.html#keywords + setReservedWordsLowerCase( + Arrays.asList( + // pydantic keyword + "schema", "base64", "json", + "date", + // @property + "property", + // python reserved words + "and", "del", "from", "not", "while", "as", "elif", "global", "or", "with", + "assert", "else", "if", "pass", "yield", "break", "except", "import", + "print", "class", "exec", "in", "raise", "continue", "finally", "is", + "return", "def", "for", "lambda", "try", "self", "nonlocal", "None", "True", + "False", "async", "await")); + + cliOptions.clear(); + cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "python package name (convention: snake_case).") + .defaultValue("openapi_client")); + cliOptions.add(new CliOption(CodegenConstants.PROJECT_NAME, "python project name in setup.py (e.g. petstore-api).")); + cliOptions.add(new CliOption(CodegenConstants.PACKAGE_VERSION, "python package version.") + .defaultValue("1.0.0")); + cliOptions.add(new CliOption(PACKAGE_URL, "python package URL.")); + cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP, CodegenConstants.HIDE_GENERATION_TIMESTAMP_DESC) + .defaultValue(Boolean.TRUE.toString())); + cliOptions.add(new CliOption(CodegenConstants.SOURCECODEONLY_GENERATION, CodegenConstants.SOURCECODEONLY_GENERATION_DESC) + .defaultValue(Boolean.FALSE.toString())); + cliOptions.add(new CliOption(RECURSION_LIMIT, "Set the recursion limit. If not set, use the system default value.")); + cliOptions.add(new CliOption(MAP_NUMBER_TO, "Map number to Union[StrictFloat, StrictInt], StrictStr or float.") + .defaultValue("Union[StrictFloat, StrictInt]")); + cliOptions.add(new CliOption(DATETIME_FORMAT, "datetime format for query parameters") + .defaultValue("%Y-%m-%dT%H:%M:%S%z")); + cliOptions.add(new CliOption(DATE_FORMAT, "date format for query parameters") + .defaultValue("%Y-%m-%d")); + cliOptions.add(new CliOption(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP_DESC).defaultValue("false")); + + supportedLibraries.put("urllib3", "urllib3-based client"); + supportedLibraries.put("asyncio", "asyncio-based client"); + supportedLibraries.put("tornado", "tornado-based client (deprecated)"); + CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use: asyncio, tornado (deprecated), urllib3"); + libraryOption.setDefault(DEFAULT_LIBRARY); + cliOptions.add(libraryOption); + setLibrary(DEFAULT_LIBRARY); + + // option to change how we process + set the data in the 'additionalProperties' keyword. + CliOption disallowAdditionalPropertiesIfNotPresentOpt = CliOption.newBoolean( + CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT, + CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT_DESC).defaultValue(Boolean.TRUE.toString()); + Map disallowAdditionalPropertiesIfNotPresentOpts = new HashMap<>(); + disallowAdditionalPropertiesIfNotPresentOpts.put("false", + "The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications."); + disallowAdditionalPropertiesIfNotPresentOpts.put("true", + "Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default."); + disallowAdditionalPropertiesIfNotPresentOpt.setEnum(disallowAdditionalPropertiesIfNotPresentOpts); + cliOptions.add(disallowAdditionalPropertiesIfNotPresentOpt); + this.setDisallowAdditionalPropertiesIfNotPresent(true); + } + + @Override + public void processOpts() { + this.setLegacyDiscriminatorBehavior(false); + + super.processOpts(); + + // map to Dot instead of Period + specialCharReplacements.put(".", "Dot"); + + if (StringUtils.isEmpty(System.getenv("PYTHON_POST_PROCESS_FILE"))) { + LOGGER.info("Environment variable PYTHON_POST_PROCESS_FILE not defined so the Python code may not be properly formatted. To define it, try 'export PYTHON_POST_PROCESS_FILE=\"/usr/local/bin/yapf -i\"' (Linux/Mac)"); + LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI)."); + } + + Boolean excludeTests = false; + + if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) { + setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME)); + } + + if (additionalProperties.containsKey(CodegenConstants.PROJECT_NAME)) { + setProjectName((String) additionalProperties.get(CodegenConstants.PROJECT_NAME)); + } else { + // default: set project based on package name + // e.g. petstore_api (package name) => petstore-api (project name) + setProjectName(packageName.replaceAll("_", "-")); + } + + if (additionalProperties.containsKey(CodegenConstants.PACKAGE_VERSION)) { + setPackageVersion((String) additionalProperties.get(CodegenConstants.PACKAGE_VERSION)); + } + + additionalProperties.put(CodegenConstants.PROJECT_NAME, projectName); + additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName); + additionalProperties.put(CodegenConstants.PACKAGE_VERSION, packageVersion); + + if (additionalProperties.containsKey(CodegenConstants.EXCLUDE_TESTS)) { + excludeTests = Boolean.valueOf(additionalProperties.get(CodegenConstants.EXCLUDE_TESTS).toString()); + } + + Boolean generateSourceCodeOnly = false; + if (additionalProperties.containsKey(CodegenConstants.SOURCECODEONLY_GENERATION)) { + generateSourceCodeOnly = Boolean.valueOf(additionalProperties.get(CodegenConstants.SOURCECODEONLY_GENERATION).toString()); + } + + if (generateSourceCodeOnly) { + // tests in /test + testFolder = packagePath() + File.separatorChar + testFolder; + // api/model docs in /docs + apiDocPath = packagePath() + "/" + apiDocPath; + modelDocPath = packagePath() + "/" + modelDocPath; + } + // make api and model doc path available in mustache template + additionalProperties.put("apiDocPath", apiDocPath); + additionalProperties.put("modelDocPath", modelDocPath); + + if (additionalProperties.containsKey(PACKAGE_URL)) { + setPackageUrl((String) additionalProperties.get(PACKAGE_URL)); + } + + // check to see if setRecursionLimit is set and whether it's an integer + if (additionalProperties.containsKey(RECURSION_LIMIT)) { + try { + Integer.parseInt((String) additionalProperties.get(RECURSION_LIMIT)); + } catch (NumberFormatException | NullPointerException e) { + throw new IllegalArgumentException("recursionLimit must be an integer, e.g. 2000."); + } + } + + if (additionalProperties.containsKey(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP)) { + setUseOneOfDiscriminatorLookup(convertPropertyToBooleanAndWriteBack(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP)); + } else { + additionalProperties.put(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, useOneOfDiscriminatorLookup); + } + + if (additionalProperties.containsKey(MAP_NUMBER_TO)) { + setMapNumberTo(String.valueOf(additionalProperties.get(MAP_NUMBER_TO))); + } + + if (additionalProperties.containsKey(DATETIME_FORMAT)) { + setDatetimeFormat((String) additionalProperties.get(DATETIME_FORMAT)); + } else { + additionalProperties.put(DATETIME_FORMAT, datetimeFormat); + } + + if (additionalProperties.containsKey(DATE_FORMAT)) { + setDateFormat((String) additionalProperties.get(DATE_FORMAT)); + } else { + additionalProperties.put(DATE_FORMAT, dateFormat); + } + + String modelPath = packagePath() + File.separatorChar + modelPackage.replace('.', File.separatorChar); + String apiPath = packagePath() + File.separatorChar + apiPackage.replace('.', File.separatorChar); + + String readmePath = "README.md"; + String readmeTemplate = "README.mustache"; + if (generateSourceCodeOnly) { + readmePath = packagePath() + "_" + readmePath; + readmeTemplate = "README_onlypackage.mustache"; + } + supportingFiles.add(new SupportingFile(readmeTemplate, "", readmePath)); + + if (!generateSourceCodeOnly) { + supportingFiles.add(new SupportingFile("tox.mustache", "", "tox.ini")); + supportingFiles.add(new SupportingFile("test-requirements.mustache", "", "test-requirements.txt")); + supportingFiles.add(new SupportingFile("requirements.mustache", "", "requirements.txt")); + supportingFiles.add(new SupportingFile("setup_cfg.mustache", "", "setup.cfg")); + + supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); + supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); + supportingFiles.add(new SupportingFile("travis.mustache", "", ".travis.yml")); + supportingFiles.add(new SupportingFile("github-workflow.mustache", ".github/workflows", "python.yml")); + supportingFiles.add(new SupportingFile("gitlab-ci.mustache", "", ".gitlab-ci.yml")); + supportingFiles.add(new SupportingFile("setup.mustache", "", "setup.py")); + supportingFiles.add(new SupportingFile("pyproject.mustache", "", "pyproject.toml")); + supportingFiles.add(new SupportingFile("py.typed.mustache", packagePath(), "py.typed")); + } + supportingFiles.add(new SupportingFile("configuration.mustache", packagePath(), "configuration.py")); + supportingFiles.add(new SupportingFile("__init__package.mustache", packagePath(), "__init__.py")); + supportingFiles.add(new SupportingFile("__init__model.mustache", modelPath, "__init__.py")); + supportingFiles.add(new SupportingFile("__init__api.mustache", apiPath, "__init__.py")); + // Generate the 'signing.py' module, but only if the 'HTTP signature' security scheme is specified in the OAS. + Map securitySchemeMap = openAPI != null ? + (openAPI.getComponents() != null ? openAPI.getComponents().getSecuritySchemes() : null) : null; + List authMethods = fromSecurity(securitySchemeMap); + if (ProcessUtils.hasHttpSignatureMethods(authMethods)) { + supportingFiles.add(new SupportingFile("signing.mustache", packagePath(), "signing.py")); + } + + // If the package name consists of dots(openapi.client), then we need to create the directory structure like openapi/client with __init__ files. + String[] packageNameSplits = packageName.split("\\."); + String currentPackagePath = ""; + for (int i = 0; i < packageNameSplits.length - 1; i++) { + if (i > 0) { + currentPackagePath = currentPackagePath + File.separatorChar; + } + currentPackagePath = currentPackagePath + packageNameSplits[i]; + supportingFiles.add(new SupportingFile("__init__.mustache", currentPackagePath, "__init__.py")); + } + + supportingFiles.add(new SupportingFile("exceptions.mustache", packagePath(), "exceptions.py")); + + if (Boolean.FALSE.equals(excludeTests)) { + supportingFiles.add(new SupportingFile("__init__.mustache", testFolder, "__init__.py")); + } + + supportingFiles.add(new SupportingFile("api_client.mustache", packagePath(), "api_client.py")); + supportingFiles.add(new SupportingFile("api_response.mustache", packagePath(), "api_response.py")); + + if ("asyncio".equals(getLibrary())) { + supportingFiles.add(new SupportingFile("asyncio/rest.mustache", packagePath(), "rest.py")); + additionalProperties.put("asyncio", "true"); + } else if ("tornado".equals(getLibrary())) { + supportingFiles.add(new SupportingFile("tornado/rest.mustache", packagePath(), "rest.py")); + additionalProperties.put("tornado", "true"); + } else { + supportingFiles.add(new SupportingFile("rest.mustache", packagePath(), "rest.py")); + } + + modelPackage = this.packageName + "." + modelPackage; + apiPackage = this.packageName + "." + apiPackage; + } + + public void setUseOneOfDiscriminatorLookup(boolean useOneOfDiscriminatorLookup) { + this.useOneOfDiscriminatorLookup = useOneOfDiscriminatorLookup; + } + + public boolean getUseOneOfDiscriminatorLookup() { + return this.useOneOfDiscriminatorLookup; + } + + @Override + public String toModelImport(String name) { + String modelImport; + if (StringUtils.startsWithAny(name, "import", "from")) { + modelImport = name; + } else { + modelImport = "from "; + if (!"".equals(modelPackage())) { + modelImport += modelPackage() + "."; + } + modelImport += toModelFilename(name) + " import " + name; + } + return modelImport; + } + + @Override + public CodegenType getTag() { + return CodegenType.CLIENT; + } + + @Override + public String getName() { + return "python-pydantic-v1"; + } + + @Override + public String getHelp() { + return "Generates a Python client library."; + } + + @Override + public String apiDocFileFolder() { + return (outputFolder + File.separator + apiDocPath); + } + + @Override + public String modelDocFileFolder() { + return (outputFolder + File.separator + modelDocPath); + } + + @Override + public String toModelDocFilename(String name) { + return toModelName(name); + } + + @Override + public String toApiDocFilename(String name) { + return toApiName(name); + } + + @Override + public String apiFileFolder() { + return outputFolder + File.separatorChar + apiPackage().replace('.', File.separatorChar); + } + + @Override + public String modelFileFolder() { + return outputFolder + File.separatorChar + modelPackage().replace('.', File.separatorChar); + } + + @Override + public String apiTestFileFolder() { + return outputFolder + File.separatorChar + testFolder; + } + + @Override + public String modelTestFileFolder() { + return outputFolder + File.separatorChar + testFolder; + } + + public void setPackageUrl(String packageUrl) { + this.packageUrl = packageUrl; + } + + public String packagePath() { + return packageName.replace('.', File.separatorChar); + } + + /** + * Generate Python package name from String `packageName` + *

+ * (PEP 0008) Python packages should also have short, all-lowercase names, + * although the use of underscores is discouraged. + * + * @param packageName Package name + * @return Python package name that conforms to PEP 0008 + */ + @SuppressWarnings("static-method") + public String generatePackageName(String packageName) { + return underscore(packageName.replaceAll("[^\\w]+", "")); + } + + @Override + public String generatorLanguageVersion() { + return "3.7+"; + } + + @Override + protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) { + final Schema additionalProperties = ModelUtils.getAdditionalProperties(schema); + + if (additionalProperties != null) { + codegenModel.additionalPropertiesType = getSchemaType(additionalProperties); + } + } + + @Override + public String escapeReservedWord(String name) { + if (this.reservedWordsMappings().containsKey(name)) { + return this.reservedWordsMappings().get(name); + } + return "var_" + name; + } + + public void setDatetimeFormat(String datetimeFormat) { + this.datetimeFormat = datetimeFormat; + } + + public void setDateFormat(String dateFormat) { + this.dateFormat = dateFormat; + } + + +} diff --git a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig index 6bdc45b0054..4fc32dbdce9 100644 --- a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig +++ b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig @@ -101,6 +101,7 @@ org.openapitools.codegen.languages.PostmanCollectionCodegen org.openapitools.codegen.languages.PowerShellClientCodegen org.openapitools.codegen.languages.ProtobufSchemaCodegen org.openapitools.codegen.languages.PythonClientCodegen +org.openapitools.codegen.languages.PythonClientPydanticV1Codegen org.openapitools.codegen.languages.PythonFastAPIServerCodegen org.openapitools.codegen.languages.PythonFlaskConnexionServerCodegen org.openapitools.codegen.languages.PythonAiohttpConnexionServerCodegen diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/README.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/README.mustache new file mode 100644 index 00000000000..201df14f1b4 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/README.mustache @@ -0,0 +1,59 @@ +# {{{projectName}}} +{{#appDescriptionWithNewLines}} +{{{.}}} +{{/appDescriptionWithNewLines}} + +This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: {{appVersion}} +- Package version: {{packageVersion}} +{{^hideGenerationTimestamp}} +- Build date: {{generatedDate}} +{{/hideGenerationTimestamp}} +- Build package: {{generatorClass}} +{{#infoUrl}} +For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) +{{/infoUrl}} + +## Requirements. + +Python {{{generatorLanguageVersion}}} + +## Installation & Usage +### pip install + +If the python package is hosted on a repository, you can install directly using: + +```sh +pip install git+https://{{gitHost}}/{{{gitUserId}}}/{{{gitRepoId}}}.git +``` +(you may need to run `pip` with root permission: `sudo pip install git+https://{{gitHost}}/{{{gitUserId}}}/{{{gitRepoId}}}.git`) + +Then import the package: +```python +import {{{packageName}}} +``` + +### Setuptools + +Install via [Setuptools](http://pypi.python.org/pypi/setuptools). + +```sh +python setup.py install --user +``` +(or `sudo python setup.py install` to install the package for all users) + +Then import the package: +```python +import {{{packageName}}} +``` + +### Tests + +Execute `pytest` to run the tests. + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +{{> common_README }} diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/README_onlypackage.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/README_onlypackage.mustache new file mode 100644 index 00000000000..d04bc051f1d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/README_onlypackage.mustache @@ -0,0 +1,44 @@ +# {{{projectName}}} +{{#appDescription}} +{{{.}}} +{{/appDescription}} + +The `{{packageName}}` package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: {{appVersion}} +- Package version: {{packageVersion}} +{{^hideGenerationTimestamp}} +- Build date: {{generatedDate}} +{{/hideGenerationTimestamp}} +- Build package: {{generatorClass}} +{{#infoUrl}} +For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) +{{/infoUrl}} + +## Requirements. + +Python {{{generatorLanguageVersion}}} + +## Installation & Usage + +This python library package is generated without supporting files like setup.py or requirements files + +To be able to use it, you will need these dependencies in your own package that uses this library: + +* urllib3 >= 1.25.3 +* python-dateutil +{{#asyncio}} +* aiohttp +{{/asyncio}} +{{#tornado}} +* tornado>=4.2,<5 +{{/tornado}} +* pydantic +* aenum + +## Getting Started + +In your own code, to use this library to connect and interact with {{{projectName}}}, +you can run the following: + +{{> common_README }} diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/__init__.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/__init__.mustache new file mode 100644 index 00000000000..e69de29bb2d diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/__init__api.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/__init__api.mustache new file mode 100644 index 00000000000..8870835c81e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/__init__api.mustache @@ -0,0 +1,5 @@ +# flake8: noqa + +# import apis into api package +{{#apiInfo}}{{#apis}}from {{apiPackage}}.{{classFilename}} import {{classname}} +{{/apis}}{{/apiInfo}} diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/__init__model.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/__init__model.mustache new file mode 100644 index 00000000000..0e1b55e2ace --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/__init__model.mustache @@ -0,0 +1,11 @@ +# coding: utf-8 + +# flake8: noqa +{{>partial_header}} + +# import models into model package +{{#models}} +{{#model}} +from {{modelPackage}}.{{classFilename}} import {{classname}} +{{/model}} +{{/models}} diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/__init__package.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/__init__package.mustache new file mode 100644 index 00000000000..7985e6e46a4 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/__init__package.mustache @@ -0,0 +1,35 @@ +# coding: utf-8 + +# flake8: noqa + +{{>partial_header}} + +__version__ = "{{packageVersion}}" + +# import apis into sdk package +{{#apiInfo}}{{#apis}}from {{apiPackage}}.{{classFilename}} import {{classname}} +{{/apis}}{{/apiInfo}} +# import ApiClient +from {{packageName}}.api_response import ApiResponse +from {{packageName}}.api_client import ApiClient +from {{packageName}}.configuration import Configuration +from {{packageName}}.exceptions import OpenApiException +from {{packageName}}.exceptions import ApiTypeError +from {{packageName}}.exceptions import ApiValueError +from {{packageName}}.exceptions import ApiKeyError +from {{packageName}}.exceptions import ApiAttributeError +from {{packageName}}.exceptions import ApiException +{{#hasHttpSignatureMethods}} +from {{packageName}}.signing import HttpSigningConfiguration +{{/hasHttpSignatureMethods}} + +# import models into sdk package +{{#models}} +{{#model}} +from {{modelPackage}}.{{classFilename}} import {{classname}} +{{/model}} +{{/models}} +{{#recursionLimit}} + +__import__('sys').setrecursionlimit({{{.}}}) +{{/recursionLimit}} diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/api.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/api.mustache new file mode 100644 index 00000000000..be804beec01 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/api.mustache @@ -0,0 +1,321 @@ +# coding: utf-8 + +{{>partial_header}} + +import re # noqa: F401 +import io +import warnings + +from pydantic import validate_arguments, ValidationError +{{#asyncio}} +from typing import overload, Optional, Union, Awaitable +{{/asyncio}} + +{{#imports}} +{{import}} +{{/imports}} + +from {{packageName}}.api_client import ApiClient +from {{packageName}}.api_response import ApiResponse +from {{packageName}}.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +{{#operations}} +class {{classname}}: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client +{{#operation}} + + @validate_arguments +{{#asyncio}} + async def {{operationId}}(self, {{#allParams}}{{paramName}} : {{{vendorExtensions.x-py-typing}}}{{^required}} = None{{/required}}, {{/allParams}}**kwargs) -> {{{returnType}}}{{^returnType}}None{{/returnType}}: # noqa: E501 +{{/asyncio}} +{{^asyncio}} + def {{operationId}}(self, {{#allParams}}{{paramName}} : {{{vendorExtensions.x-py-typing}}}{{^required}} = None{{/required}}, {{/allParams}}**kwargs) -> {{{returnType}}}{{^returnType}}None{{/returnType}}: # noqa: E501 +{{/asyncio}} + """{{#isDeprecated}}(Deprecated) {{/isDeprecated}}{{{summary}}}{{^summary}}{{operationId}}{{/summary}} # noqa: E501 + +{{#notes}} + {{{.}}} # noqa: E501 +{{/notes}} +{{^asyncio}} + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.{{operationId}}({{#allParams}}{{paramName}}, {{/allParams}}async_req=True) + >>> result = thread.get() +{{/asyncio}} + +{{#allParams}} + :param {{paramName}}:{{#description}} {{{.}}}{{/description}}{{#required}} (required){{/required}}{{#optional}}(optional){{/optional}} + :type {{paramName}}: {{dataType}}{{#optional}}, optional{{/optional}} +{{/allParams}} +{{^asyncio}} + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional +{{/asyncio}} + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: {{returnType}}{{^returnType}}None{{/returnType}} + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the {{operationId}}_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return {{#asyncio}}await {{/asyncio}}self.{{operationId}}_with_http_info({{#allParams}}{{paramName}}, {{/allParams}}**kwargs) # noqa: E501 + + @validate_arguments +{{#asyncio}} + async def {{operationId}}_with_http_info(self, {{#allParams}}{{paramName}} : {{{vendorExtensions.x-py-typing}}}{{^required}} = None{{/required}}, {{/allParams}}**kwargs) -> ApiResponse: # noqa: E501 +{{/asyncio}} +{{^asyncio}} + def {{operationId}}_with_http_info(self, {{#allParams}}{{paramName}} : {{{vendorExtensions.x-py-typing}}}{{^required}} = None{{/required}}, {{/allParams}}**kwargs) -> ApiResponse: # noqa: E501 +{{/asyncio}} + """{{#isDeprecated}}(Deprecated) {{/isDeprecated}}{{{summary}}}{{^summary}}{{operationId}}{{/summary}} # noqa: E501 + +{{#notes}} + {{{.}}} # noqa: E501 +{{/notes}} +{{^asyncio}} + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.{{operationId}}_with_http_info({{#allParams}}{{paramName}}, {{/allParams}}async_req=True) + >>> result = thread.get() +{{/asyncio}} + +{{#allParams}} + :param {{paramName}}:{{#description}} {{{.}}}{{/description}}{{#required}} (required){{/required}}{{#optional}}(optional){{/optional}} + :type {{paramName}}: {{dataType}}{{#optional}}, optional{{/optional}} +{{/allParams}} +{{^asyncio}} + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional +{{/asyncio}} + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: {{#returnType}}tuple({{.}}, status_code(int), headers(HTTPHeaderDict)){{/returnType}}{{^returnType}}None{{/returnType}} + """ + + {{#isDeprecated}} + warnings.warn("{{{httpMethod}}} {{{path}}} is deprecated.", DeprecationWarning) + + {{/isDeprecated}} + {{#servers.0}} + _hosts = [ +{{#servers}} + '{{{url}}}'{{^-last}},{{/-last}} +{{/servers}} + ] + _host = _hosts[0] + if kwargs.get('_host_index'): + _host_index = int(kwargs.get('_host_index')) + if _host_index < 0 or _host_index >= len(_hosts): + raise ApiValueError( + "Invalid host index. Must be 0 <= index < %s" + % len(_host) + ) + _host = _hosts[_host_index] + {{/servers.0}} + _params = locals() + + _all_params = [ +{{#allParams}} + '{{paramName}}'{{^-last}},{{/-last}} +{{/allParams}} + ] + _all_params.extend( + [ +{{^asyncio}} + 'async_req', +{{/asyncio}} + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params{{#servers.0}} and _key != "_host_index"{{/servers.0}}: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method {{operationId}}" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} +{{#pathParams}} + if _params['{{paramName}}'] is not None: + _path_params['{{baseName}}'] = _params['{{paramName}}'] + {{#isArray}} + _collection_formats['{{baseName}}'] = '{{collectionFormat}}' + {{/isArray}} + +{{/pathParams}} + + # process the query parameters + _query_params = [] +{{#queryParams}} + if _params.get('{{paramName}}') is not None: # noqa: E501 + {{#isDateTime}} + if isinstance(_params['{{paramName}}'], datetime): + _query_params.append(('{{baseName}}', _params['{{paramName}}'].strftime(self.api_client.configuration.datetime_format))) + else: + _query_params.append(('{{baseName}}', _params['{{paramName}}'])) + {{/isDateTime}} + {{^isDateTime}} + {{#isDate}} + if isinstance(_params['{{paramName}}'], date): + _query_params.append(('{{baseName}}', _params['{{paramName}}'].strftime(self.api_client.configuration.date_format))) + else: + _query_params.append(('{{baseName}}', _params['{{paramName}}'])) + {{/isDate}} + {{^isDate}} + _query_params.append(('{{baseName}}', _params['{{paramName}}']{{#isEnumRef}}.value{{/isEnumRef}})) + {{/isDate}} + {{/isDateTime}} + {{#isArray}} + _collection_formats['{{baseName}}'] = '{{collectionFormat}}' + {{/isArray}} + +{{/queryParams}} + # process the header parameters + _header_params = dict(_params.get('_headers', {})) +{{#headerParams}} + if _params['{{paramName}}'] is not None: + _header_params['{{baseName}}'] = _params['{{paramName}}'] + {{#isArray}} + _collection_formats['{{baseName}}'] = '{{collectionFormat}}' + {{/isArray}} + +{{/headerParams}} + # process the form parameters + _form_params = [] + _files = {} +{{#formParams}} + if _params['{{paramName}}'] is not None: + {{^isFile}} + _form_params.append(('{{{baseName}}}', _params['{{paramName}}'])) + {{/isFile}} + {{#isFile}} + _files['{{{baseName}}}'] = _params['{{paramName}}'] + {{/isFile}} + {{#isArray}} + _collection_formats['{{{baseName}}}'] = '{{collectionFormat}}' + {{/isArray}} + +{{/formParams}} + # process the body parameter + _body_params = None +{{#bodyParam}} + if _params['{{paramName}}'] is not None: + _body_params = _params['{{paramName}}'] + {{#isBinary}} + # convert to byte array if the input is a file name (str) + if isinstance(_body_params, str): + with io.open(_body_params, "rb") as _fp: + _body_params_from_file = _fp.read() + _body_params = _body_params_from_file + {{/isBinary}} + +{{/bodyParam}} + {{#hasProduces}} + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + [{{#produces}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}]) # noqa: E501 + + {{/hasProduces}} + {{#hasConsumes}} + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + [{{#consumes}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/consumes}}])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + {{/hasConsumes}} + # authentication setting + _auth_settings = [{{#authMethods}}'{{name}}'{{^-last}}, {{/-last}}{{/authMethods}}] # noqa: E501 + + {{#returnType}} + {{#responses}} + {{#-first}} + _response_types_map = { + {{/-first}} + {{^isWildcard}} + '{{code}}': {{#dataType}}"{{.}}"{{/dataType}}{{^dataType}}None{{/dataType}}, + {{/isWildcard}} + {{#-last}} + } + {{/-last}} + {{/responses}} + {{/returnType}} + {{^returnType}} + _response_types_map = {} + {{/returnType}} + + return {{#asyncio}}await {{/asyncio}}self.api_client.call_api( + '{{{path}}}', '{{httpMethod}}', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, +{{^asyncio}} + async_req=_params.get('async_req'), +{{/asyncio}} + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + {{#servers.0}} + _host=_host, + {{/servers.0}} + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) +{{/operation}} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/api_client.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/api_client.mustache new file mode 100644 index 00000000000..0870094d783 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/api_client.mustache @@ -0,0 +1,807 @@ +# coding: utf-8 + +{{>partial_header}} + +import atexit +import datetime +from dateutil.parser import parse +import json +import mimetypes +{{^asyncio}} +from multiprocessing.pool import ThreadPool +{{/asyncio}} +import os +import re +import tempfile + +from urllib.parse import quote +{{#tornado}} +import tornado.gen +{{/tornado}} + +from {{packageName}}.configuration import Configuration +from {{packageName}}.api_response import ApiResponse +import {{modelPackage}} +from {{packageName}} import rest +from {{packageName}}.exceptions import ApiValueError, ApiException + + +class ApiClient: + """Generic API client for OpenAPI client library builds. + + OpenAPI generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the OpenAPI + templates. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API +{{^asyncio}} + :param pool_threads: The number of threads to use for async requests + to the API. More threads means more concurrent API requests. +{{/asyncio}} + """ + + PRIMITIVE_TYPES = (float, bool, bytes, str, int) + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int, # TODO remove as only py3 is supported? + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'object': object, + } + _pool = None + + def __init__(self, configuration=None, header_name=None, header_value=None, + cookie=None{{^asyncio}}, pool_threads=1{{/asyncio}}) -> None: + # use default configuration if none is provided + if configuration is None: + configuration = Configuration.get_default() + self.configuration = configuration +{{^asyncio}} + self.pool_threads = pool_threads +{{/asyncio}} + + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = '{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/{{{packageVersion}}}/python{{/httpUserAgent}}' + self.client_side_validation = configuration.client_side_validation + +{{#asyncio}} + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc_value, traceback): + await self.close() + + async def close(self): + await self.rest_client.close() +{{/asyncio}} +{{^asyncio}} + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + self.close() + + def close(self): + if self._pool: + self._pool.close() + self._pool.join() + self._pool = None + if hasattr(atexit, 'unregister'): + atexit.unregister(self.close) + + @property + def pool(self): + """Create thread pool on first request + avoids instantiating unused threadpool for blocking clients. + """ + if self._pool is None: + atexit.register(self.close) + self._pool = ThreadPool(self.pool_threads) + return self._pool +{{/asyncio}} + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + + _default = None + + @classmethod + def get_default(cls): + """Return new instance of ApiClient. + + This method returns newly created, based on default constructor, + object of ApiClient class or returns a copy of default + ApiClient. + + :return: The ApiClient object. + """ + if cls._default is None: + cls._default = ApiClient() + return cls._default + + @classmethod + def set_default(cls, default): + """Set default instance of ApiClient. + + It stores default ApiClient. + + :param default: object of ApiClient. + """ + cls._default = default + + {{#tornado}} + @tornado.gen.coroutine + {{/tornado}} + {{#asyncio}}async {{/asyncio}}def __call_api( + self, resource_path, method, path_params=None, + query_params=None, header_params=None, body=None, post_params=None, + files=None, response_types_map=None, auth_settings=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None, _host=None, + _request_auth=None): + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict(self.parameters_to_tuples(header_params, + collection_formats)) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples(path_params, + collection_formats) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # post parameters + if post_params or files: + post_params = post_params if post_params else [] + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples(post_params, + collection_formats) + post_params.extend(self.files_parameters(files)) + + # auth setting + self.update_params_for_auth( + header_params, query_params, auth_settings, + resource_path, method, body, + request_auth=_request_auth) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + if _host is None: + url = self.configuration.host + resource_path + else: + # use server/host defined in path or operation instead + url = _host + resource_path + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + url_query = self.parameters_to_url_query(query_params, + collection_formats) + url += "?" + url_query + + try: + # perform request and return response + response_data = {{#asyncio}}await {{/asyncio}}{{#tornado}}yield {{/tornado}}self.request( + method, url, + query_params=query_params, + headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + except ApiException as e: + if e.body: + e.body = e.body.decode('utf-8') + raise e + + self.last_response = response_data + + return_data = None # assuming deserialization is not needed + # data needs deserialization or returns HTTP data (deserialized) only + if _preload_content or _return_http_data_only: + response_type = response_types_map.get(str(response_data.status), None) + if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) + + if response_type == "bytearray": + response_data.data = response_data.data + else: + match = None + content_type = response_data.getheader('content-type') + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_data.data = response_data.data.decode(encoding) + + # deserialize response data + if response_type == "bytearray": + return_data = response_data.data + elif response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None + +{{^tornado}} + if _return_http_data_only: + return return_data + else: + return ApiResponse(status_code = response_data.status, + data = return_data, + headers = response_data.getheaders(), + raw_data = response_data.data) +{{/tornado}} +{{#tornado}} + if _return_http_data_only: + raise tornado.gen.Return(return_data) + else: + raise tornado.gen.Return(ApiResponse(status_code = response_data.status, + data = return_data, + headers = response_data.getheaders(), + raw_data = response_data.data)) +{{/tornado}} + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is OpenAPI model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, list): + return [self.sanitize_for_serialization(sub_obj) + for sub_obj in obj] + elif isinstance(obj, tuple): + return tuple(self.sanitize_for_serialization(sub_obj) + for sub_obj in obj) + elif isinstance(obj, (datetime.datetime, datetime.date)): + return obj.isoformat() + + if isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + obj_dict = obj.to_dict() + + return {key: self.sanitize_for_serialization(val) + for key, val in obj_dict.items()} + + def deserialize(self, response, response_type): + """Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + + :return: deserialized object. + """ + # handle file downloading + # save response body into a tmp file and return the instance + if response_type == "file": + return self.__deserialize_file(response) + + # fetch data from response object + try: + data = json.loads(response.data) + except ValueError: + data = response.data + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if isinstance(klass, str): + if klass.startswith('List['): + sub_kls = re.match(r'List\[(.*)]', klass).group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('Dict['): + sub_kls = re.match(r'Dict\[([^,]*), (.*)]', klass).group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in data.items()} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr({{modelPackage}}, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass == object: + return self.__deserialize_object(data) + elif klass == datetime.date: + return self.__deserialize_date(data) + elif klass == datetime.datetime: + return self.__deserialize_datetime(data) + else: + return self.__deserialize_model(data, klass) + + {{#asyncio}}async {{/asyncio}}def call_api(self, resource_path, method, + path_params=None, query_params=None, header_params=None, + body=None, post_params=None, files=None, + response_types_map=None, auth_settings=None, + {{^asyncio}}async_req=None, {{/asyncio}}_return_http_data_only=None, + collection_formats=None, _preload_content=True, + _request_timeout=None, _host=None, _request_auth=None): + """Makes the HTTP request (synchronous) and returns deserialized data. + +{{^asyncio}} + To make an async_req request, set the async_req parameter. + +{{/asyncio}} + :param resource_path: Path to method endpoint. + :param method: Method to call. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param response: Response data type. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. +{{^asyncio}} + :param async_req bool: execute request asynchronously +{{/asyncio}} + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_token: dict, optional + :return: +{{#asyncio}} + The response. +{{/asyncio}} +{{^asyncio}} + If async_req parameter is True, + the request will be called asynchronously. + The method will return the request thread. + If parameter async_req is False or missing, + then the method will return the response directly. +{{/asyncio}} + """ + args = ( + resource_path, + method, + path_params, + query_params, + header_params, + body, + post_params, + files, + response_types_map, + auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + _host, + _request_auth, + ) +{{#asyncio}} + return await self.__call_api(*args) +{{/asyncio}} +{{^asyncio}} + if not async_req: + return self.__call_api(*args) + + return self.pool.apply_async(self.__call_api, args) +{{/asyncio}} + + {{#asyncio}}async {{/asyncio}}def request(self, method, url, query_params=None, headers=None, + post_params=None, body=None, _preload_content=True, + _request_timeout=None): + """Makes the HTTP request using RESTClient.""" + if method == "GET": + return {{#asyncio}}await {{/asyncio}}self.rest_client.get_request(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "HEAD": + return {{#asyncio}}await {{/asyncio}}self.rest_client.head_request(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "OPTIONS": + return {{#asyncio}}await {{/asyncio}}self.rest_client.options_request(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + elif method == "POST": + return {{#asyncio}}await {{/asyncio}}self.rest_client.post_request(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PUT": + return {{#asyncio}}await {{/asyncio}}self.rest_client.put_request(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PATCH": + return {{#asyncio}}await {{/asyncio}}self.rest_client.patch_request(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "DELETE": + return {{#asyncio}}await {{/asyncio}}self.rest_client.delete_request(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + else: + raise ApiValueError( + "http method must be `GET`, `HEAD`, `OPTIONS`," + " `POST`, `PATCH`, `PUT` or `DELETE`." + ) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501 + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def parameters_to_url_query(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: URL query string (e.g. a=Hello%20World&b=123) + """ + new_params = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501 + if isinstance(v, (int, float)): + v = str(v) + if isinstance(v, bool): + v = str(v).lower() + if isinstance(v, dict): + v = json.dumps(v) + + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(quote(str(value)) for value in v))) + else: + new_params.append((k, quote(str(v)))) + + return "&".join(["=".join(item) for item in new_params]) + + def files_parameters(self, files=None): + """Builds form parameters. + + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + + if files: + for k, v in files.items(): + if not v: + continue + file_names = v if type(v) is list else [v] + for n in file_names: + with open(n, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + mimetype = (mimetypes.guess_type(filename)[0] or + 'application/octet-stream') + params.append( + tuple([k, tuple([filename, filedata, mimetype])])) + + return params + + def select_header_accept(self, accepts): + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return + + for accept in accepts: + if re.search('json', accept, re.IGNORECASE): + return accept + + return accepts[0] + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return None + + for content_type in content_types: + if re.search('json', content_type, re.IGNORECASE): + return content_type + + return content_types[0] + + def update_params_for_auth(self, headers, queries, auth_settings, + resource_path, method, body, + request_auth=None): + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param request_auth: if set, the provided settings will + override the token in the configuration. + """ + if not auth_settings: + return + + if request_auth: + self._apply_auth_params(headers, queries, + resource_path, method, body, + request_auth) + return + + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + self._apply_auth_params(headers, queries, + resource_path, method, body, + auth_setting) + + def _apply_auth_params(self, headers, queries, + resource_path, method, body, + auth_setting): + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + {{#hasHttpSignatureMethods}} + else: + # The HTTP signature scheme requires multiple HTTP headers + # that are calculated dynamically. + signing_info = self.configuration.signing_info + auth_headers = signing_info.get_http_signature_headers( + resource_path, method, headers, body, queries) + headers.update(auth_headers) + {{/hasHttpSignatureMethods}} + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.getheader("Content-Disposition") + if content_disposition: + filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition).group(1) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return str(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return an original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datetime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + return klass.from_dict(data) diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/api_doc.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/api_doc.mustache new file mode 100644 index 00000000000..4a1d3648013 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/api_doc.mustache @@ -0,0 +1,74 @@ +# {{packageName}}.{{classname}}{{#description}} +{{.}}{{/description}} + +All URIs are relative to *{{basePath}}* + +Method | HTTP request | Description +------------- | ------------- | ------------- +{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}} +{{/operation}}{{/operations}} + +{{#operations}} +{{#operation}} +# **{{{operationId}}}** +> {{#returnType}}{{{.}}} {{/returnType}}{{{operationId}}}({{#allParams}}{{#required}}{{{paramName}}}{{/required}}{{^required}}{{{paramName}}}={{{paramName}}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) + +{{{summary}}}{{#notes}} + +{{{.}}}{{/notes}} + +### Example + +{{#hasAuthMethods}} +{{#authMethods}} +{{#isBasic}} +{{#isBasicBasic}} +* Basic Authentication ({{name}}): +{{/isBasicBasic}} +{{#isBasicBearer}} +* Bearer{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} Authentication ({{name}}): +{{/isBasicBearer}} +{{/isBasic}} +{{#isApiKey}} +* Api Key Authentication ({{name}}): +{{/isApiKey }} +{{#isOAuth}} +* OAuth Authentication ({{name}}): +{{/isOAuth }} +{{/authMethods}} +{{/hasAuthMethods}} +{{> api_doc_example }} + +### Parameters +{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} +Name | Type | Description | Notes +------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} +{{#allParams}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{baseType}}.md){{/isPrimitiveType}}{{/isFile}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{.}}]{{/defaultValue}} +{{/allParams}} + +### Return type + +{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}} + +### Authorization + +{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}} + +### HTTP request headers + + - **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} + - **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}} + +{{#responses.0}} +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +{{#responses}} +**{{code}}** | {{message}} | {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}} | +{{/responses}} +{{/responses.0}} + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +{{/operation}} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/api_doc_example.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/api_doc_example.mustache new file mode 100644 index 00000000000..15fbe332696 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/api_doc_example.mustache @@ -0,0 +1,38 @@ +```python +import time +import os +import {{{packageName}}} +{{#vendorExtensions.x-py-example-import}} +{{{.}}} +{{/vendorExtensions.x-py-example-import}} +from {{{packageName}}}.rest import ApiException +from pprint import pprint + +{{> python_doc_auth_partial}} +# Enter a context with an instance of the API client +{{#asyncio}}async {{/asyncio}}with {{{packageName}}}.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = {{{packageName}}}.{{{classname}}}(api_client) + {{#allParams}} + {{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} + {{/allParams}} + + try: + {{#summary}} + # {{{.}}} + {{/summary}} + {{#returnType}}api_response = {{/returnType}}{{#asyncio}}await {{/asyncio}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) + {{#returnType}} + print("The response of {{classname}}->{{operationId}}:\n") + pprint(api_response) + {{/returnType}} + except Exception as e: + print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e) +``` + +{{#vendorExtensions.x-py-postponed-example-imports.size}} +{{#vendorExtensions.x-py-postponed-example-imports}} +{{{.}}} +{{/vendorExtensions.x-py-postponed-example-imports}} +{{classname}}.update_forward_refs() +{{/vendorExtensions.x-py-postponed-example-imports.size}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/api_response.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/api_response.mustache new file mode 100644 index 00000000000..a0b62b95246 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/api_response.mustache @@ -0,0 +1,25 @@ +"""API response object.""" + +from __future__ import annotations +from typing import Any, Dict, Optional +from pydantic import Field, StrictInt, StrictStr + +class ApiResponse: + """ + API response object + """ + + status_code: Optional[StrictInt] = Field(None, description="HTTP status code") + headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") + data: Optional[Any] = Field(None, description="Deserialized data given the data type") + raw_data: Optional[Any] = Field(None, description="Raw data (HTTP response body)") + + def __init__(self, + status_code=None, + headers=None, + data=None, + raw_data=None) -> None: + self.status_code = status_code + self.headers = headers + self.data = data + self.raw_data = raw_data diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/api_test.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/api_test.mustache new file mode 100644 index 00000000000..ad2b8a63fe1 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/api_test.mustache @@ -0,0 +1,33 @@ +# coding: utf-8 + +{{>partial_header}} + +import unittest + +from {{apiPackage}}.{{classFilename}} import {{classname}} # noqa: E501 + + +class {{#operations}}Test{{classname}}(unittest.TestCase): + """{{classname}} unit test stubs""" + + def setUp(self) -> None: + self.api = {{classname}}() # noqa: E501 + + def tearDown(self) -> None: + pass + + {{#operation}} + def test_{{operationId}}(self) -> None: + """Test case for {{{operationId}}} + +{{#summary}} + {{{.}}} # noqa: E501 +{{/summary}} + """ + pass + + {{/operation}} +{{/operations}} + +if __name__ == '__main__': + unittest.main() diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/asyncio/rest.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/asyncio/rest.mustache new file mode 100644 index 00000000000..c97788d0c5c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/asyncio/rest.mustache @@ -0,0 +1,241 @@ +# coding: utf-8 + +{{>partial_header}} + +import io +import json +import logging +import re +import ssl + +import aiohttp +from urllib.parse import urlencode, quote_plus + +from {{packageName}}.exceptions import ApiException, ApiValueError + +logger = logging.getLogger(__name__) + + +class RESTResponse(io.IOBase): + + def __init__(self, resp, data) -> None: + self.aiohttp_response = resp + self.status = resp.status + self.reason = resp.reason + self.data = data + + def getheaders(self): + """Returns a CIMultiDictProxy of the response headers.""" + return self.aiohttp_response.headers + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.aiohttp_response.headers.get(name, default) + + +class RESTClientObject: + + def __init__(self, configuration, pools_size=4, maxsize=None) -> None: + + # maxsize is number of requests to host that are allowed in parallel + if maxsize is None: + maxsize = configuration.connection_pool_maxsize + + ssl_context = ssl.create_default_context(cafile=configuration.ssl_ca_cert) + if configuration.cert_file: + ssl_context.load_cert_chain( + configuration.cert_file, keyfile=configuration.key_file + ) + + if not configuration.verify_ssl: + ssl_context.check_hostname = False + ssl_context.verify_mode = ssl.CERT_NONE + + connector = aiohttp.TCPConnector( + limit=maxsize, + ssl=ssl_context + ) + + self.proxy = configuration.proxy + self.proxy_headers = configuration.proxy_headers + + # https pool manager + self.pool_manager = aiohttp.ClientSession( + connector=connector, + trust_env=True + ) + + async def close(self): + await self.pool_manager.close() + + async def request(self, method, url, query_params=None, headers=None, + body=None, post_params=None, _preload_content=True, + _request_timeout=None): + """Execute request + + :param method: http request method + :param url: http request url + :param query_params: query parameters in the url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :param _preload_content: this is a non-applicable field for + the AiohttpClient. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + """ + method = method.upper() + assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', + 'PATCH', 'OPTIONS'] + + if post_params and body: + raise ApiValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + # url already contains the URL query string + # so reset query_params to empty dict + query_params = {} + timeout = _request_timeout or 5 * 60 + + if 'Content-Type' not in headers: + headers['Content-Type'] = 'application/json' + + args = { + "method": method, + "url": url, + "timeout": timeout, + "headers": headers + } + + if self.proxy: + args["proxy"] = self.proxy + if self.proxy_headers: + args["proxy_headers"] = self.proxy_headers + + if query_params: + args["url"] += '?' + urlencode(query_params) + + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + if re.search('json', headers['Content-Type'], re.IGNORECASE): + if body is not None: + body = json.dumps(body) + args["data"] = body + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + args["data"] = aiohttp.FormData(post_params) + elif headers['Content-Type'] == 'multipart/form-data': + # must del headers['Content-Type'], or the correct + # Content-Type which generated by aiohttp + del headers['Content-Type'] + data = aiohttp.FormData() + for param in post_params: + k, v = param + if isinstance(v, tuple) and len(v) == 3: + data.add_field(k, + value=v[1], + filename=v[0], + content_type=v[2]) + else: + data.add_field(k, v) + args["data"] = data + + # Pass a `bytes` parameter directly in the body to support + # other content types than Json when `body` argument is provided + # in serialized form + elif isinstance(body, bytes): + args["data"] = body + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + + r = await self.pool_manager.request(**args) + if _preload_content: + + data = await r.read() + r = RESTResponse(r, data) + + # log response body + logger.debug("response body: %s", r.data) + + if not 200 <= r.status <= 299: + raise ApiException(http_resp=r) + + return r + + async def get_request(self, url, headers=None, query_params=None, + _preload_content=True, _request_timeout=None): + return (await self.request("GET", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params)) + + async def head_request(self, url, headers=None, query_params=None, + _preload_content=True, _request_timeout=None): + return (await self.request("HEAD", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params)) + + async def options_request(self, url, headers=None, query_params=None, + post_params=None, body=None, _preload_content=True, + _request_timeout=None): + return (await self.request("OPTIONS", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body)) + + async def delete_request(self, url, headers=None, query_params=None, body=None, + _preload_content=True, _request_timeout=None): + return (await self.request("DELETE", url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body)) + + async def post_request(self, url, headers=None, query_params=None, + post_params=None, body=None, _preload_content=True, + _request_timeout=None): + return (await self.request("POST", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body)) + + async def put_request(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return (await self.request("PUT", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body)) + + async def patch_request(self, url, headers=None, query_params=None, + post_params=None, body=None, _preload_content=True, + _request_timeout=None): + return (await self.request("PATCH", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body)) diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/common_README.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/common_README.mustache new file mode 100644 index 00000000000..706d9b344b8 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/common_README.mustache @@ -0,0 +1,85 @@ +```python +{{#apiInfo}}{{#apis}}{{#-last}}{{#hasHttpSignatureMethods}}import datetime{{/hasHttpSignatureMethods}}{{/-last}}{{/apis}}{{/apiInfo}} +import time +import {{{packageName}}} +from {{{packageName}}}.rest import ApiException +from pprint import pprint +{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} +{{> python_doc_auth_partial}} + +# Enter a context with an instance of the API client +{{#asyncio}}async {{/asyncio}}with {{{packageName}}}.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = {{{packageName}}}.{{{classname}}}(api_client) + {{#allParams}} + {{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} + {{/allParams}} + + try: + {{#summary}} + # {{{.}}} + {{/summary}} + {{#returnType}}api_response = {{/returnType}}{{#asyncio}}await {{/asyncio}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) + {{#returnType}} + print("The response of {{classname}}->{{operationId}}:\n") + pprint(api_response) + {{/returnType}} + except ApiException as e: + print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e) +{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} +``` + +## Documentation for API Endpoints + +All URIs are relative to *{{{basePath}}}* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}} +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} + +## Documentation For Models + +{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) +{{/model}}{{/models}} + + +## Documentation For Authorization + +{{^authMethods}}Endpoints do not require authorization.{{/authMethods}} +{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}} +{{#authMethods}} + +### {{{name}}} + +{{#isApiKey}} +- **Type**: API key +- **API key parameter name**: {{{keyParamName}}} +- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} +{{/isApiKey}} +{{#isBasic}} +{{#isBasicBasic}} +- **Type**: HTTP basic authentication +{{/isBasicBasic}} +{{#isBasicBearer}} +- **Type**: Bearer authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} +{{/isBasicBearer}} +{{#isHttpSignature}} +- **Type**: HTTP signature authentication +{{/isHttpSignature}} +{{/isBasic}} +{{#isOAuth}} +- **Type**: OAuth +- **Flow**: {{{flow}}} +- **Authorization URL**: {{{authorizationUrl}}} +- **Scopes**: {{^scopes}}N/A{{/scopes}} +{{#scopes}} - **{{{scope}}}**: {{{description}}} +{{/scopes}} +{{/isOAuth}} + +{{/authMethods}} + +## Author + +{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} +{{/-last}}{{/apis}}{{/apiInfo}} diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/configuration.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/configuration.mustache new file mode 100644 index 00000000000..c3799c0c5e0 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/configuration.mustache @@ -0,0 +1,615 @@ +# coding: utf-8 + +{{>partial_header}} + +import copy +import logging +{{^asyncio}} +import multiprocessing +{{/asyncio}} +import sys +import urllib3 + +import http.client as httplib + +JSON_SCHEMA_VALIDATION_KEYWORDS = { + 'multipleOf', 'maximum', 'exclusiveMaximum', + 'minimum', 'exclusiveMinimum', 'maxLength', + 'minLength', 'pattern', 'maxItems', 'minItems' +} + +class Configuration: + """This class contains various settings of the API client. + + :param host: Base url. + :param api_key: Dict to store API key(s). + Each entry in the dict specifies an API key. + The dict key is the name of the security scheme in the OAS specification. + The dict value is the API key secret. + :param api_key_prefix: Dict to store API prefix (e.g. Bearer). + The dict key is the name of the security scheme in the OAS specification. + The dict value is an API key prefix when generating the auth data. + :param username: Username for HTTP basic authentication. + :param password: Password for HTTP basic authentication. + :param access_token: Access token. +{{#hasHttpSignatureMethods}} + :param signing_info: Configuration parameters for the HTTP signature security scheme. + Must be an instance of {{{packageName}}}.signing.HttpSigningConfiguration +{{/hasHttpSignatureMethods}} + :param server_index: Index to servers configuration. + :param server_variables: Mapping with string values to replace variables in + templated server configuration. The validation of enums is performed for + variables with defined enum values before. + :param server_operation_index: Mapping from operation ID to an index to server + configuration. + :param server_operation_variables: Mapping from operation ID to a mapping with + string values to replace variables in templated server configuration. + The validation of enums is performed for variables with defined enum + values before. + :param ssl_ca_cert: str - the path to a file of concatenated CA certificates + in PEM format. + +{{#hasAuthMethods}} + :Example: +{{#hasApiKeyMethods}} + + API Key Authentication Example. + Given the following security scheme in the OpenAPI specification: + components: + securitySchemes: + cookieAuth: # name for the security scheme + type: apiKey + in: cookie + name: JSESSIONID # cookie name + + You can programmatically set the cookie: + +conf = {{{packageName}}}.Configuration( + api_key={'cookieAuth': 'abc123'} + api_key_prefix={'cookieAuth': 'JSESSIONID'} +) + + The following cookie will be added to the HTTP request: + Cookie: JSESSIONID abc123 +{{/hasApiKeyMethods}} +{{#hasHttpBasicMethods}} + + HTTP Basic Authentication Example. + Given the following security scheme in the OpenAPI specification: + components: + securitySchemes: + http_basic_auth: + type: http + scheme: basic + + Configure API client with HTTP basic authentication: + +conf = {{{packageName}}}.Configuration( + username='the-user', + password='the-password', +) + +{{/hasHttpBasicMethods}} +{{#hasHttpSignatureMethods}} + + HTTP Signature Authentication Example. + Given the following security scheme in the OpenAPI specification: + components: + securitySchemes: + http_basic_auth: + type: http + scheme: signature + + Configure API client with HTTP signature authentication. Use the 'hs2019' signature scheme, + sign the HTTP requests with the RSA-SSA-PSS signature algorithm, and set the expiration time + of the signature to 5 minutes after the signature has been created. + Note you can use the constants defined in the {{{packageName}}}.signing module, and you can + also specify arbitrary HTTP headers to be included in the HTTP signature, except for the + 'Authorization' header, which is used to carry the signature. + + One may be tempted to sign all headers by default, but in practice it rarely works. + This is because explicit proxies, transparent proxies, TLS termination endpoints or + load balancers may add/modify/remove headers. Include the HTTP headers that you know + are not going to be modified in transit. + +conf = {{{packageName}}}.Configuration( + signing_info = {{{packageName}}}.signing.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'rsa.pem', + signing_scheme = {{{packageName}}}.signing.SCHEME_HS2019, + signing_algorithm = {{{packageName}}}.signing.ALGORITHM_RSASSA_PSS, + signed_headers = [{{{packageName}}}.signing.HEADER_REQUEST_TARGET, + {{{packageName}}}.signing.HEADER_CREATED, + {{{packageName}}}.signing.HEADER_EXPIRES, + {{{packageName}}}.signing.HEADER_HOST, + {{{packageName}}}.signing.HEADER_DATE, + {{{packageName}}}.signing.HEADER_DIGEST, + 'Content-Type', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) +{{/hasHttpSignatureMethods}} +{{/hasAuthMethods}} + """ + + _default = None + + def __init__(self, host=None, + api_key=None, api_key_prefix=None, + username=None, password=None, + access_token=None, +{{#hasHttpSignatureMethods}} + signing_info=None, +{{/hasHttpSignatureMethods}} + server_index=None, server_variables=None, + server_operation_index=None, server_operation_variables=None, + ssl_ca_cert=None, + ) -> None: + """Constructor + """ + self._base_path = "{{{basePath}}}" if host is None else host + """Default Base url + """ + self.server_index = 0 if server_index is None and host is None else server_index + self.server_operation_index = server_operation_index or {} + """Default server index + """ + self.server_variables = server_variables or {} + self.server_operation_variables = server_operation_variables or {} + """Default server variables + """ + self.temp_folder_path = None + """Temp file folder for downloading files + """ + # Authentication Settings + self.api_key = {} + if api_key: + self.api_key = api_key + """dict to store API key(s) + """ + self.api_key_prefix = {} + if api_key_prefix: + self.api_key_prefix = api_key_prefix + """dict to store API prefix (e.g. Bearer) + """ + self.refresh_api_key_hook = None + """function hook to refresh API key if expired + """ + self.username = username + """Username for HTTP basic authentication + """ + self.password = password + """Password for HTTP basic authentication + """ + self.access_token = access_token + """Access token + """ +{{#hasHttpSignatureMethods}} + if signing_info is not None: + signing_info.host = host + self.signing_info = signing_info + """The HTTP signing configuration + """ +{{/hasHttpSignatureMethods}} + self.logger = {} + """Logging Settings + """ + self.logger["package_logger"] = logging.getLogger("{{packageName}}") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + """Log format + """ + self.logger_stream_handler = None + """Log stream handler + """ + self.logger_file_handler = None + """Log file handler + """ + self.logger_file = None + """Debug file location + """ + self.debug = False + """Debug switch + """ + + self.verify_ssl = True + """SSL/TLS verification + Set this to false to skip verifying SSL certificate when calling API + from https server. + """ + self.ssl_ca_cert = ssl_ca_cert + """Set this to customize the certificate file to verify the peer. + """ + self.cert_file = None + """client certificate file + """ + self.key_file = None + """client key file + """ + self.assert_hostname = None + """Set this to True/False to enable/disable SSL hostname verification. + """ + self.tls_server_name = None + """SSL/TLS Server Name Indication (SNI) + Set this to the SNI value expected by the server. + """ + + {{#asyncio}} + self.connection_pool_maxsize = 100 + """This value is passed to the aiohttp to limit simultaneous connections. + Default values is 100, None means no-limit. + """ + {{/asyncio}} + {{^asyncio}} + self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 + """urllib3 connection pool's maximum number of connections saved + per pool. urllib3 uses 1 connection as default value, but this is + not the best value when you are making a lot of possibly parallel + requests to the same host, which is often the case here. + cpu_count * 5 is used as default value to increase performance. + """ + {{/asyncio}} + + self.proxy = None + """Proxy URL + """ + self.proxy_headers = None + """Proxy headers + """ + self.safe_chars_for_path_param = '' + """Safe chars for path_param + """ + self.retries = None + """Adding retries to override urllib3 default value 3 + """ + # Enable client side validation + self.client_side_validation = True + + self.socket_options = None + """Options to pass down to the underlying urllib3 socket + """ + + self.datetime_format = "{{{datetimeFormat}}}" + """datetime format + """ + + self.date_format = "{{{dateFormat}}}" + """date format + """ + + def __deepcopy__(self, memo): + cls = self.__class__ + result = cls.__new__(cls) + memo[id(self)] = result + for k, v in self.__dict__.items(): + if k not in ('logger', 'logger_file_handler'): + setattr(result, k, copy.deepcopy(v, memo)) + # shallow copy of loggers + result.logger = copy.copy(self.logger) + # use setters to configure loggers + result.logger_file = self.logger_file + result.debug = self.debug + return result + + def __setattr__(self, name, value): + object.__setattr__(self, name, value) +{{#hasHttpSignatureMethods}} + if name == "signing_info" and value is not None: + # Ensure the host parameter from signing info is the same as + # Configuration.host. + value.host = self.host +{{/hasHttpSignatureMethods}} + + @classmethod + def set_default(cls, default): + """Set default instance of configuration. + + It stores default configuration, which can be + returned by get_default_copy method. + + :param default: object of Configuration + """ + cls._default = default + + @classmethod + def get_default_copy(cls): + """Deprecated. Please use `get_default` instead. + + Deprecated. Please use `get_default` instead. + + :return: The configuration object. + """ + return cls.get_default() + + @classmethod + def get_default(cls): + """Return the default configuration. + + This method returns newly created, based on default constructor, + object of Configuration class or returns a copy of default + configuration. + + :return: The configuration object. + """ + if cls._default is None: + cls._default = Configuration() + return cls._default + + @property + def logger_file(self): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in self.logger.items(): + logger.addHandler(self.logger_file_handler) + + @property + def debug(self): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in self.logger.items(): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in self.logger.items(): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier, alias=None): + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :param alias: The alternative identifier of apiKey. + :return: The token for api key authentication. + """ + if self.refresh_api_key_hook is not None: + self.refresh_api_key_hook(self) + key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) + if key: + prefix = self.api_key_prefix.get(identifier) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + def get_basic_auth_token(self): + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + username = "" + if self.username is not None: + username = self.username + password = "" + if self.password is not None: + password = self.password + return urllib3.util.make_headers( + basic_auth=username + ':' + password + ).get('authorization') + + def auth_settings(self): + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + auth = {} +{{#authMethods}} +{{#isApiKey}} + if '{{name}}' in self.api_key{{#vendorExtensions.x-auth-id-alias}} or '{{.}}' in self.api_key{{/vendorExtensions.x-auth-id-alias}}: + auth['{{name}}'] = { + 'type': 'api_key', + 'in': {{#isKeyInCookie}}'cookie'{{/isKeyInCookie}}{{#isKeyInHeader}}'header'{{/isKeyInHeader}}{{#isKeyInQuery}}'query'{{/isKeyInQuery}}, + 'key': '{{keyParamName}}', + 'value': self.get_api_key_with_prefix( + '{{name}}',{{#vendorExtensions.x-auth-id-alias}} + alias='{{.}}',{{/vendorExtensions.x-auth-id-alias}} + ), + } +{{/isApiKey}} +{{#isBasic}} + {{#isBasicBasic}} + if self.username is not None and self.password is not None: + auth['{{name}}'] = { + 'type': 'basic', + 'in': 'header', + 'key': 'Authorization', + 'value': self.get_basic_auth_token() + } + {{/isBasicBasic}} + {{#isBasicBearer}} + if self.access_token is not None: + auth['{{name}}'] = { + 'type': 'bearer', + 'in': 'header', + {{#bearerFormat}} + 'format': '{{{.}}}', + {{/bearerFormat}} + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } + {{/isBasicBearer}} + {{#isHttpSignature}} + if self.signing_info is not None: + auth['{{name}}'] = { + 'type': 'http-signature', + 'in': 'header', + 'key': 'Authorization', + 'value': None # Signature headers are calculated for every HTTP request + } + {{/isHttpSignature}} +{{/isBasic}} +{{#isOAuth}} + if self.access_token is not None: + auth['{{name}}'] = { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } +{{/isOAuth}} +{{/authMethods}} + return auth + + def to_debug_report(self): + """Gets the essential information for debugging. + + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: {{version}}\n"\ + "SDK Package Version: {{packageVersion}}".\ + format(env=sys.platform, pyversion=sys.version) + + def get_host_settings(self): + """Gets an array of host settings + + :return: An array of host settings + """ + return [ + {{#servers}} + { + 'url': "{{{url}}}", + 'description': "{{{description}}}{{^description}}No description provided{{/description}}", + {{#variables}} + {{#-first}} + 'variables': { + {{/-first}} + '{{{name}}}': { + 'description': "{{{description}}}{{^description}}No description provided{{/description}}", + 'default_value': "{{{defaultValue}}}", + {{#enumValues}} + {{#-first}} + 'enum_values': [ + {{/-first}} + "{{{.}}}"{{^-last}},{{/-last}} + {{#-last}} + ] + {{/-last}} + {{/enumValues}} + }{{^-last}},{{/-last}} + {{#-last}} + } + {{/-last}} + {{/variables}} + }{{^-last}},{{/-last}} + {{/servers}} + ] + + def get_host_from_settings(self, index, variables=None, servers=None): + """Gets host URL based on the index and variables + :param index: array index of the host settings + :param variables: hash of variable and the corresponding value + :param servers: an array of host settings or None + :return: URL based on host settings + """ + if index is None: + return self._base_path + + variables = {} if variables is None else variables + servers = self.get_host_settings() if servers is None else servers + + try: + server = servers[index] + except IndexError: + raise ValueError( + "Invalid index {0} when selecting the host settings. " + "Must be less than {1}".format(index, len(servers))) + + url = server['url'] + + # go through variables and replace placeholders + for variable_name, variable in server.get('variables', {}).items(): + used_value = variables.get( + variable_name, variable['default_value']) + + if 'enum_values' in variable \ + and used_value not in variable['enum_values']: + raise ValueError( + "The variable `{0}` in the host URL has invalid value " + "{1}. Must be {2}.".format( + variable_name, variables[variable_name], + variable['enum_values'])) + + url = url.replace("{" + variable_name + "}", used_value) + + return url + + @property + def host(self): + """Return generated host.""" + return self.get_host_from_settings(self.server_index, variables=self.server_variables) + + @host.setter + def host(self, value): + """Fix base path.""" + self._base_path = value + self.server_index = None diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/exceptions.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/exceptions.mustache new file mode 100644 index 00000000000..8a155a9fe08 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/exceptions.mustache @@ -0,0 +1,156 @@ +# coding: utf-8 + +{{>partial_header}} + +class OpenApiException(Exception): + """The base exception class for all OpenAPIExceptions""" + + +class ApiTypeError(OpenApiException, TypeError): + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None) -> None: + """ Raises an exception for TypeErrors + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list): a list of keys an indices to get to the + current_item + None if unset + valid_classes (tuple): the primitive classes that current item + should be an instance of + None if unset + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + None if unset + """ + self.path_to_item = path_to_item + self.valid_classes = valid_classes + self.key_type = key_type + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiTypeError, self).__init__(full_msg) + + +class ApiValueError(OpenApiException, ValueError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list) the path to the exception in the + received_data dict. None if unset + """ + + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiValueError, self).__init__(full_msg) + + +class ApiAttributeError(OpenApiException, AttributeError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Raised when an attribute reference or assignment fails. + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiAttributeError, self).__init__(full_msg) + + +class ApiKeyError(OpenApiException, KeyError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiKeyError, self).__init__(full_msg) + + +class ApiException(OpenApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + if http_resp: + self.status = http_resp.status + self.reason = http_resp.reason + self.body = http_resp.data + self.headers = http_resp.getheaders() + else: + self.status = status + self.reason = reason + self.body = None + self.headers = None + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + return error_message + +class BadRequestException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + super(BadRequestException, self).__init__(status, reason, http_resp) + +class NotFoundException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + super(NotFoundException, self).__init__(status, reason, http_resp) + + +class UnauthorizedException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + super(UnauthorizedException, self).__init__(status, reason, http_resp) + + +class ForbiddenException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + super(ForbiddenException, self).__init__(status, reason, http_resp) + + +class ServiceException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + super(ServiceException, self).__init__(status, reason, http_resp) + + +def render_path(path_to_item): + """Returns a string representation of a path""" + result = "" + for pth in path_to_item: + if isinstance(pth, int): + result += "[{0}]".format(pth) + else: + result += "['{0}']".format(pth) + return result diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/git_push.sh.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/git_push.sh.mustache new file mode 100755 index 00000000000..0e3776ae6dd --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/git_push.sh.mustache @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="{{{gitHost}}}" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="{{{gitUserId}}}" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="{{{gitRepoId}}}" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="{{{releaseNote}}}" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/github-workflow.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/github-workflow.mustache new file mode 100644 index 00000000000..868124c0bc5 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/github-workflow.mustache @@ -0,0 +1,39 @@ +# NOTE: This file is auto generated by OpenAPI Generator. +# URL: https://openapi-generator.tech +# +# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: {{packageName}} Python package +{{=<% %>=}} + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/gitignore.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/gitignore.mustache new file mode 100644 index 00000000000..43995bd42fa --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/gitignore.mustache @@ -0,0 +1,66 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ +venv/ +.venv/ +.python-version +.pytest_cache + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +#Ipython Notebook +.ipynb_checkpoints diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/gitlab-ci.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/gitlab-ci.mustache new file mode 100644 index 00000000000..8a6130a2f7b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/gitlab-ci.mustache @@ -0,0 +1,31 @@ +# NOTE: This file is auto generated by OpenAPI Generator. +# URL: https://openapi-generator.tech +# +# ref: https://docs.gitlab.com/ee/ci/README.html +# ref: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml + +stages: + - test + +.pytest: + stage: test + script: + - pip install -r requirements.txt + - pip install -r test-requirements.txt + - pytest --cov={{{packageName}}} + +pytest-3.7: + extends: .pytest + image: python:3.7-alpine +pytest-3.8: + extends: .pytest + image: python:3.8-alpine +pytest-3.9: + extends: .pytest + image: python:3.9-alpine +pytest-3.10: + extends: .pytest + image: python:3.10-alpine +pytest-3.11: + extends: .pytest + image: python:3.11-alpine diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/model.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/model.mustache new file mode 100644 index 00000000000..84792dde195 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/model.mustache @@ -0,0 +1,14 @@ +# coding: utf-8 + +{{>partial_header}} + +{{#models}} +{{#model}} +{{#isEnum}} +{{>model_enum}} +{{/isEnum}} +{{^isEnum}} +{{#oneOf}}{{#-first}}{{>model_oneof}}{{/-first}}{{/oneOf}}{{^oneOf}}{{#anyOf}}{{#-first}}{{>model_anyof}}{{/-first}}{{/anyOf}}{{^anyOf}}{{>model_generic}}{{/anyOf}}{{/oneOf}} +{{/isEnum}} +{{/model}} +{{/models}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/model_anyof.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/model_anyof.mustache new file mode 100644 index 00000000000..adec7c41868 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/model_anyof.mustache @@ -0,0 +1,180 @@ +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +{{#vendorExtensions.x-py-datetime-imports}}{{#-first}}from datetime import{{/-first}} {{{.}}}{{^-last}},{{/-last}}{{/vendorExtensions.x-py-datetime-imports}} +{{#vendorExtensions.x-py-typing-imports}}{{#-first}}from typing import{{/-first}} {{{.}}}{{^-last}},{{/-last}}{{/vendorExtensions.x-py-typing-imports}} +{{#vendorExtensions.x-py-pydantic-imports}}{{#-first}}from pydantic import{{/-first}} {{{.}}}{{^-last}},{{/-last}}{{/vendorExtensions.x-py-pydantic-imports}} +{{#vendorExtensions.x-py-model-imports}} +{{{.}}} +{{/vendorExtensions.x-py-model-imports}} +from typing import Union, Any, List, TYPE_CHECKING +from pydantic import StrictStr, Field + +{{#lambda.uppercase}}{{{classname}}}{{/lambda.uppercase}}_ANY_OF_SCHEMAS = [{{#anyOf}}"{{.}}"{{^-last}}, {{/-last}}{{/anyOf}}] + +class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}): + """ + {{{description}}}{{^description}}{{{classname}}}{{/description}} + """ + +{{#composedSchemas.anyOf}} + # data type: {{{dataType}}} + {{vendorExtensions.x-py-name}}: {{{vendorExtensions.x-py-typing}}} +{{/composedSchemas.anyOf}} + if TYPE_CHECKING: + actual_instance: Union[{{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}] + else: + actual_instance: Any + any_of_schemas: List[str] = Field({{#lambda.uppercase}}{{{classname}}}{{/lambda.uppercase}}_ANY_OF_SCHEMAS, const=True) + + class Config: + validate_assignment = True +{{#discriminator}} + + discriminator_value_class_map = { +{{#children}} + '{{^vendorExtensions.x-discriminator-value}}{{name}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}': '{{{classname}}}'{{^-last}},{{/-last}} +{{/children}} + } +{{/discriminator}} + + 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_anyof(cls, v): + {{#isNullable}} + if v is None: + return v + + {{/isNullable}} + instance = {{{classname}}}.construct() + error_messages = [] + {{#composedSchemas.anyOf}} + # validate data type: {{{dataType}}} + {{#isContainer}} + try: + instance.{{vendorExtensions.x-py-name}} = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + {{/isContainer}} + {{^isContainer}} + {{#isPrimitiveType}} + try: + instance.{{vendorExtensions.x-py-name}} = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + {{/isPrimitiveType}} + {{^isPrimitiveType}} + if not isinstance(v, {{{dataType}}}): + error_messages.append(f"Error! Input type `{type(v)}` is not `{{{dataType}}}`") + else: + return v + + {{/isPrimitiveType}} + {{/isContainer}} + {{/composedSchemas.anyOf}} + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in {{{classname}}} with anyOf schemas: {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: dict) -> {{{classname}}}: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> {{{classname}}}: + """Returns the object represented by the json string""" + instance = {{{classname}}}.construct() + {{#isNullable}} + if json_str is None: + return instance + + {{/isNullable}} + error_messages = [] + {{#composedSchemas.anyOf}} + {{#isContainer}} + # deserialize data into {{{dataType}}} + try: + # validation + instance.{{vendorExtensions.x-py-name}} = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.{{vendorExtensions.x-py-name}} + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + {{/isContainer}} + {{^isContainer}} + {{#isPrimitiveType}} + # deserialize data into {{{dataType}}} + try: + # validation + instance.{{vendorExtensions.x-py-name}} = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.{{vendorExtensions.x-py-name}} + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + {{/isPrimitiveType}} + {{^isPrimitiveType}} + # {{vendorExtensions.x-py-name}}: {{{vendorExtensions.x-py-typing}}} + try: + instance.actual_instance = {{{dataType}}}.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + {{/isPrimitiveType}} + {{/isContainer}} + {{/composedSchemas.anyOf}} + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into {{{classname}}} with anyOf schemas: {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}. 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 "null" + + to_json = getattr(self.actual_instance, "to_json", None) + if callable(to_json): + return self.actual_instance.to_dict() + else: + return json.dumps(self.actual_instance) + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.dict()) + +{{#vendorExtensions.x-py-postponed-model-imports.size}} +{{#vendorExtensions.x-py-postponed-model-imports}} +{{{.}}} +{{/vendorExtensions.x-py-postponed-model-imports}} +{{classname}}.update_forward_refs() +{{/vendorExtensions.x-py-postponed-model-imports.size}} diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/model_doc.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/model_doc.mustache new file mode 100644 index 00000000000..dd54470b3be --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/model_doc.mustache @@ -0,0 +1,33 @@ +{{#models}}{{#model}}# {{classname}} + +{{#description}}{{&description}} +{{/description}} + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} +{{/vars}} + +{{^isEnum}} +## Example + +```python +from {{modelPackage}}.{{#lambda.snakecase}}{{classname}}{{/lambda.snakecase}} import {{classname}} + +# TODO update the JSON string below +json = "{}" +# create an instance of {{classname}} from a JSON string +{{#lambda.snakecase}}{{classname}}{{/lambda.snakecase}}_instance = {{classname}}.from_json(json) +# print the JSON string representation of the object +print {{classname}}.to_json() + +# convert the object into a dict +{{#lambda.snakecase}}{{classname}}{{/lambda.snakecase}}_dict = {{#lambda.snakecase}}{{classname}}{{/lambda.snakecase}}_instance.to_dict() +# create an instance of {{classname}} from a dict +{{#lambda.snakecase}}{{classname}}{{/lambda.snakecase}}_form_dict = {{#lambda.snakecase}}{{classname}}{{/lambda.snakecase}}.from_dict({{#lambda.snakecase}}{{classname}}{{/lambda.snakecase}}_dict) +``` +{{/isEnum}} +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +{{/model}}{{/models}} diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/model_enum.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/model_enum.mustache new file mode 100644 index 00000000000..83f0552c781 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/model_enum.mustache @@ -0,0 +1,36 @@ +import json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg +{{#vendorExtensions.x-py-datetime-imports}}{{#-first}}from datetime import{{/-first}} {{{.}}}{{^-last}},{{/-last}}{{/vendorExtensions.x-py-datetime-imports}} +{{#vendorExtensions.x-py-typing-imports}}{{#-first}}from typing import{{/-first}} {{{.}}}{{^-last}},{{/-last}}{{/vendorExtensions.x-py-typing-imports}} +{{#vendorExtensions.x-py-pydantic-imports}}{{#-first}}from pydantic import{{/-first}} {{{.}}}{{^-last}},{{/-last}}{{/vendorExtensions.x-py-pydantic-imports}} + + +class {{classname}}({{vendorExtensions.x-py-enum-type}}, Enum): + """ + {{{description}}}{{^description}}{{{classname}}}{{/description}} + """ + + """ + allowed enum values + """ +{{#allowableValues}} + {{#enumVars}} + {{{name}}} = {{{value}}} + {{/enumVars}} + + @classmethod + def from_json(cls, json_str: str) -> {{{classname}}}: + """Create an instance of {{classname}} from a JSON string""" + return {{classname}}(json.loads(json_str)) + + {{#defaultValue}} + + # + @classmethod + def _missing_value_(cls, value): + if value is no_arg: + return cls.{{{.}}} + {{/defaultValue}} +{{/allowableValues}} diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/model_generic.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/model_generic.mustache new file mode 100644 index 00000000000..6a09b9c9bd1 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/model_generic.mustache @@ -0,0 +1,361 @@ +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +{{#vendorExtensions.x-py-datetime-imports}}{{#-first}}from datetime import{{/-first}} {{{.}}}{{^-last}},{{/-last}}{{/vendorExtensions.x-py-datetime-imports}} +{{#vendorExtensions.x-py-typing-imports}}{{#-first}}from typing import{{/-first}} {{{.}}}{{^-last}},{{/-last}}{{/vendorExtensions.x-py-typing-imports}} +{{#vendorExtensions.x-py-pydantic-imports}}{{#-first}}from pydantic import{{/-first}} {{{.}}}{{^-last}},{{/-last}}{{/vendorExtensions.x-py-pydantic-imports}} +{{#vendorExtensions.x-py-model-imports}} +{{{.}}} +{{/vendorExtensions.x-py-model-imports}} + +class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}): + """ + {{#description}}{{{description}}} # noqa: E501{{/description}}{{^description}}{{{classname}}}{{/description}} + """ +{{#vars}} + {{name}}: {{{vendorExtensions.x-py-typing}}} +{{/vars}} +{{#isAdditionalPropertiesTrue}} + additional_properties: Dict[str, Any] = {} +{{/isAdditionalPropertiesTrue}} + __properties = [{{#allVars}}"{{baseName}}"{{^-last}}, {{/-last}}{{/allVars}}] +{{#vars}} + {{#vendorExtensions.x-regex}} + + @validator('{{{name}}}') + def {{{name}}}_validate_regular_expression(cls, value): + """Validates the regular expression""" + {{^required}} + if value is None: + return value + + {{/required}} + {{#required}} + {{#isNullable}} + if value is None: + return value + + {{/isNullable}} + {{/required}} + if not re.match(r"{{{.}}}", value{{#vendorExtensions.x-modifiers}} ,re.{{{.}}}{{/vendorExtensions.x-modifiers}}): + raise ValueError(r"must validate the regular expression {{{vendorExtensions.x-pattern}}}") + return value + {{/vendorExtensions.x-regex}} + {{#isEnum}} + + @validator('{{{name}}}') + def {{{name}}}_validate_enum(cls, value): + """Validates the enum""" + {{^required}} + if value is None: + return value + + {{/required}} + {{#required}} + {{#isNullable}} + if value is None: + return value + + {{/isNullable}} + {{/required}} + {{#isArray}} + for i in value: + if i not in ({{#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}} + if value not in ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}): + raise ValueError("must be one of enum values ({{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}})") + {{/isArray}} + return value + {{/isEnum}} +{{/vars}} + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + +{{#hasChildren}} +{{#discriminator}} + # JSON field name that stores the object type + __discriminator_property_name = '{{discriminator.propertyBaseName}}' + + {{#mappedModels}} + {{#-first}} + # discriminator mappings + __discriminator_value_class_map = { + {{/-first}} + '{{{mappingName}}}': '{{{modelName}}}'{{^-last}},{{/-last}} + {{#-last}} + } + + @classmethod + def get_discriminator_value(cls, obj: dict) -> str: + """Returns the discriminator value (object type) of the data""" + discriminator_value = obj[cls.__discriminator_property_name] + if discriminator_value: + return cls.__discriminator_value_class_map.get(discriminator_value) + else: + return None + {{/-last}} + {{/mappedModels}} + +{{/discriminator}} +{{/hasChildren}} + 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) -> {{^hasChildren}}{{{classname}}}{{/hasChildren}}{{#hasChildren}}{{#discriminator}}Union({{#children}}{{{classname}}}{{^-last}}, {{/-last}}{{/children}}){{/discriminator}}{{^discriminator}}{{{classname}}}{{/discriminator}}{{/hasChildren}}: + """Create an instance of {{{classname}}} 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={ + {{#vendorExtensions.x-py-readonly}} + "{{{.}}}", + {{/vendorExtensions.x-py-readonly}} + {{#isAdditionalPropertiesTrue}} + "additional_properties" + {{/isAdditionalPropertiesTrue}} + }, + exclude_none=True) + {{#allVars}} + {{#isContainer}} + {{#isArray}} + {{#items.isArray}} + {{^items.items.isPrimitiveType}} + # override the default output from pydantic by calling `to_dict()` of each item in {{{name}}} (list of list) + _items = [] + if self.{{{name}}}: + for _item in self.{{{name}}}: + if _item: + _items.append( + [_inner_item.to_dict() for _inner_item in _item if _inner_item is not None] + ) + _dict['{{{baseName}}}'] = _items + {{/items.items.isPrimitiveType}} + {{/items.isArray}} + {{^items.isArray}} + {{^items.isPrimitiveType}} + {{^items.isEnumOrRef}} + # override the default output from pydantic by calling `to_dict()` of each item in {{{name}}} (list) + _items = [] + if self.{{{name}}}: + for _item in self.{{{name}}}: + if _item: + _items.append(_item.to_dict()) + _dict['{{{baseName}}}'] = _items + {{/items.isEnumOrRef}} + {{/items.isPrimitiveType}} + {{/items.isArray}} + {{/isArray}} + {{#isMap}} + {{#items.isArray}} + # override the default output from pydantic by calling `to_dict()` of each value in {{{name}}} (dict of array) + _field_dict_of_array = {} + if self.{{{name}}}: + for _key in self.{{{name}}}: + if self.{{{name}}}[_key]: + _field_dict_of_array[_key] = [ + _item.to_dict() for _item in self.{{{name}}}[_key] + ] + _dict['{{{baseName}}}'] = _field_dict_of_array + {{/items.isArray}} + {{^items.isArray}} + {{^items.isPrimitiveType}} + {{^items.isEnumOrRef}} + # override the default output from pydantic by calling `to_dict()` of each value in {{{name}}} (dict) + _field_dict = {} + if self.{{{name}}}: + for _key in self.{{{name}}}: + if self.{{{name}}}[_key]: + _field_dict[_key] = self.{{{name}}}[_key].to_dict() + _dict['{{{baseName}}}'] = _field_dict + {{/items.isEnumOrRef}} + {{/items.isPrimitiveType}} + {{/items.isArray}} + {{/isMap}} + {{/isContainer}} + {{^isContainer}} + {{^isPrimitiveType}} + {{^isEnumOrRef}} + # override the default output from pydantic by calling `to_dict()` of {{{name}}} + if self.{{{name}}}: + _dict['{{{baseName}}}'] = self.{{{name}}}.to_dict() + {{/isEnumOrRef}} + {{/isPrimitiveType}} + {{/isContainer}} + {{/allVars}} + {{#isAdditionalPropertiesTrue}} + # 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 + + {{/isAdditionalPropertiesTrue}} + {{#allVars}} + {{#isNullable}} + # set to None if {{{name}}} (nullable) is None + # and __fields_set__ contains the field + if self.{{name}} is None and "{{{name}}}" in self.__fields_set__: + _dict['{{{baseName}}}'] = None + + {{/isNullable}} + {{/allVars}} + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> {{^hasChildren}}{{{classname}}}{{/hasChildren}}{{#hasChildren}}{{#discriminator}}Union({{#children}}{{{classname}}}{{^-last}}, {{/-last}}{{/children}}){{/discriminator}}{{^discriminator}}{{{classname}}}{{/discriminator}}{{/hasChildren}}: + """Create an instance of {{{classname}}} from a dict""" + {{#hasChildren}} + {{#discriminator}} + # look up the object type based on discriminator mapping + object_type = cls.get_discriminator_value(obj) + if object_type: + klass = globals()[object_type] + return klass.from_dict(obj) + else: + raise ValueError("{{{classname}}} failed to lookup discriminator value from " + + json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name + + ", mapping: " + json.dumps(cls.__discriminator_value_class_map)) + {{/discriminator}} + {{/hasChildren}} + {{^hasChildren}} + if obj is None: + return None + + if not isinstance(obj, dict): + return {{{classname}}}.parse_obj(obj) + + {{#disallowAdditionalPropertiesIfNotPresent}} + {{^isAdditionalPropertiesTrue}} + # raise errors for additional fields in the input + for _key in obj.keys(): + if _key not in cls.__properties: + raise ValueError("Error due to additional fields (not defined in {{classname}}) in the input: " + obj) + + {{/isAdditionalPropertiesTrue}} + {{/disallowAdditionalPropertiesIfNotPresent}} + _obj = {{{classname}}}.parse_obj({ + {{#allVars}} + {{#isContainer}} + {{#isArray}} + {{#items.isArray}} + {{#items.items.isPrimitiveType}} + "{{{name}}}": obj.get("{{{baseName}}}"){{^-last}},{{/-last}} + {{/items.items.isPrimitiveType}} + {{^items.items.isPrimitiveType}} + "{{{name}}}": [ + [{{{items.items.dataType}}}.from_dict(_inner_item) for _inner_item in _item] + for _item in obj.get("{{{baseName}}}") + ] if obj.get("{{{baseName}}}") is not None else None{{^-last}},{{/-last}} + {{/items.items.isPrimitiveType}} + {{/items.isArray}} + {{^items.isArray}} + {{^items.isPrimitiveType}} + {{#items.isEnumOrRef}} + "{{{name}}}": obj.get("{{{baseName}}}"){{^-last}},{{/-last}} + {{/items.isEnumOrRef}} + {{^items.isEnumOrRef}} + "{{{name}}}": [{{{items.dataType}}}.from_dict(_item) for _item in obj.get("{{{baseName}}}")] if obj.get("{{{baseName}}}") is not None else None{{^-last}},{{/-last}} + {{/items.isEnumOrRef}} + {{/items.isPrimitiveType}} + {{#items.isPrimitiveType}} + "{{{name}}}": obj.get("{{{baseName}}}"){{^-last}},{{/-last}} + {{/items.isPrimitiveType}} + {{/items.isArray}} + {{/isArray}} + {{#isMap}} + {{^items.isPrimitiveType}} + {{^items.isEnumOrRef}} + {{#items.isContainer}} + {{#items.isMap}} + "{{{name}}}": dict( + (_k, dict( + (_ik, {{{items.items.dataType}}}.from_dict(_iv)) + for _ik, _iv in _v.items() + ) + if _v is not None + else None + ) + for _k, _v in obj.get("{{{baseName}}}").items() + ) + if obj.get("{{{baseName}}}") is not None + else None{{^-last}},{{/-last}} + {{/items.isMap}} + {{#items.isArray}} + "{{{name}}}": dict( + (_k, + [{{{items.items.dataType}}}.from_dict(_item) for _item in _v] + if _v is not None + else None + ) + for _k, _v in obj.get("{{{baseName}}}").items() + ){{^-last}},{{/-last}} + {{/items.isArray}} + {{/items.isContainer}} + {{^items.isContainer}} + "{{{name}}}": dict( + (_k, {{{items.dataType}}}.from_dict(_v)) + for _k, _v in obj.get("{{{baseName}}}").items() + ) + if obj.get("{{{baseName}}}") is not None + else None{{^-last}},{{/-last}} + {{/items.isContainer}} + {{/items.isEnumOrRef}} + {{#items.isEnumOrRef}} + "{{{name}}}": dict((_k, _v) for _k, _v in obj.get("{{{baseName}}}").items()){{^-last}},{{/-last}} + {{/items.isEnumOrRef}} + {{/items.isPrimitiveType}} + {{#items.isPrimitiveType}} + "{{{name}}}": obj.get("{{{baseName}}}"){{^-last}},{{/-last}} + {{/items.isPrimitiveType}} + {{/isMap}} + {{/isContainer}} + {{^isContainer}} + {{^isPrimitiveType}} + {{^isEnumOrRef}} + "{{{name}}}": {{{dataType}}}.from_dict(obj.get("{{{baseName}}}")) if obj.get("{{{baseName}}}") is not None else None{{^-last}},{{/-last}} + {{/isEnumOrRef}} + {{#isEnumOrRef}} + "{{{name}}}": obj.get("{{{baseName}}}"){{^-last}},{{/-last}} + {{/isEnumOrRef}} + {{/isPrimitiveType}} + {{#isPrimitiveType}} + {{#defaultValue}} + "{{{name}}}": obj.get("{{{baseName}}}") if obj.get("{{{baseName}}}") is not None else {{{defaultValue}}}{{^-last}},{{/-last}} + {{/defaultValue}} + {{^defaultValue}} + "{{{name}}}": obj.get("{{{baseName}}}"){{^-last}},{{/-last}} + {{/defaultValue}} + {{/isPrimitiveType}} + {{/isContainer}} + {{/allVars}} + }) + {{#isAdditionalPropertiesTrue}} + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + {{/isAdditionalPropertiesTrue}} + return _obj + {{/hasChildren}} + +{{#vendorExtensions.x-py-postponed-model-imports.size}} +{{#vendorExtensions.x-py-postponed-model-imports}} +{{{.}}} +{{/vendorExtensions.x-py-postponed-model-imports}} +{{classname}}.update_forward_refs() +{{/vendorExtensions.x-py-postponed-model-imports.size}} diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/model_oneof.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/model_oneof.mustache new file mode 100644 index 00000000000..2f23bade341 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/model_oneof.mustache @@ -0,0 +1,206 @@ +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 +{{#vendorExtensions.x-py-datetime-imports}}{{#-first}}from datetime import{{/-first}} {{{.}}}{{^-last}},{{/-last}}{{/vendorExtensions.x-py-datetime-imports}} +{{#vendorExtensions.x-py-typing-imports}}{{#-first}}from typing import{{/-first}} {{{.}}}{{^-last}},{{/-last}}{{/vendorExtensions.x-py-typing-imports}} +{{#vendorExtensions.x-py-pydantic-imports}}{{#-first}}from pydantic import{{/-first}} {{{.}}}{{^-last}},{{/-last}}{{/vendorExtensions.x-py-pydantic-imports}} +{{#vendorExtensions.x-py-model-imports}} +{{{.}}} +{{/vendorExtensions.x-py-model-imports}} +from typing import Union, Any, List, TYPE_CHECKING +from pydantic import StrictStr, Field + +{{#lambda.uppercase}}{{{classname}}}{{/lambda.uppercase}}_ONE_OF_SCHEMAS = [{{#oneOf}}"{{.}}"{{^-last}}, {{/-last}}{{/oneOf}}] + +class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}): + """ + {{{description}}}{{^description}}{{{classname}}}{{/description}} + """ +{{#composedSchemas.oneOf}} + # data type: {{{dataType}}} + {{vendorExtensions.x-py-name}}: {{{vendorExtensions.x-py-typing}}} +{{/composedSchemas.oneOf}} + if TYPE_CHECKING: + actual_instance: Union[{{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}] + else: + actual_instance: Any + one_of_schemas: List[str] = Field({{#lambda.uppercase}}{{{classname}}}{{/lambda.uppercase}}_ONE_OF_SCHEMAS, const=True) + + class Config: + validate_assignment = True +{{#discriminator}} + + discriminator_value_class_map = { +{{#children}} + '{{^vendorExtensions.x-discriminator-value}}{{name}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}': '{{{classname}}}'{{^-last}},{{/-last}} +{{/children}} + } +{{/discriminator}} + + 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): + {{#isNullable}} + if v is None: + return v + + {{/isNullable}} + instance = {{{classname}}}.construct() + error_messages = [] + match = 0 + {{#composedSchemas.oneOf}} + # validate data type: {{{dataType}}} + {{#isContainer}} + try: + instance.{{vendorExtensions.x-py-name}} = v + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + {{/isContainer}} + {{^isContainer}} + {{#isPrimitiveType}} + try: + instance.{{vendorExtensions.x-py-name}} = v + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + {{/isPrimitiveType}} + {{^isPrimitiveType}} + if not isinstance(v, {{{dataType}}}): + error_messages.append(f"Error! Input type `{type(v)}` is not `{{{dataType}}}`") + else: + match += 1 + {{/isPrimitiveType}} + {{/isContainer}} + {{/composedSchemas.oneOf}} + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in {{{classname}}} with oneOf schemas: {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in {{{classname}}} with oneOf schemas: {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: dict) -> {{{classname}}}: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> {{{classname}}}: + """Returns the object represented by the json string""" + instance = {{{classname}}}.construct() + {{#isNullable}} + if json_str is None: + return instance + + {{/isNullable}} + error_messages = [] + match = 0 + + {{#useOneOfDiscriminatorLookup}} + {{#discriminator}} + {{#mappedModels}} + {{#-first}} + # use oneOf discriminator to lookup the data type + _data_type = json.loads(json_str).get("{{{propertyBaseName}}}") + if not _data_type: + raise ValueError("Failed to lookup data type from the field `{{{propertyBaseName}}}` in the input.") + + {{/-first}} + # check if data type is `{{{modelName}}}` + if _data_type == "{{{mappingName}}}": + instance.actual_instance = {{{modelName}}}.from_json(json_str) + return instance + + {{/mappedModels}} + {{/discriminator}} + {{/useOneOfDiscriminatorLookup}} + {{#composedSchemas.oneOf}} + {{#isContainer}} + # deserialize data into {{{dataType}}} + try: + # validation + instance.{{vendorExtensions.x-py-name}} = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.{{vendorExtensions.x-py-name}} + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + {{/isContainer}} + {{^isContainer}} + {{#isPrimitiveType}} + # deserialize data into {{{dataType}}} + try: + # validation + instance.{{vendorExtensions.x-py-name}} = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.{{vendorExtensions.x-py-name}} + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + {{/isPrimitiveType}} + {{^isPrimitiveType}} + # deserialize data into {{{dataType}}} + try: + instance.actual_instance = {{{dataType}}}.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + {{/isPrimitiveType}} + {{/isContainer}} + {{/composedSchemas.oneOf}} + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into {{{classname}}} with oneOf schemas: {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into {{{classname}}} with oneOf schemas: {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}. 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()) + +{{#vendorExtensions.x-py-postponed-model-imports.size}} +{{#vendorExtensions.x-py-postponed-model-imports}} +{{{.}}} +{{/vendorExtensions.x-py-postponed-model-imports}} +{{classname}}.update_forward_refs() +{{/vendorExtensions.x-py-postponed-model-imports.size}} diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/model_test.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/model_test.mustache new file mode 100644 index 00000000000..2c7fa1f132c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/model_test.mustache @@ -0,0 +1,60 @@ +# coding: utf-8 + +{{>partial_header}} + +import unittest +import datetime + +{{#models}} +{{#model}} +from {{modelPackage}}.{{classFilename}} import {{classname}} # noqa: E501 + +class Test{{classname}}(unittest.TestCase): + """{{classname}} unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass +{{^isEnum}} + + def make_instance(self, include_optional) -> {{classname}}: + """Test {{classname}} + 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 `{{{classname}}}` + """ + model = {{classname}}() # noqa: E501 + if include_optional: + return {{classname}}( + {{#vars}} + {{name}} = {{{example}}}{{^example}}None{{/example}}{{^-last}},{{/-last}} + {{/vars}} + ) + else: + return {{classname}}( + {{#vars}} + {{#required}} + {{name}} = {{{example}}}{{^example}}None{{/example}}, + {{/required}} + {{/vars}} + ) + """ +{{/isEnum}} + + def test{{classname}}(self): + """Test {{classname}}""" +{{^isEnum}} + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) +{{/isEnum}} +{{#isEnum}} + # inst = {{{classname}}}() +{{/isEnum}} +{{/model}} +{{/models}} + +if __name__ == '__main__': + unittest.main() diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/partial_header.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/partial_header.mustache new file mode 100644 index 00000000000..50aa81171f6 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/partial_header.mustache @@ -0,0 +1,19 @@ +""" +{{#appName}} + {{{.}}} + +{{/appName}} +{{#appDescription}} + {{{.}}} + +{{/appDescription}} + {{#version}} + The version of the OpenAPI document: {{{.}}} + {{/version}} + {{#infoEmail}} + Contact: {{{.}}} + {{/infoEmail}} + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/py.typed.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/py.typed.mustache new file mode 100644 index 00000000000..e69de29bb2d diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/pyproject.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/pyproject.mustache new file mode 100644 index 00000000000..75900ed9f8a --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/pyproject.mustache @@ -0,0 +1,40 @@ +[tool.poetry] +name = "{{{packageName}}}" +version = "{{{packageVersion}}}" +description = "{{{appName}}}" +authors = ["{{infoName}}{{^infoName}}OpenAPI Generator Community{{/infoName}} <{{infoEmail}}{{^infoEmail}}team@openapitools.org{{/infoEmail}}>"] +license = "{{{licenseInfo}}}{{^licenseInfo}}NoLicense{{/licenseInfo}}" +readme = "README.md" +repository = "https://github.com/{{{gitUserId}}}/{{{gitRepoId}}}" +keywords = ["OpenAPI", "OpenAPI-Generator", "{{{appName}}}"] +include = ["{{packageName}}/py.typed"] + +[tool.poetry.dependencies] +python = "^3.7" + +urllib3 = ">= 1.25.3" +python-dateutil = ">=2.8.2" +{{#asyncio}} +aiohttp = ">= 3.8.4" +{{/asyncio}} +{{#tornado}} +tornado = ">=4.2,<5" +{{/tornado}} +{{#hasHttpSignatureMethods}} +pem = ">= 19.3.0" +pycryptodome = ">= 3.9.0" +{{/hasHttpSignatureMethods}} +pydantic = "^1.10.5, <2" +aenum = ">=3.1.11" + +[tool.poetry.dev-dependencies] +pytest = ">=7.2.1" +tox = ">=3.9.0" +flake8 = ">=4.0.0" + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[tool.pylint.'MESSAGES CONTROL'] +extension-pkg-whitelist = "pydantic" diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/python_doc_auth_partial.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/python_doc_auth_partial.mustache new file mode 100644 index 00000000000..f478fe0f1ad --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/python_doc_auth_partial.mustache @@ -0,0 +1,108 @@ +# Defining the host is optional and defaults to {{{basePath}}} +# See configuration.py for a list of all supported configuration parameters. +configuration = {{{packageName}}}.Configuration( + host = "{{{basePath}}}" +) + +{{#hasAuthMethods}} +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. +{{#authMethods}} +{{#isBasic}} +{{#isBasicBasic}} + +# Configure HTTP basic authorization: {{{name}}} +configuration = {{{packageName}}}.Configuration( + username = os.environ["USERNAME"], + password = os.environ["PASSWORD"] +) +{{/isBasicBasic}} +{{#isBasicBearer}} + +# Configure Bearer authorization{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}: {{{name}}} +configuration = {{{packageName}}}.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) +{{/isBasicBearer}} +{{#isHttpSignature}} + +# Configure HTTP message signature: {{{name}}} +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See {{{packageName}}}.signing for a list of all supported parameters. +from {{{packageName}}} import signing +import datetime + +configuration = {{{packageName}}}.Configuration( + host = "{{{basePath}}}", + signing_info = {{{packageName}}}.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = {{{packageName}}}.signing.SCHEME_HS2019, + signing_algorithm = {{{packageName}}}.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = {{{packageName}}}.signing.SCHEME_RSA_SHA256, + signed_headers = [ + {{{packageName}}}.signing.HEADER_REQUEST_TARGET, + {{{packageName}}}.signing.HEADER_CREATED, + {{{packageName}}}.signing.HEADER_EXPIRES, + {{{packageName}}}.signing.HEADER_HOST, + {{{packageName}}}.signing.HEADER_DATE, + {{{packageName}}}.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) +{{/isHttpSignature}} +{{/isBasic}} +{{#isApiKey}} + +# Configure API key authorization: {{{name}}} +configuration.api_key['{{{name}}}'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['{{name}}'] = 'Bearer' +{{/isApiKey}} +{{#isOAuth}} + +configuration.access_token = os.environ["ACCESS_TOKEN"] +{{/isOAuth}} +{{/authMethods}} +{{/hasAuthMethods}} diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/requirements.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/requirements.mustache new file mode 100644 index 00000000000..f204cda05c5 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/requirements.mustache @@ -0,0 +1,11 @@ +python_dateutil >= 2.5.3 +setuptools >= 21.0.0 +urllib3 >= 1.25.3, < 2.1.0 +pydantic >= 1.10.5, < 2 +aenum >= 3.1.11 +{{#asyncio}} +aiohttp >= 3.0.0 +{{/asyncio}} +{{#hasHttpSignatureMethods}} +pycryptodome >= 3.9.0 +{{/hasHttpSignatureMethods}} diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/rest.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/rest.mustache new file mode 100644 index 00000000000..f49dee2bed4 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/rest.mustache @@ -0,0 +1,293 @@ +# coding: utf-8 + +{{>partial_header}} + +import io +import json +import logging +import re +import ssl + +from urllib.parse import urlencode, quote_plus +import urllib3 + +from {{packageName}}.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError, BadRequestException + + +logger = logging.getLogger(__name__) + + +class RESTResponse(io.IOBase): + + def __init__(self, resp) -> None: + self.urllib3_response = resp + self.status = resp.status + self.reason = resp.reason + self.data = resp.data + + def getheaders(self): + """Returns a dictionary of the response headers.""" + return self.urllib3_response.headers + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.urllib3_response.headers.get(name, default) + + +class RESTClientObject: + + def __init__(self, configuration, pools_size=4, maxsize=None) -> None: + # urllib3.PoolManager will pass all kw parameters to connectionpool + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 + # maxsize is the number of requests to host that are allowed in parallel # noqa: E501 + # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 + + # cert_reqs + if configuration.verify_ssl: + cert_reqs = ssl.CERT_REQUIRED + else: + cert_reqs = ssl.CERT_NONE + + addition_pool_args = {} + if configuration.assert_hostname is not None: + addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 + + if configuration.retries is not None: + addition_pool_args['retries'] = configuration.retries + + if configuration.tls_server_name: + addition_pool_args['server_hostname'] = configuration.tls_server_name + + + if configuration.socket_options is not None: + addition_pool_args['socket_options'] = configuration.socket_options + + if maxsize is None: + if configuration.connection_pool_maxsize is not None: + maxsize = configuration.connection_pool_maxsize + else: + maxsize = 4 + + # https pool manager + if configuration.proxy: + self.pool_manager = urllib3.ProxyManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=configuration.ssl_ca_cert, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + proxy_url=configuration.proxy, + proxy_headers=configuration.proxy_headers, + **addition_pool_args + ) + else: + self.pool_manager = urllib3.PoolManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=configuration.ssl_ca_cert, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + **addition_pool_args + ) + + def request(self, method, url, query_params=None, headers=None, + body=None, post_params=None, _preload_content=True, + _request_timeout=None): + """Perform requests. + + :param method: http request method + :param url: http request url + :param query_params: query parameters in the url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + """ + method = method.upper() + assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', + 'PATCH', 'OPTIONS'] + + if post_params and body: + raise ApiValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + # url already contains the URL query string + # so reset query_params to empty dict + query_params = {} + + timeout = None + if _request_timeout: + if isinstance(_request_timeout, (int,float)): # noqa: E501,F821 + timeout = urllib3.Timeout(total=_request_timeout) + elif (isinstance(_request_timeout, tuple) and + len(_request_timeout) == 2): + timeout = urllib3.Timeout( + connect=_request_timeout[0], read=_request_timeout[1]) + + try: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + + # no content type provided or payload is json + if not headers.get('Content-Type') or re.search('json', headers['Content-Type'], re.IGNORECASE): + request_body = None + if body is not None: + request_body = json.dumps(body) + r = self.pool_manager.request( + method, url, + body=request_body, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + r = self.pool_manager.request( + method, url, + fields=post_params, + encode_multipart=False, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + elif headers['Content-Type'] == 'multipart/form-data': + # must del headers['Content-Type'], or the correct + # Content-Type which generated by urllib3 will be + # overwritten. + del headers['Content-Type'] + r = self.pool_manager.request( + method, url, + fields=post_params, + encode_multipart=True, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + # Pass a `string` parameter directly in the body to support + # other content types than Json when `body` argument is + # provided in serialized form + elif isinstance(body, str) or isinstance(body, bytes): + request_body = body + r = self.pool_manager.request( + method, url, + body=request_body, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + # For `GET`, `HEAD` + else: + r = self.pool_manager.request(method, url, + fields={}, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + except urllib3.exceptions.SSLError as e: + msg = "{0}\n{1}".format(type(e).__name__, str(e)) + raise ApiException(status=0, reason=msg) + + if _preload_content: + r = RESTResponse(r) + + # log response body + logger.debug("response body: %s", r.data) + + if not 200 <= r.status <= 299: + if r.status == 400: + raise BadRequestException(http_resp=r) + + if r.status == 401: + raise UnauthorizedException(http_resp=r) + + if r.status == 403: + raise ForbiddenException(http_resp=r) + + if r.status == 404: + raise NotFoundException(http_resp=r) + + if 500 <= r.status <= 599: + raise ServiceException(http_resp=r) + + raise ApiException(http_resp=r) + + return r + + def get_request(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("GET", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def head_request(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("HEAD", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def options_request(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("OPTIONS", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def delete_request(self, url, headers=None, query_params=None, body=None, + _preload_content=True, _request_timeout=None): + return self.request("DELETE", url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def post_request(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("POST", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def put_request(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PUT", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def patch_request(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PATCH", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/setup.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/setup.mustache new file mode 100644 index 00000000000..538a8dff90f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/setup.mustache @@ -0,0 +1,56 @@ +# coding: utf-8 + +{{>partial_header}} + +from setuptools import setup, find_packages # noqa: H301 + +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools +NAME = "{{{projectName}}}" +VERSION = "{{packageVersion}}" +PYTHON_REQUIRES = ">=3.7" +{{#apiInfo}} +{{#apis}} +{{#-last}} +REQUIRES = [ + "urllib3 >= 1.25.3, < 2.1.0", + "python-dateutil", +{{#asyncio}} + "aiohttp >= 3.0.0", +{{/asyncio}} +{{#tornado}} + "tornado>=4.2,<5", +{{/tornado}} +{{#hasHttpSignatureMethods}} + "pem>=19.3.0", + "pycryptodome>=3.9.0", +{{/hasHttpSignatureMethods}} + "pydantic >= 1.10.5, < 2", + "aenum" +] + +setup( + name=NAME, + version=VERSION, + description="{{appName}}", + author="{{infoName}}{{^infoName}}OpenAPI Generator community{{/infoName}}", + author_email="{{infoEmail}}{{^infoEmail}}team@openapitools.org{{/infoEmail}}", + url="{{packageUrl}}", + keywords=["OpenAPI", "OpenAPI-Generator", "{{{appName}}}"], + install_requires=REQUIRES, + packages=find_packages(exclude=["test", "tests"]), + include_package_data=True, + {{#licenseInfo}}license="{{.}}", + {{/licenseInfo}}long_description_content_type='text/markdown', + long_description="""\ + {{appDescription}} + """, # noqa: E501 + package_data={"{{{packageName}}}": ["py.typed"]}, +) +{{/-last}} +{{/apis}} +{{/apiInfo}} diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/setup_cfg.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/setup_cfg.mustache new file mode 100644 index 00000000000..11433ee875a --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/setup_cfg.mustache @@ -0,0 +1,2 @@ +[flake8] +max-line-length=99 diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/signing.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/signing.mustache new file mode 100644 index 00000000000..bb2850fdcc0 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/signing.mustache @@ -0,0 +1,403 @@ +{{>partial_header}} + +from base64 import b64encode +from Crypto.IO import PEM, PKCS8 +from Crypto.Hash import SHA256, SHA512 +from Crypto.PublicKey import RSA, ECC +from Crypto.Signature import PKCS1_v1_5, pss, DSS +from email.utils import formatdate +import json +import os +import re +from time import time +from urllib.parse import urlencode, urlparse + +# The constants below define a subset of HTTP headers that can be included in the +# HTTP signature scheme. Additional headers may be included in the signature. + +# The '(request-target)' header is a calculated field that includes the HTTP verb, +# the URL path and the URL query. +HEADER_REQUEST_TARGET = '(request-target)' +# The time when the HTTP signature was generated. +HEADER_CREATED = '(created)' +# The time when the HTTP signature expires. The API server should reject HTTP requests +# that have expired. +HEADER_EXPIRES = '(expires)' +# The 'Host' header. +HEADER_HOST = 'Host' +# The 'Date' header. +HEADER_DATE = 'Date' +# When the 'Digest' header is included in the HTTP signature, the client automatically +# computes the digest of the HTTP request body, per RFC 3230. +HEADER_DIGEST = 'Digest' +# The 'Authorization' header is automatically generated by the client. It includes +# the list of signed headers and a base64-encoded signature. +HEADER_AUTHORIZATION = 'Authorization' + +# The constants below define the cryptographic schemes for the HTTP signature scheme. +SCHEME_HS2019 = 'hs2019' +SCHEME_RSA_SHA256 = 'rsa-sha256' +SCHEME_RSA_SHA512 = 'rsa-sha512' + +# The constants below define the signature algorithms that can be used for the HTTP +# signature scheme. +ALGORITHM_RSASSA_PSS = 'RSASSA-PSS' +ALGORITHM_RSASSA_PKCS1v15 = 'RSASSA-PKCS1-v1_5' + +ALGORITHM_ECDSA_MODE_FIPS_186_3 = 'fips-186-3' +ALGORITHM_ECDSA_MODE_DETERMINISTIC_RFC6979 = 'deterministic-rfc6979' +ALGORITHM_ECDSA_KEY_SIGNING_ALGORITHMS = { + ALGORITHM_ECDSA_MODE_FIPS_186_3, + ALGORITHM_ECDSA_MODE_DETERMINISTIC_RFC6979 +} + +# The cryptographic hash algorithm for the message signature. +HASH_SHA256 = 'sha256' +HASH_SHA512 = 'sha512' + + +class HttpSigningConfiguration: + """The configuration parameters for the HTTP signature security scheme. + The HTTP signature security scheme is used to sign HTTP requests with a private key + which is in possession of the API client. + An 'Authorization' header is calculated by creating a hash of select headers, + and optionally the body of the HTTP request, then signing the hash value using + a private key. The 'Authorization' header is added to outbound HTTP requests. + + :param key_id: A string value specifying the identifier of the cryptographic key, + when signing HTTP requests. + :param signing_scheme: A string value specifying the signature scheme, when + signing HTTP requests. + Supported value are hs2019, rsa-sha256, rsa-sha512. + Avoid using rsa-sha256, rsa-sha512 as they are deprecated. These values are + available for server-side applications that only support the older + HTTP signature algorithms. + :param private_key_path: A string value specifying the path of the file containing + a private key. The private key is used to sign HTTP requests. + :param private_key_passphrase: A string value specifying the passphrase to decrypt + the private key. + :param signed_headers: A list of strings. Each value is the name of a HTTP header + that must be included in the HTTP signature calculation. + The two special signature headers '(request-target)' and '(created)' SHOULD be + included in SignedHeaders. + The '(created)' header expresses when the signature was created. + The '(request-target)' header is a concatenation of the lowercased :method, an + ASCII space, and the :path pseudo-headers. + When signed_headers is not specified, the client defaults to a single value, + '(created)', in the list of HTTP headers. + When SignedHeaders contains the 'Digest' value, the client performs the + following operations: + 1. Calculate a digest of request body, as specified in RFC3230, section 4.3.2. + 2. Set the 'Digest' header in the request body. + 3. Include the 'Digest' header and value in the HTTP signature. + :param signing_algorithm: A string value specifying the signature algorithm, when + signing HTTP requests. + Supported values are: + 1. For RSA keys: RSASSA-PSS, RSASSA-PKCS1-v1_5. + 2. For ECDSA keys: fips-186-3, deterministic-rfc6979. + If None, the signing algorithm is inferred from the private key. + The default signing algorithm for RSA keys is RSASSA-PSS. + The default signing algorithm for ECDSA keys is fips-186-3. + :param hash_algorithm: The hash algorithm for the signature. Supported values are + sha256 and sha512. + If the signing_scheme is rsa-sha256, the hash algorithm must be set + to None or sha256. + If the signing_scheme is rsa-sha512, the hash algorithm must be set + to None or sha512. + :param signature_max_validity: The signature max validity, expressed as + a datetime.timedelta value. It must be a positive value. + """ + def __init__(self, key_id, signing_scheme, private_key_path, + private_key_passphrase=None, + signed_headers=None, + signing_algorithm=None, + hash_algorithm=None, + signature_max_validity=None) -> None: + self.key_id = key_id + if signing_scheme not in {SCHEME_HS2019, SCHEME_RSA_SHA256, SCHEME_RSA_SHA512}: + raise Exception("Unsupported security scheme: {0}".format(signing_scheme)) + self.signing_scheme = signing_scheme + if not os.path.exists(private_key_path): + raise Exception("Private key file does not exist") + self.private_key_path = private_key_path + self.private_key_passphrase = private_key_passphrase + self.signing_algorithm = signing_algorithm + self.hash_algorithm = hash_algorithm + if signing_scheme == SCHEME_RSA_SHA256: + if self.hash_algorithm is None: + self.hash_algorithm = HASH_SHA256 + elif self.hash_algorithm != HASH_SHA256: + raise Exception("Hash algorithm must be sha256 when security scheme is %s" % + SCHEME_RSA_SHA256) + elif signing_scheme == SCHEME_RSA_SHA512: + if self.hash_algorithm is None: + self.hash_algorithm = HASH_SHA512 + elif self.hash_algorithm != HASH_SHA512: + raise Exception("Hash algorithm must be sha512 when security scheme is %s" % + SCHEME_RSA_SHA512) + elif signing_scheme == SCHEME_HS2019: + if self.hash_algorithm is None: + self.hash_algorithm = HASH_SHA256 + elif self.hash_algorithm not in {HASH_SHA256, HASH_SHA512}: + raise Exception("Invalid hash algorithm") + if signature_max_validity is not None and signature_max_validity.total_seconds() < 0: + raise Exception("The signature max validity must be a positive value") + self.signature_max_validity = signature_max_validity + # If the user has not provided any signed_headers, the default must be set to '(created)', + # as specified in the 'HTTP signature' standard. + if signed_headers is None or len(signed_headers) == 0: + signed_headers = [HEADER_CREATED] + if self.signature_max_validity is None and HEADER_EXPIRES in signed_headers: + raise Exception( + "Signature max validity must be set when " + "'(expires)' signature parameter is specified") + if len(signed_headers) != len(set(signed_headers)): + raise Exception("Cannot have duplicates in the signed_headers parameter") + if HEADER_AUTHORIZATION in signed_headers: + raise Exception("'Authorization' header cannot be included in signed headers") + self.signed_headers = signed_headers + self.private_key = None + """The private key used to sign HTTP requests. + Initialized when the PEM-encoded private key is loaded from a file. + """ + self.host = None + """The host name, optionally followed by a colon and TCP port number. + """ + self._load_private_key() + + def get_http_signature_headers(self, resource_path, method, headers, body, query_params): + """Create a cryptographic message signature for the HTTP request and add the signed headers. + + :param resource_path : A string representation of the HTTP request resource path. + :param method: A string representation of the HTTP request method, e.g. GET, POST. + :param headers: A dict containing the HTTP request headers. + :param body: The object representing the HTTP request body. + :param query_params: A string representing the HTTP request query parameters. + :return: A dict of HTTP headers that must be added to the outbound HTTP request. + """ + if method is None: + raise Exception("HTTP method must be set") + if resource_path is None: + raise Exception("Resource path must be set") + + signed_headers_list, request_headers_dict = self._get_signed_header_info( + resource_path, method, headers, body, query_params) + + header_items = [ + "{0}: {1}".format(key.lower(), value) for key, value in signed_headers_list] + string_to_sign = "\n".join(header_items) + + digest, digest_prefix = self._get_message_digest(string_to_sign.encode()) + b64_signed_msg = self._sign_digest(digest) + + request_headers_dict[HEADER_AUTHORIZATION] = self._get_authorization_header( + signed_headers_list, b64_signed_msg) + + return request_headers_dict + + def get_public_key(self): + """Returns the public key object associated with the private key. + """ + pubkey = None + if isinstance(self.private_key, RSA.RsaKey): + pubkey = self.private_key.publickey() + elif isinstance(self.private_key, ECC.EccKey): + pubkey = self.private_key.public_key() + return pubkey + + def _load_private_key(self): + """Load the private key used to sign HTTP requests. + The private key is used to sign HTTP requests as defined in + https://datatracker.ietf.org/doc/draft-cavage-http-signatures/. + """ + if self.private_key is not None: + return + with open(self.private_key_path, 'r') as f: + pem_data = f.read() + # Verify PEM Pre-Encapsulation Boundary + r = re.compile(r"\s*-----BEGIN (.*)-----\s+") + m = r.match(pem_data) + if not m: + raise ValueError("Not a valid PEM pre boundary") + pem_header = m.group(1) + if pem_header == 'RSA PRIVATE KEY': + self.private_key = RSA.importKey(pem_data, self.private_key_passphrase) + elif pem_header == 'EC PRIVATE KEY': + self.private_key = ECC.import_key(pem_data, self.private_key_passphrase) + elif pem_header in {'PRIVATE KEY', 'ENCRYPTED PRIVATE KEY'}: + # Key is in PKCS8 format, which is capable of holding many different + # types of private keys, not just EC keys. + (key_binary, pem_header, is_encrypted) = \ + PEM.decode(pem_data, self.private_key_passphrase) + (oid, privkey, params) = \ + PKCS8.unwrap(key_binary, passphrase=self.private_key_passphrase) + if oid == '1.2.840.10045.2.1': + self.private_key = ECC.import_key(pem_data, self.private_key_passphrase) + else: + raise Exception("Unsupported key: {0}. OID: {1}".format(pem_header, oid)) + else: + raise Exception("Unsupported key: {0}".format(pem_header)) + # Validate the specified signature algorithm is compatible with the private key. + if self.signing_algorithm is not None: + supported_algs = None + if isinstance(self.private_key, RSA.RsaKey): + supported_algs = {ALGORITHM_RSASSA_PSS, ALGORITHM_RSASSA_PKCS1v15} + elif isinstance(self.private_key, ECC.EccKey): + supported_algs = ALGORITHM_ECDSA_KEY_SIGNING_ALGORITHMS + if supported_algs is not None and self.signing_algorithm not in supported_algs: + raise Exception( + "Signing algorithm {0} is not compatible with private key".format( + self.signing_algorithm)) + + def _get_signed_header_info(self, resource_path, method, headers, body, query_params): + """Build the HTTP headers (name, value) that need to be included in + the HTTP signature scheme. + + :param resource_path : A string representation of the HTTP request resource path. + :param method: A string representation of the HTTP request method, e.g. GET, POST. + :param headers: A dict containing the HTTP request headers. + :param body: The object (e.g. a dict) representing the HTTP request body. + :param query_params: A string representing the HTTP request query parameters. + :return: A tuple containing two dict objects: + The first dict contains the HTTP headers that are used to calculate + the HTTP signature. + The second dict contains the HTTP headers that must be added to + the outbound HTTP request. + """ + + if body is None: + body = '' + else: + body = body.to_json() + + # Build the '(request-target)' HTTP signature parameter. + target_host = urlparse(self.host).netloc + target_path = urlparse(self.host).path + request_target = method.lower() + " " + target_path + resource_path + if query_params: + request_target += "?" + urlencode(query_params) + + # Get UNIX time, e.g. seconds since epoch, not including leap seconds. + now = time() + # Format date per RFC 7231 section-7.1.1.2. An example is: + # Date: Wed, 21 Oct 2015 07:28:00 GMT + cdate = formatdate(timeval=now, localtime=False, usegmt=True) + # The '(created)' value MUST be a Unix timestamp integer value. + # Subsecond precision is not supported. + created = int(now) + if self.signature_max_validity is not None: + expires = now + self.signature_max_validity.total_seconds() + + signed_headers_list = [] + request_headers_dict = {} + for hdr_key in self.signed_headers: + hdr_key = hdr_key.lower() + if hdr_key == HEADER_REQUEST_TARGET: + value = request_target + elif hdr_key == HEADER_CREATED: + value = '{0}'.format(created) + elif hdr_key == HEADER_EXPIRES: + value = '{0}'.format(expires) + elif hdr_key == HEADER_DATE.lower(): + value = cdate + request_headers_dict[HEADER_DATE] = '{0}'.format(cdate) + elif hdr_key == HEADER_DIGEST.lower(): + request_body = body.encode() + body_digest, digest_prefix = self._get_message_digest(request_body) + b64_body_digest = b64encode(body_digest.digest()) + value = digest_prefix + b64_body_digest.decode('ascii') + request_headers_dict[HEADER_DIGEST] = '{0}{1}'.format( + digest_prefix, b64_body_digest.decode('ascii')) + elif hdr_key == HEADER_HOST.lower(): + value = target_host + request_headers_dict[HEADER_HOST] = '{0}'.format(target_host) + else: + value = next((v for k, v in headers.items() if k.lower() == hdr_key), None) + if value is None: + raise Exception( + "Cannot sign HTTP request. " + "Request does not contain the '{0}' header".format(hdr_key)) + signed_headers_list.append((hdr_key, value)) + + return signed_headers_list, request_headers_dict + + def _get_message_digest(self, data): + """Calculates and returns a cryptographic digest of a specified HTTP request. + + :param data: The string representation of the date to be hashed with a cryptographic hash. + :return: A tuple of (digest, prefix). + The digest is a hashing object that contains the cryptographic digest of + the HTTP request. + The prefix is a string that identifies the cryptographic hash. It is used + to generate the 'Digest' header as specified in RFC 3230. + """ + if self.hash_algorithm == HASH_SHA512: + digest = SHA512.new() + prefix = 'SHA-512=' + elif self.hash_algorithm == HASH_SHA256: + digest = SHA256.new() + prefix = 'SHA-256=' + else: + raise Exception("Unsupported hash algorithm: {0}".format(self.hash_algorithm)) + digest.update(data) + return digest, prefix + + def _sign_digest(self, digest): + """Signs a message digest with a private key specified in the signing_info. + + :param digest: A hashing object that contains the cryptographic digest of the HTTP request. + :return: A base-64 string representing the cryptographic signature of the input digest. + """ + sig_alg = self.signing_algorithm + if isinstance(self.private_key, RSA.RsaKey): + if sig_alg is None or sig_alg == ALGORITHM_RSASSA_PSS: + # RSASSA-PSS in Section 8.1 of RFC8017. + signature = pss.new(self.private_key).sign(digest) + elif sig_alg == ALGORITHM_RSASSA_PKCS1v15: + # RSASSA-PKCS1-v1_5 in Section 8.2 of RFC8017. + signature = PKCS1_v1_5.new(self.private_key).sign(digest) + else: + raise Exception("Unsupported signature algorithm: {0}".format(sig_alg)) + elif isinstance(self.private_key, ECC.EccKey): + if sig_alg is None: + sig_alg = ALGORITHM_ECDSA_MODE_FIPS_186_3 + if sig_alg in ALGORITHM_ECDSA_KEY_SIGNING_ALGORITHMS: + # draft-ietf-httpbis-message-signatures-00 does not specify the ECDSA encoding. + # Issue: https://github.com/w3c-ccg/http-signatures/issues/107 + signature = DSS.new(key=self.private_key, mode=sig_alg, + encoding='der').sign(digest) + else: + raise Exception("Unsupported signature algorithm: {0}".format(sig_alg)) + else: + raise Exception("Unsupported private key: {0}".format(type(self.private_key))) + return b64encode(signature) + + def _get_authorization_header(self, signed_headers, signed_msg): + """Calculates and returns the value of the 'Authorization' header when signing HTTP requests. + + :param signed_headers : A list of tuples. Each value is the name of a HTTP header that + must be included in the HTTP signature calculation. + :param signed_msg: A base-64 encoded string representation of the signature. + :return: The string value of the 'Authorization' header, representing the signature + of the HTTP request. + """ + created_ts = None + expires_ts = None + for k, v in signed_headers: + if k == HEADER_CREATED: + created_ts = v + elif k == HEADER_EXPIRES: + expires_ts = v + lower_keys = [k.lower() for k, v in signed_headers] + headers_value = " ".join(lower_keys) + + auth_str = "Signature keyId=\"{0}\",algorithm=\"{1}\",".format( + self.key_id, self.signing_scheme) + if created_ts is not None: + auth_str = auth_str + "created={0},".format(created_ts) + if expires_ts is not None: + auth_str = auth_str + "expires={0},".format(expires_ts) + auth_str = auth_str + "headers=\"{0}\",signature=\"{1}\"".format( + headers_value, signed_msg.decode('ascii')) + + return auth_str diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/test-requirements.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/test-requirements.mustache new file mode 100644 index 00000000000..3a0d0b939a1 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/test-requirements.mustache @@ -0,0 +1,3 @@ +pytest~=7.1.3 +pytest-cov>=2.8.1 +pytest-randomly>=3.12.0 diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/tornado/rest.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/tornado/rest.mustache new file mode 100644 index 00000000000..6b91cdef986 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/tornado/rest.mustache @@ -0,0 +1,223 @@ +# coding: utf-8 + +{{>partial_header}} + +import io +import json +import logging +import re + +from urllib.parse import urlencode, quote_plus +import tornado +import tornado.gen +from tornado import httpclient +from urllib3.filepost import encode_multipart_formdata + +from {{packageName}}.exceptions import ApiException, ApiValueError + +logger = logging.getLogger(__name__) + + +class RESTResponse(io.IOBase): + + def __init__(self, resp) -> None: + self.tornado_response = resp + self.status = resp.code + self.reason = resp.reason + + if resp.body: + self.data = resp.body + else: + self.data = None + + def getheaders(self): + """Returns a CIMultiDictProxy of the response headers.""" + return self.tornado_response.headers + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.tornado_response.headers.get(name, default) + + +class RESTClientObject: + + def __init__(self, configuration, pools_size=4, maxsize=4) -> None: + # maxsize is number of requests to host that are allowed in parallel + + self.ca_certs = configuration.ssl_ca_cert + self.client_key = configuration.key_file + self.client_cert = configuration.cert_file + + self.proxy_port = self.proxy_host = None + + # https pool manager + if configuration.proxy: + self.proxy_port = 80 + self.proxy_host = configuration.proxy + + self.pool_manager = httpclient.AsyncHTTPClient() + + @tornado.gen.coroutine + def request(self, method, url, query_params=None, headers=None, body=None, + post_params=None, _preload_content=True, + _request_timeout=None): + """Execute Request + + :param method: http request method + :param url: http request url + :param query_params: query parameters in the url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :param _preload_content: this is a non-applicable field for + the AiohttpClient. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + """ + method = method.upper() + assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', + 'PATCH', 'OPTIONS'] + + if post_params and body: + raise ApiValueError( + "body parameter cannot be used with post_params parameter." + ) + + request = httpclient.HTTPRequest(url) + request.allow_nonstandard_methods = True + request.ca_certs = self.ca_certs + request.client_key = self.client_key + request.client_cert = self.client_cert + request.proxy_host = self.proxy_host + request.proxy_port = self.proxy_port + request.method = method + if headers: + request.headers = headers + if 'Content-Type' not in headers: + request.headers['Content-Type'] = 'application/json' + request.request_timeout = _request_timeout or 5 * 60 + + post_params = post_params or {} + + if query_params: + request.url += '?' + urlencode(query_params) + + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + if re.search('json', headers['Content-Type'], re.IGNORECASE): + if body: + body = json.dumps(body) + request.body = body + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + request.body = urlencode(post_params) + elif headers['Content-Type'] == 'multipart/form-data': + multipart = encode_multipart_formdata(post_params) + request.body, headers['Content-Type'] = multipart + # Pass a `bytes` parameter directly in the body to support + # other content types than Json when `body` argument is provided + # in serialized form + elif isinstance(body, bytes): + request.body = body + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + + r = yield self.pool_manager.fetch(request, raise_error=False) + + if _preload_content: + + r = RESTResponse(r) + + # log response body + logger.debug("response body: %s", r.data) + + if not 200 <= r.status <= 299: + raise ApiException(http_resp=r) + + raise tornado.gen.Return(r) + + @tornado.gen.coroutine + def GET(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + result = yield self.request("GET", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + raise tornado.gen.Return(result) + + @tornado.gen.coroutine + def HEAD(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + result = yield self.request("HEAD", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + raise tornado.gen.Return(result) + + @tornado.gen.coroutine + def OPTIONS(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + result = yield self.request("OPTIONS", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + raise tornado.gen.Return(result) + + @tornado.gen.coroutine + def DELETE(self, url, headers=None, query_params=None, body=None, + _preload_content=True, _request_timeout=None): + result = yield self.request("DELETE", url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + raise tornado.gen.Return(result) + + @tornado.gen.coroutine + def POST(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + result = yield self.request("POST", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + raise tornado.gen.Return(result) + + @tornado.gen.coroutine + def PUT(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + result = yield self.request("PUT", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + raise tornado.gen.Return(result) + + @tornado.gen.coroutine + def PATCH(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + result = yield self.request("PATCH", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + raise tornado.gen.Return(result) diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/tox.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/tox.mustache new file mode 100644 index 00000000000..9d717c3dd20 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/tox.mustache @@ -0,0 +1,9 @@ +[tox] +envlist = py3 + +[testenv] +deps=-r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + +commands= + pytest --cov={{{packageName}}} diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/travis.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/travis.mustache new file mode 100644 index 00000000000..53cb57e845d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/travis.mustache @@ -0,0 +1,17 @@ +# ref: https://docs.travis-ci.com/user/languages/python +language: python +python: + - "3.7" + - "3.8" + - "3.9" + - "3.10" + - "3.11" + # uncomment the following if needed + #- "3.11-dev" # 3.11 development branch + #- "nightly" # nightly build +# command to install dependencies +install: + - "pip install -r requirements.txt" + - "pip install -r test-requirements.txt" +# command to run tests +script: pytest --cov={{{packageName}}} diff --git a/samples-python-pydantic-v1-petstore.yaml b/samples-python-pydantic-v1-petstore.yaml new file mode 100644 index 00000000000..21c80cc42db --- /dev/null +++ b/samples-python-pydantic-v1-petstore.yaml @@ -0,0 +1,59 @@ +name: "Python Client: Petstore" + +on: + pull_request: + paths: + - samples/openapi3/client/petstore/python-aiohttp/** + - samples/openapi3/client/petstore/python/** + - .github/workflows/samples-python-petstore.yaml + +jobs: + build: + name: Test Python client + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: + - "3.7" + - "3.8" + - "3.9" + - "3.10" + - "3.11" + sample: + - samples/openapi3/client/petstore/python-aiohttp + - samples/openapi3/client/petstore/python + services: + petstore-api: + image: swaggerapi/petstore + ports: + - 80:8080 + env: + SWAGGER_HOST: http://petstore.swagger.io + SWAGGER_BASE_PATH: /v2 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + id: py + with: + python-version: ${{ matrix.python-version }} + + - name: Cache + uses: actions/cache@v3 + with: + key: ${{ runner.os }}-python-${{ steps.py.outputs.python-version }}- + path: | + ~/.cache/pypoetry/virtualenvs/ + ~/.local/pipx/venvs/poetry/ + .mypy_cache/ + + - name: Install poetry + run: pipx install --python '${{ steps.py.outputs.python-path }}' poetry + + - name: Install + working-directory: ${{ matrix.sample }} + run: poetry install + + - name: Test + working-directory: ${{ matrix.sample }} + run: poetry run pytest -v diff --git a/samples/client/echo_api/python-pydantic-v1/.github/workflows/python.yml b/samples/client/echo_api/python-pydantic-v1/.github/workflows/python.yml new file mode 100644 index 00000000000..f128ba25e3d --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/.github/workflows/python.yml @@ -0,0 +1,38 @@ +# NOTE: This file is auto generated by OpenAPI Generator. +# URL: https://openapi-generator.tech +# +# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: openapi_client Python package + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest diff --git a/samples/client/echo_api/python-pydantic-v1/.gitignore b/samples/client/echo_api/python-pydantic-v1/.gitignore new file mode 100644 index 00000000000..43995bd42fa --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/.gitignore @@ -0,0 +1,66 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ +venv/ +.venv/ +.python-version +.pytest_cache + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +#Ipython Notebook +.ipynb_checkpoints diff --git a/samples/client/echo_api/python-pydantic-v1/.gitlab-ci.yml b/samples/client/echo_api/python-pydantic-v1/.gitlab-ci.yml new file mode 100644 index 00000000000..29da7211174 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/.gitlab-ci.yml @@ -0,0 +1,31 @@ +# NOTE: This file is auto generated by OpenAPI Generator. +# URL: https://openapi-generator.tech +# +# ref: https://docs.gitlab.com/ee/ci/README.html +# ref: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml + +stages: + - test + +.pytest: + stage: test + script: + - pip install -r requirements.txt + - pip install -r test-requirements.txt + - pytest --cov=openapi_client + +pytest-3.7: + extends: .pytest + image: python:3.7-alpine +pytest-3.8: + extends: .pytest + image: python:3.8-alpine +pytest-3.9: + extends: .pytest + image: python:3.9-alpine +pytest-3.10: + extends: .pytest + image: python:3.10-alpine +pytest-3.11: + extends: .pytest + image: python:3.11-alpine diff --git a/samples/client/echo_api/python-pydantic-v1/.openapi-generator-ignore b/samples/client/echo_api/python-pydantic-v1/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/echo_api/python-pydantic-v1/.openapi-generator/FILES b/samples/client/echo_api/python-pydantic-v1/.openapi-generator/FILES new file mode 100644 index 00000000000..0723c3ab0de --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/.openapi-generator/FILES @@ -0,0 +1,56 @@ +.github/workflows/python.yml +.gitignore +.gitlab-ci.yml +.travis.yml +README.md +docs/AuthApi.md +docs/Bird.md +docs/BodyApi.md +docs/Category.md +docs/DataQuery.md +docs/DefaultValue.md +docs/FormApi.md +docs/HeaderApi.md +docs/NumberPropertiesOnly.md +docs/PathApi.md +docs/Pet.md +docs/Query.md +docs/QueryApi.md +docs/StringEnumRef.md +docs/Tag.md +docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md +docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md +git_push.sh +openapi_client/__init__.py +openapi_client/api/__init__.py +openapi_client/api/auth_api.py +openapi_client/api/body_api.py +openapi_client/api/form_api.py +openapi_client/api/header_api.py +openapi_client/api/path_api.py +openapi_client/api/query_api.py +openapi_client/api_client.py +openapi_client/api_response.py +openapi_client/configuration.py +openapi_client/exceptions.py +openapi_client/models/__init__.py +openapi_client/models/bird.py +openapi_client/models/category.py +openapi_client/models/data_query.py +openapi_client/models/default_value.py +openapi_client/models/number_properties_only.py +openapi_client/models/pet.py +openapi_client/models/query.py +openapi_client/models/string_enum_ref.py +openapi_client/models/tag.py +openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py +openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py +openapi_client/py.typed +openapi_client/rest.py +pyproject.toml +requirements.txt +setup.cfg +setup.py +test-requirements.txt +test/__init__.py +tox.ini diff --git a/samples/client/echo_api/python-pydantic-v1/.openapi-generator/VERSION b/samples/client/echo_api/python-pydantic-v1/.openapi-generator/VERSION new file mode 100644 index 00000000000..40e36364ab2 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/echo_api/python-pydantic-v1/.travis.yml b/samples/client/echo_api/python-pydantic-v1/.travis.yml new file mode 100644 index 00000000000..fd888f75d38 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/.travis.yml @@ -0,0 +1,17 @@ +# ref: https://docs.travis-ci.com/user/languages/python +language: python +python: + - "3.7" + - "3.8" + - "3.9" + - "3.10" + - "3.11" + # uncomment the following if needed + #- "3.11-dev" # 3.11 development branch + #- "nightly" # nightly build +# command to install dependencies +install: + - "pip install -r requirements.txt" + - "pip install -r test-requirements.txt" +# command to run tests +script: pytest --cov=openapi_client diff --git a/samples/client/echo_api/python-pydantic-v1/README.md b/samples/client/echo_api/python-pydantic-v1/README.md new file mode 100644 index 00000000000..22ead776a46 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/README.md @@ -0,0 +1,149 @@ +# openapi-client +Echo Server API + +This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 0.1.0 +- Package version: 1.0.0 +- Build package: org.openapitools.codegen.languages.PythonClientPydanticV1Codegen + +## Requirements. + +Python 3.7+ + +## Installation & Usage +### pip install + +If the python package is hosted on a repository, you can install directly using: + +```sh +pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git +``` +(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`) + +Then import the package: +```python +import openapi_client +``` + +### Setuptools + +Install via [Setuptools](http://pypi.python.org/pypi/setuptools). + +```sh +python setup.py install --user +``` +(or `sudo python setup.py install` to install the package for all users) + +Then import the package: +```python +import openapi_client +``` + +### Tests + +Execute `pytest` to run the tests. + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```python + +import time +import openapi_client +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:3000 +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost:3000" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure HTTP basic authorization: http_auth +configuration = openapi_client.Configuration( + username = os.environ["USERNAME"], + password = os.environ["PASSWORD"] +) + + +# Enter a context with an instance of the API client +with openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = openapi_client.AuthApi(api_client) + + try: + # To test HTTP basic authentication + api_response = api_instance.test_auth_http_basic() + print("The response of AuthApi->test_auth_http_basic:\n") + pprint(api_response) + except ApiException as e: + print("Exception when calling AuthApi->test_auth_http_basic: %s\n" % e) + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost:3000* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AuthApi* | [**test_auth_http_basic**](docs/AuthApi.md#test_auth_http_basic) | **POST** /auth/http/basic | To test HTTP basic authentication +*BodyApi* | [**test_binary_gif**](docs/BodyApi.md#test_binary_gif) | **POST** /binary/gif | Test binary (gif) response body +*BodyApi* | [**test_body_application_octetstream_binary**](docs/BodyApi.md#test_body_application_octetstream_binary) | **POST** /body/application/octetstream/binary | Test body parameter(s) +*BodyApi* | [**test_body_multipart_formdata_array_of_binary**](docs/BodyApi.md#test_body_multipart_formdata_array_of_binary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime +*BodyApi* | [**test_echo_body_free_form_object_response_string**](docs/BodyApi.md#test_echo_body_free_form_object_response_string) | **POST** /echo/body/FreeFormObject/response_string | Test free form object +*BodyApi* | [**test_echo_body_pet**](docs/BodyApi.md#test_echo_body_pet) | **POST** /echo/body/Pet | Test body parameter(s) +*BodyApi* | [**test_echo_body_pet_response_string**](docs/BodyApi.md#test_echo_body_pet_response_string) | **POST** /echo/body/Pet/response_string | Test empty response body +*BodyApi* | [**test_echo_body_tag_response_string**](docs/BodyApi.md#test_echo_body_tag_response_string) | **POST** /echo/body/Tag/response_string | Test empty json (request body) +*FormApi* | [**test_form_integer_boolean_string**](docs/FormApi.md#test_form_integer_boolean_string) | **POST** /form/integer/boolean/string | Test form parameter(s) +*FormApi* | [**test_form_oneof**](docs/FormApi.md#test_form_oneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema +*HeaderApi* | [**test_header_integer_boolean_string**](docs/HeaderApi.md#test_header_integer_boolean_string) | **GET** /header/integer/boolean/string | Test header parameter(s) +*PathApi* | [**tests_path_string_path_string_integer_path_integer**](docs/PathApi.md#tests_path_string_path_string_integer_path_integer) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s) +*QueryApi* | [**test_enum_ref_string**](docs/QueryApi.md#test_enum_ref_string) | **GET** /query/enum_ref_string | Test query parameter(s) +*QueryApi* | [**test_query_datetime_date_string**](docs/QueryApi.md#test_query_datetime_date_string) | **GET** /query/datetime/date/string | Test query parameter(s) +*QueryApi* | [**test_query_integer_boolean_string**](docs/QueryApi.md#test_query_integer_boolean_string) | **GET** /query/integer/boolean/string | Test query parameter(s) +*QueryApi* | [**test_query_style_deep_object_explode_true_object**](docs/QueryApi.md#test_query_style_deep_object_explode_true_object) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s) +*QueryApi* | [**test_query_style_deep_object_explode_true_object_all_of**](docs/QueryApi.md#test_query_style_deep_object_explode_true_object_all_of) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s) +*QueryApi* | [**test_query_style_form_explode_true_array_string**](docs/QueryApi.md#test_query_style_form_explode_true_array_string) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) +*QueryApi* | [**test_query_style_form_explode_true_object**](docs/QueryApi.md#test_query_style_form_explode_true_object) | **GET** /query/style_form/explode_true/object | Test query parameter(s) +*QueryApi* | [**test_query_style_form_explode_true_object_all_of**](docs/QueryApi.md#test_query_style_form_explode_true_object_all_of) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s) + + +## Documentation For Models + + - [Bird](docs/Bird.md) + - [Category](docs/Category.md) + - [DataQuery](docs/DataQuery.md) + - [DefaultValue](docs/DefaultValue.md) + - [NumberPropertiesOnly](docs/NumberPropertiesOnly.md) + - [Pet](docs/Pet.md) + - [Query](docs/Query.md) + - [StringEnumRef](docs/StringEnumRef.md) + - [Tag](docs/Tag.md) + - [TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter](docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md) + - [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) + + + +## Documentation For Authorization + + +Authentication schemes defined for the API: + +### http_auth + +- **Type**: HTTP basic authentication + + +## Author + +team@openapitools.org + + diff --git a/samples/client/echo_api/python-pydantic-v1/docs/AuthApi.md b/samples/client/echo_api/python-pydantic-v1/docs/AuthApi.md new file mode 100644 index 00000000000..98ce834c317 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/docs/AuthApi.md @@ -0,0 +1,82 @@ +# openapi_client.AuthApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**test_auth_http_basic**](AuthApi.md#test_auth_http_basic) | **POST** /auth/http/basic | To test HTTP basic authentication + + +# **test_auth_http_basic** +> str test_auth_http_basic() + +To test HTTP basic authentication + +To test HTTP basic authentication + +### Example + +* Basic Authentication (http_auth): +```python +import time +import os +import openapi_client +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:3000 +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost:3000" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure HTTP basic authorization: http_auth +configuration = openapi_client.Configuration( + username = os.environ["USERNAME"], + password = os.environ["PASSWORD"] +) + +# Enter a context with an instance of the API client +with openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = openapi_client.AuthApi(api_client) + + try: + # To test HTTP basic authentication + api_response = api_instance.test_auth_http_basic() + print("The response of AuthApi->test_auth_http_basic:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AuthApi->test_auth_http_basic: %s\n" % e) +``` + + + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**str** + +### Authorization + +[http_auth](../README.md#http_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/python-pydantic-v1/docs/Bird.md b/samples/client/echo_api/python-pydantic-v1/docs/Bird.md new file mode 100644 index 00000000000..f1ad71c2150 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/docs/Bird.md @@ -0,0 +1,29 @@ +# Bird + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | **str** | | [optional] +**color** | **str** | | [optional] + +## Example + +```python +from openapi_client.models.bird import Bird + +# TODO update the JSON string below +json = "{}" +# create an instance of Bird from a JSON string +bird_instance = Bird.from_json(json) +# print the JSON string representation of the object +print Bird.to_json() + +# convert the object into a dict +bird_dict = bird_instance.to_dict() +# create an instance of Bird from a dict +bird_form_dict = bird.from_dict(bird_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) + + diff --git a/samples/client/echo_api/python-pydantic-v1/docs/BodyApi.md b/samples/client/echo_api/python-pydantic-v1/docs/BodyApi.md new file mode 100644 index 00000000000..553100ffc92 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/docs/BodyApi.md @@ -0,0 +1,476 @@ +# openapi_client.BodyApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**test_binary_gif**](BodyApi.md#test_binary_gif) | **POST** /binary/gif | Test binary (gif) response body +[**test_body_application_octetstream_binary**](BodyApi.md#test_body_application_octetstream_binary) | **POST** /body/application/octetstream/binary | Test body parameter(s) +[**test_body_multipart_formdata_array_of_binary**](BodyApi.md#test_body_multipart_formdata_array_of_binary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime +[**test_echo_body_free_form_object_response_string**](BodyApi.md#test_echo_body_free_form_object_response_string) | **POST** /echo/body/FreeFormObject/response_string | Test free form object +[**test_echo_body_pet**](BodyApi.md#test_echo_body_pet) | **POST** /echo/body/Pet | Test body parameter(s) +[**test_echo_body_pet_response_string**](BodyApi.md#test_echo_body_pet_response_string) | **POST** /echo/body/Pet/response_string | Test empty response body +[**test_echo_body_tag_response_string**](BodyApi.md#test_echo_body_tag_response_string) | **POST** /echo/body/Tag/response_string | Test empty json (request body) + + +# **test_binary_gif** +> bytearray test_binary_gif() + +Test binary (gif) response body + +Test binary (gif) response body + +### Example + +```python +import time +import os +import openapi_client +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:3000 +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost:3000" +) + + +# Enter a context with an instance of the API client +with openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = openapi_client.BodyApi(api_client) + + try: + # Test binary (gif) response body + api_response = api_instance.test_binary_gif() + print("The response of BodyApi->test_binary_gif:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BodyApi->test_binary_gif: %s\n" % e) +``` + + + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**bytearray** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: image/gif + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_body_application_octetstream_binary** +> str test_body_application_octetstream_binary(body=body) + +Test body parameter(s) + +Test body parameter(s) + +### Example + +```python +import time +import os +import openapi_client +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:3000 +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost:3000" +) + + +# Enter a context with an instance of the API client +with openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = openapi_client.BodyApi(api_client) + body = None # bytearray | (optional) + + try: + # Test body parameter(s) + api_response = api_instance.test_body_application_octetstream_binary(body=body) + print("The response of BodyApi->test_body_application_octetstream_binary:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BodyApi->test_body_application_octetstream_binary: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **bytearray**| | [optional] + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/octet-stream + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_body_multipart_formdata_array_of_binary** +> str test_body_multipart_formdata_array_of_binary(files) + +Test array of binary in multipart mime + +Test array of binary in multipart mime + +### Example + +```python +import time +import os +import openapi_client +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:3000 +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost:3000" +) + + +# Enter a context with an instance of the API client +with openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = openapi_client.BodyApi(api_client) + files = None # List[bytearray] | + + try: + # Test array of binary in multipart mime + api_response = api_instance.test_body_multipart_formdata_array_of_binary(files) + print("The response of BodyApi->test_body_multipart_formdata_array_of_binary:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BodyApi->test_body_multipart_formdata_array_of_binary: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **files** | **List[bytearray]**| | + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_echo_body_free_form_object_response_string** +> str test_echo_body_free_form_object_response_string(body=body) + +Test free form object + +Test free form object + +### Example + +```python +import time +import os +import openapi_client +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:3000 +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost:3000" +) + + +# Enter a context with an instance of the API client +with openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = openapi_client.BodyApi(api_client) + body = None # object | Free form object (optional) + + try: + # Test free form object + api_response = api_instance.test_echo_body_free_form_object_response_string(body=body) + print("The response of BodyApi->test_echo_body_free_form_object_response_string:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BodyApi->test_echo_body_free_form_object_response_string: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **object**| Free form object | [optional] + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_echo_body_pet** +> Pet test_echo_body_pet(pet=pet) + +Test body parameter(s) + +Test body parameter(s) + +### Example + +```python +import time +import os +import openapi_client +from openapi_client.models.pet import Pet +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:3000 +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost:3000" +) + + +# Enter a context with an instance of the API client +with openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = openapi_client.BodyApi(api_client) + pet = openapi_client.Pet() # Pet | Pet object that needs to be added to the store (optional) + + try: + # Test body parameter(s) + api_response = api_instance.test_echo_body_pet(pet=pet) + print("The response of BodyApi->test_echo_body_pet:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BodyApi->test_echo_body_pet: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_echo_body_pet_response_string** +> str test_echo_body_pet_response_string(pet=pet) + +Test empty response body + +Test empty response body + +### Example + +```python +import time +import os +import openapi_client +from openapi_client.models.pet import Pet +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:3000 +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost:3000" +) + + +# Enter a context with an instance of the API client +with openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = openapi_client.BodyApi(api_client) + pet = openapi_client.Pet() # Pet | Pet object that needs to be added to the store (optional) + + try: + # Test empty response body + api_response = api_instance.test_echo_body_pet_response_string(pet=pet) + print("The response of BodyApi->test_echo_body_pet_response_string:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BodyApi->test_echo_body_pet_response_string: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_echo_body_tag_response_string** +> str test_echo_body_tag_response_string(tag=tag) + +Test empty json (request body) + +Test empty json (request body) + +### Example + +```python +import time +import os +import openapi_client +from openapi_client.models.tag import Tag +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:3000 +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost:3000" +) + + +# Enter a context with an instance of the API client +with openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = openapi_client.BodyApi(api_client) + tag = openapi_client.Tag() # Tag | Tag object (optional) + + try: + # Test empty json (request body) + api_response = api_instance.test_echo_body_tag_response_string(tag=tag) + print("The response of BodyApi->test_echo_body_tag_response_string:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BodyApi->test_echo_body_tag_response_string: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tag** | [**Tag**](Tag.md)| Tag object | [optional] + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/python-pydantic-v1/docs/Category.md b/samples/client/echo_api/python-pydantic-v1/docs/Category.md new file mode 100644 index 00000000000..bf23e3b044d --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/docs/Category.md @@ -0,0 +1,29 @@ +# Category + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **str** | | [optional] + +## Example + +```python +from openapi_client.models.category import Category + +# TODO update the JSON string below +json = "{}" +# create an instance of Category from a JSON string +category_instance = Category.from_json(json) +# print the JSON string representation of the object +print Category.to_json() + +# convert the object into a dict +category_dict = category_instance.to_dict() +# create an instance of Category from a dict +category_form_dict = category.from_dict(category_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) + + diff --git a/samples/client/echo_api/python-pydantic-v1/docs/DataQuery.md b/samples/client/echo_api/python-pydantic-v1/docs/DataQuery.md new file mode 100644 index 00000000000..bac43a6cc70 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/docs/DataQuery.md @@ -0,0 +1,30 @@ +# DataQuery + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**suffix** | **str** | test suffix | [optional] +**text** | **str** | Some text containing white spaces | [optional] +**var_date** | **datetime** | A date | [optional] + +## Example + +```python +from openapi_client.models.data_query import DataQuery + +# TODO update the JSON string below +json = "{}" +# create an instance of DataQuery from a JSON string +data_query_instance = DataQuery.from_json(json) +# print the JSON string representation of the object +print DataQuery.to_json() + +# convert the object into a dict +data_query_dict = data_query_instance.to_dict() +# create an instance of DataQuery from a dict +data_query_form_dict = data_query.from_dict(data_query_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) + + diff --git a/samples/client/echo_api/python-pydantic-v1/docs/DefaultValue.md b/samples/client/echo_api/python-pydantic-v1/docs/DefaultValue.md new file mode 100644 index 00000000000..fcdbebf0e0a --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/docs/DefaultValue.md @@ -0,0 +1,36 @@ +# DefaultValue + +to test the default value of properties + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**array_string_enum_ref_default** | [**List[StringEnumRef]**](StringEnumRef.md) | | [optional] [default to ["success","failure"]] +**array_string_enum_default** | **List[str]** | | [optional] [default to ["success","failure"]] +**array_string_default** | **List[str]** | | [optional] [default to ["failure","skipped"]] +**array_integer_default** | **List[int]** | | [optional] [default to [1,3]] +**array_string** | **List[str]** | | [optional] +**array_string_nullable** | **List[str]** | | [optional] +**array_string_extension_nullable** | **List[str]** | | [optional] +**string_nullable** | **str** | | [optional] + +## Example + +```python +from openapi_client.models.default_value import DefaultValue + +# TODO update the JSON string below +json = "{}" +# create an instance of DefaultValue from a JSON string +default_value_instance = DefaultValue.from_json(json) +# print the JSON string representation of the object +print DefaultValue.to_json() + +# convert the object into a dict +default_value_dict = default_value_instance.to_dict() +# create an instance of DefaultValue from a dict +default_value_form_dict = default_value.from_dict(default_value_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) + + diff --git a/samples/client/echo_api/python-pydantic-v1/docs/FormApi.md b/samples/client/echo_api/python-pydantic-v1/docs/FormApi.md new file mode 100644 index 00000000000..c823e4b82ae --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/docs/FormApi.md @@ -0,0 +1,156 @@ +# openapi_client.FormApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**test_form_integer_boolean_string**](FormApi.md#test_form_integer_boolean_string) | **POST** /form/integer/boolean/string | Test form parameter(s) +[**test_form_oneof**](FormApi.md#test_form_oneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema + + +# **test_form_integer_boolean_string** +> str test_form_integer_boolean_string(integer_form=integer_form, boolean_form=boolean_form, string_form=string_form) + +Test form parameter(s) + +Test form parameter(s) + +### Example + +```python +import time +import os +import openapi_client +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:3000 +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost:3000" +) + + +# Enter a context with an instance of the API client +with openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = openapi_client.FormApi(api_client) + integer_form = 56 # int | (optional) + boolean_form = True # bool | (optional) + string_form = 'string_form_example' # str | (optional) + + try: + # Test form parameter(s) + api_response = api_instance.test_form_integer_boolean_string(integer_form=integer_form, boolean_form=boolean_form, string_form=string_form) + print("The response of FormApi->test_form_integer_boolean_string:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FormApi->test_form_integer_boolean_string: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **integer_form** | **int**| | [optional] + **boolean_form** | **bool**| | [optional] + **string_form** | **str**| | [optional] + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_form_oneof** +> str test_form_oneof(form1=form1, form2=form2, form3=form3, form4=form4, id=id, name=name) + +Test form parameter(s) for oneOf schema + +Test form parameter(s) for oneOf schema + +### Example + +```python +import time +import os +import openapi_client +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:3000 +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost:3000" +) + + +# Enter a context with an instance of the API client +with openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = openapi_client.FormApi(api_client) + form1 = 'form1_example' # str | (optional) + form2 = 56 # int | (optional) + form3 = 'form3_example' # str | (optional) + form4 = True # bool | (optional) + id = 56 # int | (optional) + name = 'name_example' # str | (optional) + + try: + # Test form parameter(s) for oneOf schema + api_response = api_instance.test_form_oneof(form1=form1, form2=form2, form3=form3, form4=form4, id=id, name=name) + print("The response of FormApi->test_form_oneof:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FormApi->test_form_oneof: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **form1** | **str**| | [optional] + **form2** | **int**| | [optional] + **form3** | **str**| | [optional] + **form4** | **bool**| | [optional] + **id** | **int**| | [optional] + **name** | **str**| | [optional] + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/python-pydantic-v1/docs/HeaderApi.md b/samples/client/echo_api/python-pydantic-v1/docs/HeaderApi.md new file mode 100644 index 00000000000..740eb149074 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/docs/HeaderApi.md @@ -0,0 +1,79 @@ +# openapi_client.HeaderApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**test_header_integer_boolean_string**](HeaderApi.md#test_header_integer_boolean_string) | **GET** /header/integer/boolean/string | Test header parameter(s) + + +# **test_header_integer_boolean_string** +> str test_header_integer_boolean_string(integer_header=integer_header, boolean_header=boolean_header, string_header=string_header) + +Test header parameter(s) + +Test header parameter(s) + +### Example + +```python +import time +import os +import openapi_client +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:3000 +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost:3000" +) + + +# Enter a context with an instance of the API client +with openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = openapi_client.HeaderApi(api_client) + integer_header = 56 # int | (optional) + boolean_header = True # bool | (optional) + string_header = 'string_header_example' # str | (optional) + + try: + # Test header parameter(s) + api_response = api_instance.test_header_integer_boolean_string(integer_header=integer_header, boolean_header=boolean_header, string_header=string_header) + print("The response of HeaderApi->test_header_integer_boolean_string:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling HeaderApi->test_header_integer_boolean_string: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **integer_header** | **int**| | [optional] + **boolean_header** | **bool**| | [optional] + **string_header** | **str**| | [optional] + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/python-pydantic-v1/docs/NumberPropertiesOnly.md b/samples/client/echo_api/python-pydantic-v1/docs/NumberPropertiesOnly.md new file mode 100644 index 00000000000..e35fad694e7 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/docs/NumberPropertiesOnly.md @@ -0,0 +1,30 @@ +# NumberPropertiesOnly + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**number** | **float** | | [optional] +**float** | **float** | | [optional] +**double** | **float** | | [optional] + +## Example + +```python +from openapi_client.models.number_properties_only import NumberPropertiesOnly + +# TODO update the JSON string below +json = "{}" +# create an instance of NumberPropertiesOnly from a JSON string +number_properties_only_instance = NumberPropertiesOnly.from_json(json) +# print the JSON string representation of the object +print NumberPropertiesOnly.to_json() + +# convert the object into a dict +number_properties_only_dict = number_properties_only_instance.to_dict() +# create an instance of NumberPropertiesOnly from a dict +number_properties_only_form_dict = number_properties_only.from_dict(number_properties_only_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) + + diff --git a/samples/client/echo_api/python-pydantic-v1/docs/PathApi.md b/samples/client/echo_api/python-pydantic-v1/docs/PathApi.md new file mode 100644 index 00000000000..122a0c33c71 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/docs/PathApi.md @@ -0,0 +1,77 @@ +# openapi_client.PathApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**tests_path_string_path_string_integer_path_integer**](PathApi.md#tests_path_string_path_string_integer_path_integer) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s) + + +# **tests_path_string_path_string_integer_path_integer** +> str tests_path_string_path_string_integer_path_integer(path_string, path_integer) + +Test path parameter(s) + +Test path parameter(s) + +### Example + +```python +import time +import os +import openapi_client +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:3000 +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost:3000" +) + + +# Enter a context with an instance of the API client +with openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = openapi_client.PathApi(api_client) + path_string = 'path_string_example' # str | + path_integer = 56 # int | + + try: + # Test path parameter(s) + api_response = api_instance.tests_path_string_path_string_integer_path_integer(path_string, path_integer) + print("The response of PathApi->tests_path_string_path_string_integer_path_integer:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PathApi->tests_path_string_path_string_integer_path_integer: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **path_string** | **str**| | + **path_integer** | **int**| | + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/python-pydantic-v1/docs/Pet.md b/samples/client/echo_api/python-pydantic-v1/docs/Pet.md new file mode 100644 index 00000000000..bd578ba9a50 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/docs/Pet.md @@ -0,0 +1,33 @@ +# Pet + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **str** | | +**category** | [**Category**](Category.md) | | [optional] +**photo_urls** | **List[str]** | | +**tags** | [**List[Tag]**](Tag.md) | | [optional] +**status** | **str** | pet status in the store | [optional] + +## Example + +```python +from openapi_client.models.pet import Pet + +# TODO update the JSON string below +json = "{}" +# create an instance of Pet from a JSON string +pet_instance = Pet.from_json(json) +# print the JSON string representation of the object +print Pet.to_json() + +# convert the object into a dict +pet_dict = pet_instance.to_dict() +# create an instance of Pet from a dict +pet_form_dict = pet.from_dict(pet_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) + + diff --git a/samples/client/echo_api/python-pydantic-v1/docs/Query.md b/samples/client/echo_api/python-pydantic-v1/docs/Query.md new file mode 100644 index 00000000000..8a346212089 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/docs/Query.md @@ -0,0 +1,29 @@ +# Query + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | Query | [optional] +**outcomes** | **List[str]** | | [optional] [default to ["SUCCESS","FAILURE"]] + +## Example + +```python +from openapi_client.models.query import Query + +# TODO update the JSON string below +json = "{}" +# create an instance of Query from a JSON string +query_instance = Query.from_json(json) +# print the JSON string representation of the object +print Query.to_json() + +# convert the object into a dict +query_dict = query_instance.to_dict() +# create an instance of Query from a dict +query_form_dict = query.from_dict(query_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) + + diff --git a/samples/client/echo_api/python-pydantic-v1/docs/QueryApi.md b/samples/client/echo_api/python-pydantic-v1/docs/QueryApi.md new file mode 100644 index 00000000000..11c486b7382 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/docs/QueryApi.md @@ -0,0 +1,556 @@ +# openapi_client.QueryApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**test_enum_ref_string**](QueryApi.md#test_enum_ref_string) | **GET** /query/enum_ref_string | Test query parameter(s) +[**test_query_datetime_date_string**](QueryApi.md#test_query_datetime_date_string) | **GET** /query/datetime/date/string | Test query parameter(s) +[**test_query_integer_boolean_string**](QueryApi.md#test_query_integer_boolean_string) | **GET** /query/integer/boolean/string | Test query parameter(s) +[**test_query_style_deep_object_explode_true_object**](QueryApi.md#test_query_style_deep_object_explode_true_object) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s) +[**test_query_style_deep_object_explode_true_object_all_of**](QueryApi.md#test_query_style_deep_object_explode_true_object_all_of) | **GET** /query/style_deepObject/explode_true/object/allOf | Test query parameter(s) +[**test_query_style_form_explode_true_array_string**](QueryApi.md#test_query_style_form_explode_true_array_string) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) +[**test_query_style_form_explode_true_object**](QueryApi.md#test_query_style_form_explode_true_object) | **GET** /query/style_form/explode_true/object | Test query parameter(s) +[**test_query_style_form_explode_true_object_all_of**](QueryApi.md#test_query_style_form_explode_true_object_all_of) | **GET** /query/style_form/explode_true/object/allOf | Test query parameter(s) + + +# **test_enum_ref_string** +> str test_enum_ref_string(enum_ref_string_query=enum_ref_string_query) + +Test query parameter(s) + +Test query parameter(s) + +### Example + +```python +import time +import os +import openapi_client +from openapi_client.models.string_enum_ref import StringEnumRef +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:3000 +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost:3000" +) + + +# Enter a context with an instance of the API client +with openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = openapi_client.QueryApi(api_client) + enum_ref_string_query = openapi_client.StringEnumRef() # StringEnumRef | (optional) + + try: + # Test query parameter(s) + api_response = api_instance.test_enum_ref_string(enum_ref_string_query=enum_ref_string_query) + print("The response of QueryApi->test_enum_ref_string:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling QueryApi->test_enum_ref_string: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enum_ref_string_query** | [**StringEnumRef**](.md)| | [optional] + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_query_datetime_date_string** +> str test_query_datetime_date_string(datetime_query=datetime_query, date_query=date_query, string_query=string_query) + +Test query parameter(s) + +Test query parameter(s) + +### Example + +```python +import time +import os +import openapi_client +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:3000 +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost:3000" +) + + +# Enter a context with an instance of the API client +with openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = openapi_client.QueryApi(api_client) + datetime_query = '2013-10-20T19:20:30+01:00' # datetime | (optional) + date_query = '2013-10-20' # date | (optional) + string_query = 'string_query_example' # str | (optional) + + try: + # Test query parameter(s) + api_response = api_instance.test_query_datetime_date_string(datetime_query=datetime_query, date_query=date_query, string_query=string_query) + print("The response of QueryApi->test_query_datetime_date_string:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling QueryApi->test_query_datetime_date_string: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **datetime_query** | **datetime**| | [optional] + **date_query** | **date**| | [optional] + **string_query** | **str**| | [optional] + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_query_integer_boolean_string** +> str test_query_integer_boolean_string(integer_query=integer_query, boolean_query=boolean_query, string_query=string_query) + +Test query parameter(s) + +Test query parameter(s) + +### Example + +```python +import time +import os +import openapi_client +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:3000 +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost:3000" +) + + +# Enter a context with an instance of the API client +with openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = openapi_client.QueryApi(api_client) + integer_query = 56 # int | (optional) + boolean_query = True # bool | (optional) + string_query = 'string_query_example' # str | (optional) + + try: + # Test query parameter(s) + api_response = api_instance.test_query_integer_boolean_string(integer_query=integer_query, boolean_query=boolean_query, string_query=string_query) + print("The response of QueryApi->test_query_integer_boolean_string:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling QueryApi->test_query_integer_boolean_string: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **integer_query** | **int**| | [optional] + **boolean_query** | **bool**| | [optional] + **string_query** | **str**| | [optional] + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_query_style_deep_object_explode_true_object** +> str test_query_style_deep_object_explode_true_object(query_object=query_object) + +Test query parameter(s) + +Test query parameter(s) + +### Example + +```python +import time +import os +import openapi_client +from openapi_client.models.pet import Pet +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:3000 +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost:3000" +) + + +# Enter a context with an instance of the API client +with openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = openapi_client.QueryApi(api_client) + query_object = openapi_client.Pet() # Pet | (optional) + + try: + # Test query parameter(s) + api_response = api_instance.test_query_style_deep_object_explode_true_object(query_object=query_object) + print("The response of QueryApi->test_query_style_deep_object_explode_true_object:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling QueryApi->test_query_style_deep_object_explode_true_object: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query_object** | [**Pet**](.md)| | [optional] + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_query_style_deep_object_explode_true_object_all_of** +> str test_query_style_deep_object_explode_true_object_all_of(query_object=query_object) + +Test query parameter(s) + +Test query parameter(s) + +### Example + +```python +import time +import os +import openapi_client +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:3000 +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost:3000" +) + + +# Enter a context with an instance of the API client +with openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = openapi_client.QueryApi(api_client) + query_object = openapi_client.TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter() # TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter | (optional) + + try: + # Test query parameter(s) + api_response = api_instance.test_query_style_deep_object_explode_true_object_all_of(query_object=query_object) + print("The response of QueryApi->test_query_style_deep_object_explode_true_object_all_of:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling QueryApi->test_query_style_deep_object_explode_true_object_all_of: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query_object** | [**TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter**](.md)| | [optional] + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_query_style_form_explode_true_array_string** +> str test_query_style_form_explode_true_array_string(query_object=query_object) + +Test query parameter(s) + +Test query parameter(s) + +### Example + +```python +import time +import os +import openapi_client +from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:3000 +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost:3000" +) + + +# Enter a context with an instance of the API client +with openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = openapi_client.QueryApi(api_client) + query_object = openapi_client.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() # TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter | (optional) + + try: + # Test query parameter(s) + api_response = api_instance.test_query_style_form_explode_true_array_string(query_object=query_object) + print("The response of QueryApi->test_query_style_form_explode_true_array_string:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling QueryApi->test_query_style_form_explode_true_array_string: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query_object** | [**TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter**](.md)| | [optional] + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_query_style_form_explode_true_object** +> str test_query_style_form_explode_true_object(query_object=query_object) + +Test query parameter(s) + +Test query parameter(s) + +### Example + +```python +import time +import os +import openapi_client +from openapi_client.models.pet import Pet +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:3000 +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost:3000" +) + + +# Enter a context with an instance of the API client +with openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = openapi_client.QueryApi(api_client) + query_object = openapi_client.Pet() # Pet | (optional) + + try: + # Test query parameter(s) + api_response = api_instance.test_query_style_form_explode_true_object(query_object=query_object) + print("The response of QueryApi->test_query_style_form_explode_true_object:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling QueryApi->test_query_style_form_explode_true_object: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query_object** | [**Pet**](.md)| | [optional] + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_query_style_form_explode_true_object_all_of** +> str test_query_style_form_explode_true_object_all_of(query_object=query_object) + +Test query parameter(s) + +Test query parameter(s) + +### Example + +```python +import time +import os +import openapi_client +from openapi_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:3000 +# See configuration.py for a list of all supported configuration parameters. +configuration = openapi_client.Configuration( + host = "http://localhost:3000" +) + + +# Enter a context with an instance of the API client +with openapi_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = openapi_client.QueryApi(api_client) + query_object = openapi_client.DataQuery() # DataQuery | (optional) + + try: + # Test query parameter(s) + api_response = api_instance.test_query_style_form_explode_true_object_all_of(query_object=query_object) + print("The response of QueryApi->test_query_style_form_explode_true_object_all_of:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling QueryApi->test_query_style_form_explode_true_object_all_of: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query_object** | [**DataQuery**](.md)| | [optional] + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/echo_api/python-pydantic-v1/docs/StringEnumRef.md b/samples/client/echo_api/python-pydantic-v1/docs/StringEnumRef.md new file mode 100644 index 00000000000..f59594fb861 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/docs/StringEnumRef.md @@ -0,0 +1,10 @@ +# StringEnumRef + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/echo_api/python-pydantic-v1/docs/Tag.md b/samples/client/echo_api/python-pydantic-v1/docs/Tag.md new file mode 100644 index 00000000000..febb268b144 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/docs/Tag.md @@ -0,0 +1,29 @@ +# Tag + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **str** | | [optional] + +## Example + +```python +from openapi_client.models.tag import Tag + +# TODO update the JSON string below +json = "{}" +# create an instance of Tag from a JSON string +tag_instance = Tag.from_json(json) +# print the JSON string representation of the object +print Tag.to_json() + +# convert the object into a dict +tag_dict = tag_instance.to_dict() +# create an instance of Tag from a dict +tag_form_dict = tag.from_dict(tag_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) + + diff --git a/samples/client/echo_api/python-pydantic-v1/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md b/samples/client/echo_api/python-pydantic-v1/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md new file mode 100644 index 00000000000..3b0a87b71c5 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md @@ -0,0 +1,31 @@ +# TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | **str** | | [optional] +**color** | **str** | | [optional] +**id** | **int** | | [optional] +**name** | **str** | | [optional] + +## Example + +```python +from openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter import TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + +# TODO update the JSON string below +json = "{}" +# create an instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter from a JSON string +test_query_style_deep_object_explode_true_object_all_of_query_object_parameter_instance = TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.from_json(json) +# print the JSON string representation of the object +print TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.to_json() + +# convert the object into a dict +test_query_style_deep_object_explode_true_object_all_of_query_object_parameter_dict = test_query_style_deep_object_explode_true_object_all_of_query_object_parameter_instance.to_dict() +# create an instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter from a dict +test_query_style_deep_object_explode_true_object_all_of_query_object_parameter_form_dict = test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.from_dict(test_query_style_deep_object_explode_true_object_all_of_query_object_parameter_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) + + diff --git a/samples/client/echo_api/python-pydantic-v1/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md b/samples/client/echo_api/python-pydantic-v1/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md new file mode 100644 index 00000000000..c741b723f00 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md @@ -0,0 +1,28 @@ +# TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**values** | **List[str]** | | [optional] + +## Example + +```python +from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + +# TODO update the JSON string below +json = "{}" +# create an instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter from a JSON string +test_query_style_form_explode_true_array_string_query_object_parameter_instance = TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.from_json(json) +# print the JSON string representation of the object +print TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.to_json() + +# convert the object into a dict +test_query_style_form_explode_true_array_string_query_object_parameter_dict = test_query_style_form_explode_true_array_string_query_object_parameter_instance.to_dict() +# create an instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter from a dict +test_query_style_form_explode_true_array_string_query_object_parameter_form_dict = test_query_style_form_explode_true_array_string_query_object_parameter.from_dict(test_query_style_form_explode_true_array_string_query_object_parameter_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) + + diff --git a/samples/client/echo_api/python-pydantic-v1/git_push.sh b/samples/client/echo_api/python-pydantic-v1/git_push.sh new file mode 100644 index 00000000000..f53a75d4fab --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/__init__.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/__init__.py new file mode 100644 index 00000000000..7b67f7c597f --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/__init__.py @@ -0,0 +1,50 @@ +# coding: utf-8 + +# flake8: noqa + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +__version__ = "1.0.0" + +# import apis into sdk package +from openapi_client.api.auth_api import AuthApi +from openapi_client.api.body_api import BodyApi +from openapi_client.api.form_api import FormApi +from openapi_client.api.header_api import HeaderApi +from openapi_client.api.path_api import PathApi +from openapi_client.api.query_api import QueryApi + +# import ApiClient +from openapi_client.api_response import ApiResponse +from openapi_client.api_client import ApiClient +from openapi_client.configuration import Configuration +from openapi_client.exceptions import OpenApiException +from openapi_client.exceptions import ApiTypeError +from openapi_client.exceptions import ApiValueError +from openapi_client.exceptions import ApiKeyError +from openapi_client.exceptions import ApiAttributeError +from openapi_client.exceptions import ApiException + +# import models into sdk package +from openapi_client.models.bird import Bird +from openapi_client.models.category import Category +from openapi_client.models.data_query import DataQuery +from openapi_client.models.default_value import DefaultValue +from openapi_client.models.number_properties_only import NumberPropertiesOnly +from openapi_client.models.pet import Pet +from openapi_client.models.query import Query +from openapi_client.models.string_enum_ref import StringEnumRef +from openapi_client.models.tag import Tag +from openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter import TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter +from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/api/__init__.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/api/__init__.py new file mode 100644 index 00000000000..9c9ae790c3b --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/api/__init__.py @@ -0,0 +1,10 @@ +# flake8: noqa + +# import apis into api package +from openapi_client.api.auth_api import AuthApi +from openapi_client.api.body_api import BodyApi +from openapi_client.api.form_api import FormApi +from openapi_client.api.header_api import HeaderApi +from openapi_client.api.path_api import PathApi +from openapi_client.api.query_api import QueryApi + diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/api/auth_api.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/api/auth_api.py new file mode 100644 index 00000000000..16ee7463aad --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/api/auth_api.py @@ -0,0 +1,173 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import re # noqa: F401 +import io +import warnings + +from pydantic import validate_arguments, ValidationError + + +from openapi_client.api_client import ApiClient +from openapi_client.api_response import ApiResponse +from openapi_client.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class AuthApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_arguments + def test_auth_http_basic(self, **kwargs) -> str: # noqa: E501 + """To test HTTP basic authentication # noqa: E501 + + To test HTTP basic authentication # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_auth_http_basic(async_req=True) + >>> result = thread.get() + + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_auth_http_basic_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_auth_http_basic_with_http_info(**kwargs) # noqa: E501 + + @validate_arguments + def test_auth_http_basic_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 + """To test HTTP basic authentication # noqa: E501 + + To test HTTP basic authentication # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_auth_http_basic_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_auth_http_basic" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['text/plain']) # noqa: E501 + + # authentication setting + _auth_settings = ['http_auth'] # noqa: E501 + + _response_types_map = { + '200': "str", + } + + return self.api_client.call_api( + '/auth/http/basic', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/api/body_api.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/api/body_api.py new file mode 100644 index 00000000000..ebb8111b772 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/api/body_api.py @@ -0,0 +1,1068 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import re # noqa: F401 +import io +import warnings + +from pydantic import validate_arguments, ValidationError + +from typing_extensions import Annotated +from pydantic import Field, StrictBytes, StrictStr, conlist + +from typing import Any, Dict, Optional, Union + +from openapi_client.models.pet import Pet +from openapi_client.models.tag import Tag + +from openapi_client.api_client import ApiClient +from openapi_client.api_response import ApiResponse +from openapi_client.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class BodyApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_arguments + def test_binary_gif(self, **kwargs) -> bytearray: # noqa: E501 + """Test binary (gif) response body # noqa: E501 + + Test binary (gif) response body # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_binary_gif(async_req=True) + >>> result = thread.get() + + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: bytearray + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_binary_gif_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_binary_gif_with_http_info(**kwargs) # noqa: E501 + + @validate_arguments + def test_binary_gif_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 + """Test binary (gif) response body # noqa: E501 + + Test binary (gif) response body # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_binary_gif_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(bytearray, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_binary_gif" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['image/gif']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "bytearray", + } + + return self.api_client.call_api( + '/binary/gif', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_body_application_octetstream_binary(self, body : Optional[Union[StrictBytes, StrictStr]] = None, **kwargs) -> str: # noqa: E501 + """Test body parameter(s) # noqa: E501 + + Test body parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_body_application_octetstream_binary(body, async_req=True) + >>> result = thread.get() + + :param body: + :type body: bytearray + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_body_application_octetstream_binary_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_body_application_octetstream_binary_with_http_info(body, **kwargs) # noqa: E501 + + @validate_arguments + def test_body_application_octetstream_binary_with_http_info(self, body : Optional[Union[StrictBytes, StrictStr]] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Test body parameter(s) # noqa: E501 + + Test body parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_body_application_octetstream_binary_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param body: + :type body: bytearray + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'body' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_body_application_octetstream_binary" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['body'] is not None: + _body_params = _params['body'] + # convert to byte array if the input is a file name (str) + if isinstance(_body_params, str): + with io.open(_body_params, "rb") as _fp: + _body_params_from_file = _fp.read() + _body_params = _body_params_from_file + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['text/plain']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/octet-stream'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "str", + } + + return self.api_client.call_api( + '/body/application/octetstream/binary', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_body_multipart_formdata_array_of_binary(self, files : conlist(Union[StrictBytes, StrictStr]), **kwargs) -> str: # noqa: E501 + """Test array of binary in multipart mime # noqa: E501 + + Test array of binary in multipart mime # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_body_multipart_formdata_array_of_binary(files, async_req=True) + >>> result = thread.get() + + :param files: (required) + :type files: List[bytearray] + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_body_multipart_formdata_array_of_binary_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_body_multipart_formdata_array_of_binary_with_http_info(files, **kwargs) # noqa: E501 + + @validate_arguments + def test_body_multipart_formdata_array_of_binary_with_http_info(self, files : conlist(Union[StrictBytes, StrictStr]), **kwargs) -> ApiResponse: # noqa: E501 + """Test array of binary in multipart mime # noqa: E501 + + Test array of binary in multipart mime # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_body_multipart_formdata_array_of_binary_with_http_info(files, async_req=True) + >>> result = thread.get() + + :param files: (required) + :type files: List[bytearray] + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'files' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_body_multipart_formdata_array_of_binary" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + if _params['files'] is not None: + _files['files'] = _params['files'] + _collection_formats['files'] = 'csv' + + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['text/plain']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['multipart/form-data'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "str", + } + + return self.api_client.call_api( + '/body/application/octetstream/array_of_binary', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_echo_body_free_form_object_response_string(self, body : Annotated[Optional[Dict[str, Any]], Field(description="Free form object")] = None, **kwargs) -> str: # noqa: E501 + """Test free form object # noqa: E501 + + Test free form object # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_echo_body_free_form_object_response_string(body, async_req=True) + >>> result = thread.get() + + :param body: Free form object + :type body: object + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_echo_body_free_form_object_response_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_echo_body_free_form_object_response_string_with_http_info(body, **kwargs) # noqa: E501 + + @validate_arguments + def test_echo_body_free_form_object_response_string_with_http_info(self, body : Annotated[Optional[Dict[str, Any]], Field(description="Free form object")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Test free form object # noqa: E501 + + Test free form object # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_echo_body_free_form_object_response_string_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param body: Free form object + :type body: object + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'body' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_echo_body_free_form_object_response_string" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['body'] is not None: + _body_params = _params['body'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['text/plain']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "str", + } + + return self.api_client.call_api( + '/echo/body/FreeFormObject/response_string', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_echo_body_pet(self, pet : Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None, **kwargs) -> Pet: # noqa: E501 + """Test body parameter(s) # noqa: E501 + + Test body parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_echo_body_pet(pet, async_req=True) + >>> result = thread.get() + + :param pet: Pet object that needs to be added to the store + :type pet: Pet + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: Pet + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_echo_body_pet_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_echo_body_pet_with_http_info(pet, **kwargs) # noqa: E501 + + @validate_arguments + def test_echo_body_pet_with_http_info(self, pet : Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Test body parameter(s) # noqa: E501 + + Test body parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_echo_body_pet_with_http_info(pet, async_req=True) + >>> result = thread.get() + + :param pet: Pet object that needs to be added to the store + :type pet: Pet + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(Pet, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'pet' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_echo_body_pet" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['pet'] is not None: + _body_params = _params['pet'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "Pet", + } + + return self.api_client.call_api( + '/echo/body/Pet', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_echo_body_pet_response_string(self, pet : Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None, **kwargs) -> str: # noqa: E501 + """Test empty response body # noqa: E501 + + Test empty response body # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_echo_body_pet_response_string(pet, async_req=True) + >>> result = thread.get() + + :param pet: Pet object that needs to be added to the store + :type pet: Pet + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_echo_body_pet_response_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_echo_body_pet_response_string_with_http_info(pet, **kwargs) # noqa: E501 + + @validate_arguments + def test_echo_body_pet_response_string_with_http_info(self, pet : Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Test empty response body # noqa: E501 + + Test empty response body # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_echo_body_pet_response_string_with_http_info(pet, async_req=True) + >>> result = thread.get() + + :param pet: Pet object that needs to be added to the store + :type pet: Pet + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'pet' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_echo_body_pet_response_string" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['pet'] is not None: + _body_params = _params['pet'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['text/plain']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "str", + } + + return self.api_client.call_api( + '/echo/body/Pet/response_string', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_echo_body_tag_response_string(self, tag : Annotated[Optional[Tag], Field(description="Tag object")] = None, **kwargs) -> str: # noqa: E501 + """Test empty json (request body) # noqa: E501 + + Test empty json (request body) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_echo_body_tag_response_string(tag, async_req=True) + >>> result = thread.get() + + :param tag: Tag object + :type tag: Tag + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_echo_body_tag_response_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_echo_body_tag_response_string_with_http_info(tag, **kwargs) # noqa: E501 + + @validate_arguments + def test_echo_body_tag_response_string_with_http_info(self, tag : Annotated[Optional[Tag], Field(description="Tag object")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Test empty json (request body) # noqa: E501 + + Test empty json (request body) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_echo_body_tag_response_string_with_http_info(tag, async_req=True) + >>> result = thread.get() + + :param tag: Tag object + :type tag: Tag + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'tag' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_echo_body_tag_response_string" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['tag'] is not None: + _body_params = _params['tag'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['text/plain']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "str", + } + + return self.api_client.call_api( + '/echo/body/Tag/response_string', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/api/form_api.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/api/form_api.py new file mode 100644 index 00000000000..7b0f9720c6c --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/api/form_api.py @@ -0,0 +1,395 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import re # noqa: F401 +import io +import warnings + +from pydantic import validate_arguments, ValidationError + +from pydantic import StrictBool, StrictInt, StrictStr + +from typing import Optional + + +from openapi_client.api_client import ApiClient +from openapi_client.api_response import ApiResponse +from openapi_client.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class FormApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_arguments + def test_form_integer_boolean_string(self, integer_form : Optional[StrictInt] = None, boolean_form : Optional[StrictBool] = None, string_form : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501 + """Test form parameter(s) # noqa: E501 + + Test form parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_form_integer_boolean_string(integer_form, boolean_form, string_form, async_req=True) + >>> result = thread.get() + + :param integer_form: + :type integer_form: int + :param boolean_form: + :type boolean_form: bool + :param string_form: + :type string_form: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_form_integer_boolean_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_form_integer_boolean_string_with_http_info(integer_form, boolean_form, string_form, **kwargs) # noqa: E501 + + @validate_arguments + def test_form_integer_boolean_string_with_http_info(self, integer_form : Optional[StrictInt] = None, boolean_form : Optional[StrictBool] = None, string_form : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Test form parameter(s) # noqa: E501 + + Test form parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_form_integer_boolean_string_with_http_info(integer_form, boolean_form, string_form, async_req=True) + >>> result = thread.get() + + :param integer_form: + :type integer_form: int + :param boolean_form: + :type boolean_form: bool + :param string_form: + :type string_form: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'integer_form', + 'boolean_form', + 'string_form' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_form_integer_boolean_string" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + if _params['integer_form'] is not None: + _form_params.append(('integer_form', _params['integer_form'])) + + if _params['boolean_form'] is not None: + _form_params.append(('boolean_form', _params['boolean_form'])) + + if _params['string_form'] is not None: + _form_params.append(('string_form', _params['string_form'])) + + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['text/plain']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/x-www-form-urlencoded'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "str", + } + + return self.api_client.call_api( + '/form/integer/boolean/string', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_form_oneof(self, form1 : Optional[StrictStr] = None, form2 : Optional[StrictInt] = None, form3 : Optional[StrictStr] = None, form4 : Optional[StrictBool] = None, id : Optional[StrictInt] = None, name : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501 + """Test form parameter(s) for oneOf schema # noqa: E501 + + Test form parameter(s) for oneOf schema # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_form_oneof(form1, form2, form3, form4, id, name, async_req=True) + >>> result = thread.get() + + :param form1: + :type form1: str + :param form2: + :type form2: int + :param form3: + :type form3: str + :param form4: + :type form4: bool + :param id: + :type id: int + :param name: + :type name: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_form_oneof_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_form_oneof_with_http_info(form1, form2, form3, form4, id, name, **kwargs) # noqa: E501 + + @validate_arguments + def test_form_oneof_with_http_info(self, form1 : Optional[StrictStr] = None, form2 : Optional[StrictInt] = None, form3 : Optional[StrictStr] = None, form4 : Optional[StrictBool] = None, id : Optional[StrictInt] = None, name : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Test form parameter(s) for oneOf schema # noqa: E501 + + Test form parameter(s) for oneOf schema # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_form_oneof_with_http_info(form1, form2, form3, form4, id, name, async_req=True) + >>> result = thread.get() + + :param form1: + :type form1: str + :param form2: + :type form2: int + :param form3: + :type form3: str + :param form4: + :type form4: bool + :param id: + :type id: int + :param name: + :type name: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'form1', + 'form2', + 'form3', + 'form4', + 'id', + 'name' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_form_oneof" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + if _params['form1'] is not None: + _form_params.append(('form1', _params['form1'])) + + if _params['form2'] is not None: + _form_params.append(('form2', _params['form2'])) + + if _params['form3'] is not None: + _form_params.append(('form3', _params['form3'])) + + if _params['form4'] is not None: + _form_params.append(('form4', _params['form4'])) + + if _params['id'] is not None: + _form_params.append(('id', _params['id'])) + + if _params['name'] is not None: + _form_params.append(('name', _params['name'])) + + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['text/plain']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/x-www-form-urlencoded'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "str", + } + + return self.api_client.call_api( + '/form/oneof', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/api/header_api.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/api/header_api.py new file mode 100644 index 00000000000..e9ebc11e9cd --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/api/header_api.py @@ -0,0 +1,201 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import re # noqa: F401 +import io +import warnings + +from pydantic import validate_arguments, ValidationError + +from pydantic import StrictBool, StrictInt, StrictStr + +from typing import Optional + + +from openapi_client.api_client import ApiClient +from openapi_client.api_response import ApiResponse +from openapi_client.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class HeaderApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_arguments + def test_header_integer_boolean_string(self, integer_header : Optional[StrictInt] = None, boolean_header : Optional[StrictBool] = None, string_header : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501 + """Test header parameter(s) # noqa: E501 + + Test header parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_header_integer_boolean_string(integer_header, boolean_header, string_header, async_req=True) + >>> result = thread.get() + + :param integer_header: + :type integer_header: int + :param boolean_header: + :type boolean_header: bool + :param string_header: + :type string_header: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_header_integer_boolean_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_header_integer_boolean_string_with_http_info(integer_header, boolean_header, string_header, **kwargs) # noqa: E501 + + @validate_arguments + def test_header_integer_boolean_string_with_http_info(self, integer_header : Optional[StrictInt] = None, boolean_header : Optional[StrictBool] = None, string_header : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Test header parameter(s) # noqa: E501 + + Test header parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_header_integer_boolean_string_with_http_info(integer_header, boolean_header, string_header, async_req=True) + >>> result = thread.get() + + :param integer_header: + :type integer_header: int + :param boolean_header: + :type boolean_header: bool + :param string_header: + :type string_header: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'integer_header', + 'boolean_header', + 'string_header' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_header_integer_boolean_string" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if _params['integer_header'] is not None: + _header_params['integer_header'] = _params['integer_header'] + + if _params['boolean_header'] is not None: + _header_params['boolean_header'] = _params['boolean_header'] + + if _params['string_header'] is not None: + _header_params['string_header'] = _params['string_header'] + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['text/plain']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "str", + } + + return self.api_client.call_api( + '/header/integer/boolean/string', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/api/path_api.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/api/path_api.py new file mode 100644 index 00000000000..a2798c4d604 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/api/path_api.py @@ -0,0 +1,191 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import re # noqa: F401 +import io +import warnings + +from pydantic import validate_arguments, ValidationError + +from pydantic import StrictInt, StrictStr + + +from openapi_client.api_client import ApiClient +from openapi_client.api_response import ApiResponse +from openapi_client.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class PathApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_arguments + def tests_path_string_path_string_integer_path_integer(self, path_string : StrictStr, path_integer : StrictInt, **kwargs) -> str: # noqa: E501 + """Test path parameter(s) # noqa: E501 + + Test path parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.tests_path_string_path_string_integer_path_integer(path_string, path_integer, async_req=True) + >>> result = thread.get() + + :param path_string: (required) + :type path_string: str + :param path_integer: (required) + :type path_integer: int + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the tests_path_string_path_string_integer_path_integer_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.tests_path_string_path_string_integer_path_integer_with_http_info(path_string, path_integer, **kwargs) # noqa: E501 + + @validate_arguments + def tests_path_string_path_string_integer_path_integer_with_http_info(self, path_string : StrictStr, path_integer : StrictInt, **kwargs) -> ApiResponse: # noqa: E501 + """Test path parameter(s) # noqa: E501 + + Test path parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.tests_path_string_path_string_integer_path_integer_with_http_info(path_string, path_integer, async_req=True) + >>> result = thread.get() + + :param path_string: (required) + :type path_string: str + :param path_integer: (required) + :type path_integer: int + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'path_string', + 'path_integer' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method tests_path_string_path_string_integer_path_integer" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['path_string'] is not None: + _path_params['path_string'] = _params['path_string'] + + if _params['path_integer'] is not None: + _path_params['path_integer'] = _params['path_integer'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['text/plain']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "str", + } + + return self.api_client.call_api( + '/path/string/{path_string}/integer/{path_integer}', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/api/query_api.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/api/query_api.py new file mode 100644 index 00000000000..09d55efd2f5 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/api/query_api.py @@ -0,0 +1,1208 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import re # noqa: F401 +import io +import warnings + +from pydantic import validate_arguments, ValidationError + +from datetime import date, datetime + +from pydantic import StrictBool, StrictInt, StrictStr + +from typing import Any, Optional + +from openapi_client.models.pet import Pet +from openapi_client.models.string_enum_ref import StringEnumRef +from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + +from openapi_client.api_client import ApiClient +from openapi_client.api_response import ApiResponse +from openapi_client.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class QueryApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_arguments + def test_enum_ref_string(self, enum_ref_string_query : Optional[StringEnumRef] = None, **kwargs) -> str: # noqa: E501 + """Test query parameter(s) # noqa: E501 + + Test query parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_enum_ref_string(enum_ref_string_query, async_req=True) + >>> result = thread.get() + + :param enum_ref_string_query: + :type enum_ref_string_query: StringEnumRef + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_enum_ref_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_enum_ref_string_with_http_info(enum_ref_string_query, **kwargs) # noqa: E501 + + @validate_arguments + def test_enum_ref_string_with_http_info(self, enum_ref_string_query : Optional[StringEnumRef] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Test query parameter(s) # noqa: E501 + + Test query parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_enum_ref_string_with_http_info(enum_ref_string_query, async_req=True) + >>> result = thread.get() + + :param enum_ref_string_query: + :type enum_ref_string_query: StringEnumRef + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'enum_ref_string_query' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_enum_ref_string" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('enum_ref_string_query') is not None: # noqa: E501 + _query_params.append(('enum_ref_string_query', _params['enum_ref_string_query'].value)) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['text/plain']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "str", + } + + return self.api_client.call_api( + '/query/enum_ref_string', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_query_datetime_date_string(self, datetime_query : Optional[datetime] = None, date_query : Optional[date] = None, string_query : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501 + """Test query parameter(s) # noqa: E501 + + Test query parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_query_datetime_date_string(datetime_query, date_query, string_query, async_req=True) + >>> result = thread.get() + + :param datetime_query: + :type datetime_query: datetime + :param date_query: + :type date_query: date + :param string_query: + :type string_query: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_query_datetime_date_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_query_datetime_date_string_with_http_info(datetime_query, date_query, string_query, **kwargs) # noqa: E501 + + @validate_arguments + def test_query_datetime_date_string_with_http_info(self, datetime_query : Optional[datetime] = None, date_query : Optional[date] = None, string_query : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Test query parameter(s) # noqa: E501 + + Test query parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_query_datetime_date_string_with_http_info(datetime_query, date_query, string_query, async_req=True) + >>> result = thread.get() + + :param datetime_query: + :type datetime_query: datetime + :param date_query: + :type date_query: date + :param string_query: + :type string_query: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'datetime_query', + 'date_query', + 'string_query' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_query_datetime_date_string" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('datetime_query') is not None: # noqa: E501 + if isinstance(_params['datetime_query'], datetime): + _query_params.append(('datetime_query', _params['datetime_query'].strftime(self.api_client.configuration.datetime_format))) + else: + _query_params.append(('datetime_query', _params['datetime_query'])) + + if _params.get('date_query') is not None: # noqa: E501 + if isinstance(_params['date_query'], date): + _query_params.append(('date_query', _params['date_query'].strftime(self.api_client.configuration.date_format))) + else: + _query_params.append(('date_query', _params['date_query'])) + + if _params.get('string_query') is not None: # noqa: E501 + _query_params.append(('string_query', _params['string_query'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['text/plain']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "str", + } + + return self.api_client.call_api( + '/query/datetime/date/string', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_query_integer_boolean_string(self, integer_query : Optional[StrictInt] = None, boolean_query : Optional[StrictBool] = None, string_query : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501 + """Test query parameter(s) # noqa: E501 + + Test query parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_query_integer_boolean_string(integer_query, boolean_query, string_query, async_req=True) + >>> result = thread.get() + + :param integer_query: + :type integer_query: int + :param boolean_query: + :type boolean_query: bool + :param string_query: + :type string_query: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_query_integer_boolean_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_query_integer_boolean_string_with_http_info(integer_query, boolean_query, string_query, **kwargs) # noqa: E501 + + @validate_arguments + def test_query_integer_boolean_string_with_http_info(self, integer_query : Optional[StrictInt] = None, boolean_query : Optional[StrictBool] = None, string_query : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Test query parameter(s) # noqa: E501 + + Test query parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_query_integer_boolean_string_with_http_info(integer_query, boolean_query, string_query, async_req=True) + >>> result = thread.get() + + :param integer_query: + :type integer_query: int + :param boolean_query: + :type boolean_query: bool + :param string_query: + :type string_query: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'integer_query', + 'boolean_query', + 'string_query' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_query_integer_boolean_string" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('integer_query') is not None: # noqa: E501 + _query_params.append(('integer_query', _params['integer_query'])) + + if _params.get('boolean_query') is not None: # noqa: E501 + _query_params.append(('boolean_query', _params['boolean_query'])) + + if _params.get('string_query') is not None: # noqa: E501 + _query_params.append(('string_query', _params['string_query'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['text/plain']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "str", + } + + return self.api_client.call_api( + '/query/integer/boolean/string', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_query_style_deep_object_explode_true_object(self, query_object : Optional[Pet] = None, **kwargs) -> str: # noqa: E501 + """Test query parameter(s) # noqa: E501 + + Test query parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_query_style_deep_object_explode_true_object(query_object, async_req=True) + >>> result = thread.get() + + :param query_object: + :type query_object: Pet + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_query_style_deep_object_explode_true_object_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_query_style_deep_object_explode_true_object_with_http_info(query_object, **kwargs) # noqa: E501 + + @validate_arguments + def test_query_style_deep_object_explode_true_object_with_http_info(self, query_object : Optional[Pet] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Test query parameter(s) # noqa: E501 + + Test query parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_query_style_deep_object_explode_true_object_with_http_info(query_object, async_req=True) + >>> result = thread.get() + + :param query_object: + :type query_object: Pet + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'query_object' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_query_style_deep_object_explode_true_object" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('query_object') is not None: # noqa: E501 + _query_params.append(('query_object', _params['query_object'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['text/plain']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "str", + } + + return self.api_client.call_api( + '/query/style_deepObject/explode_true/object', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_query_style_deep_object_explode_true_object_all_of(self, query_object : Optional[Any] = None, **kwargs) -> str: # noqa: E501 + """Test query parameter(s) # noqa: E501 + + Test query parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_query_style_deep_object_explode_true_object_all_of(query_object, async_req=True) + >>> result = thread.get() + + :param query_object: + :type query_object: TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_query_style_deep_object_explode_true_object_all_of_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_query_style_deep_object_explode_true_object_all_of_with_http_info(query_object, **kwargs) # noqa: E501 + + @validate_arguments + def test_query_style_deep_object_explode_true_object_all_of_with_http_info(self, query_object : Optional[Any] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Test query parameter(s) # noqa: E501 + + Test query parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_query_style_deep_object_explode_true_object_all_of_with_http_info(query_object, async_req=True) + >>> result = thread.get() + + :param query_object: + :type query_object: TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'query_object' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_query_style_deep_object_explode_true_object_all_of" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('query_object') is not None: # noqa: E501 + _query_params.append(('query_object', _params['query_object'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['text/plain']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "str", + } + + return self.api_client.call_api( + '/query/style_deepObject/explode_true/object/allOf', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_query_style_form_explode_true_array_string(self, query_object : Optional[TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter] = None, **kwargs) -> str: # noqa: E501 + """Test query parameter(s) # noqa: E501 + + Test query parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_query_style_form_explode_true_array_string(query_object, async_req=True) + >>> result = thread.get() + + :param query_object: + :type query_object: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_query_style_form_explode_true_array_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_query_style_form_explode_true_array_string_with_http_info(query_object, **kwargs) # noqa: E501 + + @validate_arguments + def test_query_style_form_explode_true_array_string_with_http_info(self, query_object : Optional[TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Test query parameter(s) # noqa: E501 + + Test query parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_query_style_form_explode_true_array_string_with_http_info(query_object, async_req=True) + >>> result = thread.get() + + :param query_object: + :type query_object: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'query_object' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_query_style_form_explode_true_array_string" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('query_object') is not None: # noqa: E501 + _query_params.append(('query_object', _params['query_object'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['text/plain']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "str", + } + + return self.api_client.call_api( + '/query/style_form/explode_true/array_string', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_query_style_form_explode_true_object(self, query_object : Optional[Pet] = None, **kwargs) -> str: # noqa: E501 + """Test query parameter(s) # noqa: E501 + + Test query parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_query_style_form_explode_true_object(query_object, async_req=True) + >>> result = thread.get() + + :param query_object: + :type query_object: Pet + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_query_style_form_explode_true_object_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_query_style_form_explode_true_object_with_http_info(query_object, **kwargs) # noqa: E501 + + @validate_arguments + def test_query_style_form_explode_true_object_with_http_info(self, query_object : Optional[Pet] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Test query parameter(s) # noqa: E501 + + Test query parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_query_style_form_explode_true_object_with_http_info(query_object, async_req=True) + >>> result = thread.get() + + :param query_object: + :type query_object: Pet + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'query_object' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_query_style_form_explode_true_object" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('query_object') is not None: # noqa: E501 + _query_params.append(('query_object', _params['query_object'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['text/plain']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "str", + } + + return self.api_client.call_api( + '/query/style_form/explode_true/object', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_query_style_form_explode_true_object_all_of(self, query_object : Optional[Any] = None, **kwargs) -> str: # noqa: E501 + """Test query parameter(s) # noqa: E501 + + Test query parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_query_style_form_explode_true_object_all_of(query_object, async_req=True) + >>> result = thread.get() + + :param query_object: + :type query_object: DataQuery + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_query_style_form_explode_true_object_all_of_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_query_style_form_explode_true_object_all_of_with_http_info(query_object, **kwargs) # noqa: E501 + + @validate_arguments + def test_query_style_form_explode_true_object_all_of_with_http_info(self, query_object : Optional[Any] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Test query parameter(s) # noqa: E501 + + Test query parameter(s) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_query_style_form_explode_true_object_all_of_with_http_info(query_object, async_req=True) + >>> result = thread.get() + + :param query_object: + :type query_object: DataQuery + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'query_object' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_query_style_form_explode_true_object_all_of" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('query_object') is not None: # noqa: E501 + _query_params.append(('query_object', _params['query_object'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['text/plain']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "str", + } + + return self.api_client.call_api( + '/query/style_form/explode_true/object/allOf', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/api_client.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/api_client.py new file mode 100644 index 00000000000..962fad87d68 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/api_client.py @@ -0,0 +1,760 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import atexit +import datetime +from dateutil.parser import parse +import json +import mimetypes +from multiprocessing.pool import ThreadPool +import os +import re +import tempfile + +from urllib.parse import quote + +from openapi_client.configuration import Configuration +from openapi_client.api_response import ApiResponse +import openapi_client.models +from openapi_client import rest +from openapi_client.exceptions import ApiValueError, ApiException + + +class ApiClient: + """Generic API client for OpenAPI client library builds. + + OpenAPI generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the OpenAPI + templates. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API + :param pool_threads: The number of threads to use for async requests + to the API. More threads means more concurrent API requests. + """ + + PRIMITIVE_TYPES = (float, bool, bytes, str, int) + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int, # TODO remove as only py3 is supported? + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'object': object, + } + _pool = None + + def __init__(self, configuration=None, header_name=None, header_value=None, + cookie=None, pool_threads=1) -> None: + # use default configuration if none is provided + if configuration is None: + configuration = Configuration.get_default() + self.configuration = configuration + self.pool_threads = pool_threads + + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'OpenAPI-Generator/1.0.0/python' + self.client_side_validation = configuration.client_side_validation + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + self.close() + + def close(self): + if self._pool: + self._pool.close() + self._pool.join() + self._pool = None + if hasattr(atexit, 'unregister'): + atexit.unregister(self.close) + + @property + def pool(self): + """Create thread pool on first request + avoids instantiating unused threadpool for blocking clients. + """ + if self._pool is None: + atexit.register(self.close) + self._pool = ThreadPool(self.pool_threads) + return self._pool + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + + _default = None + + @classmethod + def get_default(cls): + """Return new instance of ApiClient. + + This method returns newly created, based on default constructor, + object of ApiClient class or returns a copy of default + ApiClient. + + :return: The ApiClient object. + """ + if cls._default is None: + cls._default = ApiClient() + return cls._default + + @classmethod + def set_default(cls, default): + """Set default instance of ApiClient. + + It stores default ApiClient. + + :param default: object of ApiClient. + """ + cls._default = default + + def __call_api( + self, resource_path, method, path_params=None, + query_params=None, header_params=None, body=None, post_params=None, + files=None, response_types_map=None, auth_settings=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None, _host=None, + _request_auth=None): + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict(self.parameters_to_tuples(header_params, + collection_formats)) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples(path_params, + collection_formats) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # post parameters + if post_params or files: + post_params = post_params if post_params else [] + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples(post_params, + collection_formats) + post_params.extend(self.files_parameters(files)) + + # auth setting + self.update_params_for_auth( + header_params, query_params, auth_settings, + resource_path, method, body, + request_auth=_request_auth) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + if _host is None: + url = self.configuration.host + resource_path + else: + # use server/host defined in path or operation instead + url = _host + resource_path + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + url_query = self.parameters_to_url_query(query_params, + collection_formats) + url += "?" + url_query + + try: + # perform request and return response + response_data = self.request( + method, url, + query_params=query_params, + headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + except ApiException as e: + if e.body: + e.body = e.body.decode('utf-8') + raise e + + self.last_response = response_data + + return_data = None # assuming deserialization is not needed + # data needs deserialization or returns HTTP data (deserialized) only + if _preload_content or _return_http_data_only: + response_type = response_types_map.get(str(response_data.status), None) + if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) + + if response_type == "bytearray": + response_data.data = response_data.data + else: + match = None + content_type = response_data.getheader('content-type') + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_data.data = response_data.data.decode(encoding) + + # deserialize response data + if response_type == "bytearray": + return_data = response_data.data + elif response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None + + if _return_http_data_only: + return return_data + else: + return ApiResponse(status_code = response_data.status, + data = return_data, + headers = response_data.getheaders(), + raw_data = response_data.data) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is OpenAPI model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, list): + return [self.sanitize_for_serialization(sub_obj) + for sub_obj in obj] + elif isinstance(obj, tuple): + return tuple(self.sanitize_for_serialization(sub_obj) + for sub_obj in obj) + elif isinstance(obj, (datetime.datetime, datetime.date)): + return obj.isoformat() + + if isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + obj_dict = obj.to_dict() + + return {key: self.sanitize_for_serialization(val) + for key, val in obj_dict.items()} + + def deserialize(self, response, response_type): + """Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + + :return: deserialized object. + """ + # handle file downloading + # save response body into a tmp file and return the instance + if response_type == "file": + return self.__deserialize_file(response) + + # fetch data from response object + try: + data = json.loads(response.data) + except ValueError: + data = response.data + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if isinstance(klass, str): + if klass.startswith('List['): + sub_kls = re.match(r'List\[(.*)]', klass).group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('Dict['): + sub_kls = re.match(r'Dict\[([^,]*), (.*)]', klass).group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in data.items()} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(openapi_client.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass == object: + return self.__deserialize_object(data) + elif klass == datetime.date: + return self.__deserialize_date(data) + elif klass == datetime.datetime: + return self.__deserialize_datetime(data) + else: + return self.__deserialize_model(data, klass) + + def call_api(self, resource_path, method, + path_params=None, query_params=None, header_params=None, + body=None, post_params=None, files=None, + response_types_map=None, auth_settings=None, + async_req=None, _return_http_data_only=None, + collection_formats=None, _preload_content=True, + _request_timeout=None, _host=None, _request_auth=None): + """Makes the HTTP request (synchronous) and returns deserialized data. + + To make an async_req request, set the async_req parameter. + + :param resource_path: Path to method endpoint. + :param method: Method to call. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param response: Response data type. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param async_req bool: execute request asynchronously + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_token: dict, optional + :return: + If async_req parameter is True, + the request will be called asynchronously. + The method will return the request thread. + If parameter async_req is False or missing, + then the method will return the response directly. + """ + args = ( + resource_path, + method, + path_params, + query_params, + header_params, + body, + post_params, + files, + response_types_map, + auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + _host, + _request_auth, + ) + if not async_req: + return self.__call_api(*args) + + return self.pool.apply_async(self.__call_api, args) + + def request(self, method, url, query_params=None, headers=None, + post_params=None, body=None, _preload_content=True, + _request_timeout=None): + """Makes the HTTP request using RESTClient.""" + if method == "GET": + return self.rest_client.get_request(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "HEAD": + return self.rest_client.head_request(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "OPTIONS": + return self.rest_client.options_request(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + elif method == "POST": + return self.rest_client.post_request(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PUT": + return self.rest_client.put_request(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PATCH": + return self.rest_client.patch_request(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "DELETE": + return self.rest_client.delete_request(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + else: + raise ApiValueError( + "http method must be `GET`, `HEAD`, `OPTIONS`," + " `POST`, `PATCH`, `PUT` or `DELETE`." + ) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501 + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def parameters_to_url_query(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: URL query string (e.g. a=Hello%20World&b=123) + """ + new_params = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501 + if isinstance(v, (int, float)): + v = str(v) + if isinstance(v, bool): + v = str(v).lower() + if isinstance(v, dict): + v = json.dumps(v) + + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(quote(str(value)) for value in v))) + else: + new_params.append((k, quote(str(v)))) + + return "&".join(["=".join(item) for item in new_params]) + + def files_parameters(self, files=None): + """Builds form parameters. + + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + + if files: + for k, v in files.items(): + if not v: + continue + file_names = v if type(v) is list else [v] + for n in file_names: + with open(n, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + mimetype = (mimetypes.guess_type(filename)[0] or + 'application/octet-stream') + params.append( + tuple([k, tuple([filename, filedata, mimetype])])) + + return params + + def select_header_accept(self, accepts): + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return + + for accept in accepts: + if re.search('json', accept, re.IGNORECASE): + return accept + + return accepts[0] + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return None + + for content_type in content_types: + if re.search('json', content_type, re.IGNORECASE): + return content_type + + return content_types[0] + + def update_params_for_auth(self, headers, queries, auth_settings, + resource_path, method, body, + request_auth=None): + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param request_auth: if set, the provided settings will + override the token in the configuration. + """ + if not auth_settings: + return + + if request_auth: + self._apply_auth_params(headers, queries, + resource_path, method, body, + request_auth) + return + + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + self._apply_auth_params(headers, queries, + resource_path, method, body, + auth_setting) + + def _apply_auth_params(self, headers, queries, + resource_path, method, body, + auth_setting): + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.getheader("Content-Disposition") + if content_disposition: + filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition).group(1) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return str(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return an original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datetime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + return klass.from_dict(data) diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/api_response.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/api_response.py new file mode 100644 index 00000000000..a0b62b95246 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/api_response.py @@ -0,0 +1,25 @@ +"""API response object.""" + +from __future__ import annotations +from typing import Any, Dict, Optional +from pydantic import Field, StrictInt, StrictStr + +class ApiResponse: + """ + API response object + """ + + status_code: Optional[StrictInt] = Field(None, description="HTTP status code") + headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") + data: Optional[Any] = Field(None, description="Deserialized data given the data type") + raw_data: Optional[Any] = Field(None, description="Raw data (HTTP response body)") + + def __init__(self, + status_code=None, + headers=None, + data=None, + raw_data=None) -> None: + self.status_code = status_code + self.headers = headers + self.data = data + self.raw_data = raw_data diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/configuration.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/configuration.py new file mode 100644 index 00000000000..8ff03cff3b9 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/configuration.py @@ -0,0 +1,459 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import copy +import logging +import multiprocessing +import sys +import urllib3 + +import http.client as httplib + +JSON_SCHEMA_VALIDATION_KEYWORDS = { + 'multipleOf', 'maximum', 'exclusiveMaximum', + 'minimum', 'exclusiveMinimum', 'maxLength', + 'minLength', 'pattern', 'maxItems', 'minItems' +} + +class Configuration: + """This class contains various settings of the API client. + + :param host: Base url. + :param api_key: Dict to store API key(s). + Each entry in the dict specifies an API key. + The dict key is the name of the security scheme in the OAS specification. + The dict value is the API key secret. + :param api_key_prefix: Dict to store API prefix (e.g. Bearer). + The dict key is the name of the security scheme in the OAS specification. + The dict value is an API key prefix when generating the auth data. + :param username: Username for HTTP basic authentication. + :param password: Password for HTTP basic authentication. + :param access_token: Access token. + :param server_index: Index to servers configuration. + :param server_variables: Mapping with string values to replace variables in + templated server configuration. The validation of enums is performed for + variables with defined enum values before. + :param server_operation_index: Mapping from operation ID to an index to server + configuration. + :param server_operation_variables: Mapping from operation ID to a mapping with + string values to replace variables in templated server configuration. + The validation of enums is performed for variables with defined enum + values before. + :param ssl_ca_cert: str - the path to a file of concatenated CA certificates + in PEM format. + + :Example: + + HTTP Basic Authentication Example. + Given the following security scheme in the OpenAPI specification: + components: + securitySchemes: + http_basic_auth: + type: http + scheme: basic + + Configure API client with HTTP basic authentication: + +conf = openapi_client.Configuration( + username='the-user', + password='the-password', +) + + """ + + _default = None + + def __init__(self, host=None, + api_key=None, api_key_prefix=None, + username=None, password=None, + access_token=None, + server_index=None, server_variables=None, + server_operation_index=None, server_operation_variables=None, + ssl_ca_cert=None, + ) -> None: + """Constructor + """ + self._base_path = "http://localhost:3000" if host is None else host + """Default Base url + """ + self.server_index = 0 if server_index is None and host is None else server_index + self.server_operation_index = server_operation_index or {} + """Default server index + """ + self.server_variables = server_variables or {} + self.server_operation_variables = server_operation_variables or {} + """Default server variables + """ + self.temp_folder_path = None + """Temp file folder for downloading files + """ + # Authentication Settings + self.api_key = {} + if api_key: + self.api_key = api_key + """dict to store API key(s) + """ + self.api_key_prefix = {} + if api_key_prefix: + self.api_key_prefix = api_key_prefix + """dict to store API prefix (e.g. Bearer) + """ + self.refresh_api_key_hook = None + """function hook to refresh API key if expired + """ + self.username = username + """Username for HTTP basic authentication + """ + self.password = password + """Password for HTTP basic authentication + """ + self.access_token = access_token + """Access token + """ + self.logger = {} + """Logging Settings + """ + self.logger["package_logger"] = logging.getLogger("openapi_client") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + """Log format + """ + self.logger_stream_handler = None + """Log stream handler + """ + self.logger_file_handler = None + """Log file handler + """ + self.logger_file = None + """Debug file location + """ + self.debug = False + """Debug switch + """ + + self.verify_ssl = True + """SSL/TLS verification + Set this to false to skip verifying SSL certificate when calling API + from https server. + """ + self.ssl_ca_cert = ssl_ca_cert + """Set this to customize the certificate file to verify the peer. + """ + self.cert_file = None + """client certificate file + """ + self.key_file = None + """client key file + """ + self.assert_hostname = None + """Set this to True/False to enable/disable SSL hostname verification. + """ + self.tls_server_name = None + """SSL/TLS Server Name Indication (SNI) + Set this to the SNI value expected by the server. + """ + + self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 + """urllib3 connection pool's maximum number of connections saved + per pool. urllib3 uses 1 connection as default value, but this is + not the best value when you are making a lot of possibly parallel + requests to the same host, which is often the case here. + cpu_count * 5 is used as default value to increase performance. + """ + + self.proxy = None + """Proxy URL + """ + self.proxy_headers = None + """Proxy headers + """ + self.safe_chars_for_path_param = '' + """Safe chars for path_param + """ + self.retries = None + """Adding retries to override urllib3 default value 3 + """ + # Enable client side validation + self.client_side_validation = True + + self.socket_options = None + """Options to pass down to the underlying urllib3 socket + """ + + self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z" + """datetime format + """ + + self.date_format = "%Y-%m-%d" + """date format + """ + + def __deepcopy__(self, memo): + cls = self.__class__ + result = cls.__new__(cls) + memo[id(self)] = result + for k, v in self.__dict__.items(): + if k not in ('logger', 'logger_file_handler'): + setattr(result, k, copy.deepcopy(v, memo)) + # shallow copy of loggers + result.logger = copy.copy(self.logger) + # use setters to configure loggers + result.logger_file = self.logger_file + result.debug = self.debug + return result + + def __setattr__(self, name, value): + object.__setattr__(self, name, value) + + @classmethod + def set_default(cls, default): + """Set default instance of configuration. + + It stores default configuration, which can be + returned by get_default_copy method. + + :param default: object of Configuration + """ + cls._default = default + + @classmethod + def get_default_copy(cls): + """Deprecated. Please use `get_default` instead. + + Deprecated. Please use `get_default` instead. + + :return: The configuration object. + """ + return cls.get_default() + + @classmethod + def get_default(cls): + """Return the default configuration. + + This method returns newly created, based on default constructor, + object of Configuration class or returns a copy of default + configuration. + + :return: The configuration object. + """ + if cls._default is None: + cls._default = Configuration() + return cls._default + + @property + def logger_file(self): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in self.logger.items(): + logger.addHandler(self.logger_file_handler) + + @property + def debug(self): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in self.logger.items(): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in self.logger.items(): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier, alias=None): + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :param alias: The alternative identifier of apiKey. + :return: The token for api key authentication. + """ + if self.refresh_api_key_hook is not None: + self.refresh_api_key_hook(self) + key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) + if key: + prefix = self.api_key_prefix.get(identifier) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + def get_basic_auth_token(self): + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + username = "" + if self.username is not None: + username = self.username + password = "" + if self.password is not None: + password = self.password + return urllib3.util.make_headers( + basic_auth=username + ':' + password + ).get('authorization') + + def auth_settings(self): + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + auth = {} + if self.username is not None and self.password is not None: + auth['http_auth'] = { + 'type': 'basic', + 'in': 'header', + 'key': 'Authorization', + 'value': self.get_basic_auth_token() + } + return auth + + def to_debug_report(self): + """Gets the essential information for debugging. + + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: 0.1.0\n"\ + "SDK Package Version: 1.0.0".\ + format(env=sys.platform, pyversion=sys.version) + + def get_host_settings(self): + """Gets an array of host settings + + :return: An array of host settings + """ + return [ + { + 'url': "http://localhost:3000", + 'description': "No description provided", + } + ] + + def get_host_from_settings(self, index, variables=None, servers=None): + """Gets host URL based on the index and variables + :param index: array index of the host settings + :param variables: hash of variable and the corresponding value + :param servers: an array of host settings or None + :return: URL based on host settings + """ + if index is None: + return self._base_path + + variables = {} if variables is None else variables + servers = self.get_host_settings() if servers is None else servers + + try: + server = servers[index] + except IndexError: + raise ValueError( + "Invalid index {0} when selecting the host settings. " + "Must be less than {1}".format(index, len(servers))) + + url = server['url'] + + # go through variables and replace placeholders + for variable_name, variable in server.get('variables', {}).items(): + used_value = variables.get( + variable_name, variable['default_value']) + + if 'enum_values' in variable \ + and used_value not in variable['enum_values']: + raise ValueError( + "The variable `{0}` in the host URL has invalid value " + "{1}. Must be {2}.".format( + variable_name, variables[variable_name], + variable['enum_values'])) + + url = url.replace("{" + variable_name + "}", used_value) + + return url + + @property + def host(self): + """Return generated host.""" + return self.get_host_from_settings(self.server_index, variables=self.server_variables) + + @host.setter + def host(self, value): + """Fix base path.""" + self._base_path = value + self.server_index = None diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/exceptions.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/exceptions.py new file mode 100644 index 00000000000..ae3e985d2fe --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/exceptions.py @@ -0,0 +1,167 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +class OpenApiException(Exception): + """The base exception class for all OpenAPIExceptions""" + + +class ApiTypeError(OpenApiException, TypeError): + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None) -> None: + """ Raises an exception for TypeErrors + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list): a list of keys an indices to get to the + current_item + None if unset + valid_classes (tuple): the primitive classes that current item + should be an instance of + None if unset + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + None if unset + """ + self.path_to_item = path_to_item + self.valid_classes = valid_classes + self.key_type = key_type + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiTypeError, self).__init__(full_msg) + + +class ApiValueError(OpenApiException, ValueError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list) the path to the exception in the + received_data dict. None if unset + """ + + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiValueError, self).__init__(full_msg) + + +class ApiAttributeError(OpenApiException, AttributeError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Raised when an attribute reference or assignment fails. + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiAttributeError, self).__init__(full_msg) + + +class ApiKeyError(OpenApiException, KeyError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiKeyError, self).__init__(full_msg) + + +class ApiException(OpenApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + if http_resp: + self.status = http_resp.status + self.reason = http_resp.reason + self.body = http_resp.data + self.headers = http_resp.getheaders() + else: + self.status = status + self.reason = reason + self.body = None + self.headers = None + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + return error_message + +class BadRequestException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + super(BadRequestException, self).__init__(status, reason, http_resp) + +class NotFoundException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + super(NotFoundException, self).__init__(status, reason, http_resp) + + +class UnauthorizedException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + super(UnauthorizedException, self).__init__(status, reason, http_resp) + + +class ForbiddenException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + super(ForbiddenException, self).__init__(status, reason, http_resp) + + +class ServiceException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + super(ServiceException, self).__init__(status, reason, http_resp) + + +def render_path(path_to_item): + """Returns a string representation of a path""" + result = "" + for pth in path_to_item: + if isinstance(pth, int): + result += "[{0}]".format(pth) + else: + result += "['{0}']".format(pth) + return result diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/models/__init__.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/__init__.py new file mode 100644 index 00000000000..4b981699e6a --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/__init__.py @@ -0,0 +1,28 @@ +# coding: utf-8 + +# flake8: noqa +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +# import models into model package +from openapi_client.models.bird import Bird +from openapi_client.models.category import Category +from openapi_client.models.data_query import DataQuery +from openapi_client.models.default_value import DefaultValue +from openapi_client.models.number_properties_only import NumberPropertiesOnly +from openapi_client.models.pet import Pet +from openapi_client.models.query import Query +from openapi_client.models.string_enum_ref import StringEnumRef +from openapi_client.models.tag import Tag +from openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter import TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter +from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/models/bird.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/bird.py new file mode 100644 index 00000000000..77887a53120 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/bird.py @@ -0,0 +1,74 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + 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 Optional +from pydantic import BaseModel, StrictStr + +class Bird(BaseModel): + """ + Bird + """ + size: Optional[StrictStr] = None + color: Optional[StrictStr] = None + __properties = ["size", "color"] + + 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) -> Bird: + """Create an instance of Bird 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) -> Bird: + """Create an instance of Bird from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Bird.parse_obj(obj) + + _obj = Bird.parse_obj({ + "size": obj.get("size"), + "color": obj.get("color") + }) + return _obj + + diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/models/category.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/category.py new file mode 100644 index 00000000000..ee8e5c258ae --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/category.py @@ -0,0 +1,74 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + 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 Optional +from pydantic import BaseModel, StrictInt, StrictStr + +class Category(BaseModel): + """ + Category + """ + id: Optional[StrictInt] = None + name: Optional[StrictStr] = None + __properties = ["id", "name"] + + 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) -> Category: + """Create an instance of Category 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) -> Category: + """Create an instance of Category from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Category.parse_obj(obj) + + _obj = Category.parse_obj({ + "id": obj.get("id"), + "name": obj.get("name") + }) + return _obj + + diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/models/data_query.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/data_query.py new file mode 100644 index 00000000000..af8078549f1 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/data_query.py @@ -0,0 +1,79 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + 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 datetime import datetime +from typing import Optional +from pydantic import Field, StrictStr +from openapi_client.models.query import Query + +class DataQuery(Query): + """ + DataQuery + """ + suffix: Optional[StrictStr] = Field(None, description="test suffix") + text: Optional[StrictStr] = Field(None, description="Some text containing white spaces") + var_date: Optional[datetime] = Field(None, alias="date", description="A date") + __properties = ["id", "outcomes", "suffix", "text", "date"] + + 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) -> DataQuery: + """Create an instance of DataQuery 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) -> DataQuery: + """Create an instance of DataQuery from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return DataQuery.parse_obj(obj) + + _obj = DataQuery.parse_obj({ + "id": obj.get("id"), + "outcomes": obj.get("outcomes"), + "suffix": obj.get("suffix"), + "text": obj.get("text"), + "var_date": obj.get("date") + }) + return _obj + + diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/models/default_value.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/default_value.py new file mode 100644 index 00000000000..a73193247fd --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/default_value.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + 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 List, Optional +from pydantic import BaseModel, StrictInt, StrictStr, conlist, validator +from openapi_client.models.string_enum_ref import StringEnumRef + +class DefaultValue(BaseModel): + """ + to test the default value of properties # noqa: E501 + """ + array_string_enum_ref_default: Optional[conlist(StringEnumRef)] = None + array_string_enum_default: Optional[conlist(StrictStr)] = None + array_string_default: Optional[conlist(StrictStr)] = None + array_integer_default: Optional[conlist(StrictInt)] = None + array_string: Optional[conlist(StrictStr)] = None + array_string_nullable: Optional[conlist(StrictStr)] = None + array_string_extension_nullable: Optional[conlist(StrictStr)] = None + string_nullable: Optional[StrictStr] = None + __properties = ["array_string_enum_ref_default", "array_string_enum_default", "array_string_default", "array_integer_default", "array_string", "array_string_nullable", "array_string_extension_nullable", "string_nullable"] + + @validator('array_string_enum_default') + def array_string_enum_default_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in ('success', 'failure', 'unclassified'): + raise ValueError("each list item must be one of ('success', 'failure', 'unclassified')") + 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) -> DefaultValue: + """Create an instance of DefaultValue 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) + # set to None if array_string_nullable (nullable) is None + # and __fields_set__ contains the field + if self.array_string_nullable is None and "array_string_nullable" in self.__fields_set__: + _dict['array_string_nullable'] = None + + # set to None if array_string_extension_nullable (nullable) is None + # and __fields_set__ contains the field + if self.array_string_extension_nullable is None and "array_string_extension_nullable" in self.__fields_set__: + _dict['array_string_extension_nullable'] = None + + # set to None if string_nullable (nullable) is None + # and __fields_set__ contains the field + if self.string_nullable is None and "string_nullable" in self.__fields_set__: + _dict['string_nullable'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> DefaultValue: + """Create an instance of DefaultValue from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return DefaultValue.parse_obj(obj) + + _obj = DefaultValue.parse_obj({ + "array_string_enum_ref_default": obj.get("array_string_enum_ref_default"), + "array_string_enum_default": obj.get("array_string_enum_default"), + "array_string_default": obj.get("array_string_default"), + "array_integer_default": obj.get("array_integer_default"), + "array_string": obj.get("array_string"), + "array_string_nullable": obj.get("array_string_nullable"), + "array_string_extension_nullable": obj.get("array_string_extension_nullable"), + "string_nullable": obj.get("string_nullable") + }) + return _obj + + diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/models/number_properties_only.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/number_properties_only.py new file mode 100644 index 00000000000..10bb3a590a2 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/number_properties_only.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + 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 Optional, Union +from pydantic import BaseModel, StrictFloat, StrictInt, confloat, conint + +class NumberPropertiesOnly(BaseModel): + """ + NumberPropertiesOnly + """ + number: Optional[Union[StrictFloat, StrictInt]] = None + float: Optional[Union[StrictFloat, StrictInt]] = None + double: Optional[Union[confloat(le=50.2, ge=0.8, strict=True), conint(le=50, ge=1, strict=True)]] = None + __properties = ["number", "float", "double"] + + 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) -> NumberPropertiesOnly: + """Create an instance of NumberPropertiesOnly 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) -> NumberPropertiesOnly: + """Create an instance of NumberPropertiesOnly from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return NumberPropertiesOnly.parse_obj(obj) + + _obj = NumberPropertiesOnly.parse_obj({ + "number": obj.get("number"), + "float": obj.get("float"), + "double": obj.get("double") + }) + return _obj + + diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/models/pet.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/pet.py new file mode 100644 index 00000000000..3a40ddc0321 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/pet.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + 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 List, Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator +from openapi_client.models.category import Category +from openapi_client.models.tag import Tag + +class Pet(BaseModel): + """ + Pet + """ + id: Optional[StrictInt] = None + name: StrictStr = Field(...) + category: Optional[Category] = None + photo_urls: conlist(StrictStr) = Field(..., alias="photoUrls") + tags: Optional[conlist(Tag)] = None + status: Optional[StrictStr] = Field(None, description="pet status in the store") + __properties = ["id", "name", "category", "photoUrls", "tags", "status"] + + @validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('available', 'pending', 'sold'): + raise ValueError("must be one of enum values ('available', 'pending', 'sold')") + 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) -> Pet: + """Create an instance of Pet 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 category + if self.category: + _dict['category'] = self.category.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in tags (list) + _items = [] + if self.tags: + for _item in self.tags: + if _item: + _items.append(_item.to_dict()) + _dict['tags'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> Pet: + """Create an instance of Pet from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Pet.parse_obj(obj) + + _obj = Pet.parse_obj({ + "id": obj.get("id"), + "name": obj.get("name"), + "category": Category.from_dict(obj.get("category")) if obj.get("category") is not None else None, + "photo_urls": obj.get("photoUrls"), + "tags": [Tag.from_dict(_item) for _item in obj.get("tags")] if obj.get("tags") is not None else None, + "status": obj.get("status") + }) + return _obj + + diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/models/query.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/query.py new file mode 100644 index 00000000000..02e4233d513 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/query.py @@ -0,0 +1,74 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + 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 List, Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator + +class Query(BaseModel): + """ + Query + """ + id: Optional[StrictInt] = Field(None, description="Query") + outcomes: Optional[conlist(StrictStr)] = None + __properties = ["id", "outcomes"] + + @validator('outcomes') + def outcomes_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in ('SUCCESS', 'FAILURE', 'SKIPPED'): + raise ValueError("each list item must be one of ('SUCCESS', 'FAILURE', 'SKIPPED')") + 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) -> Query: + """Create an instance of Query 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) -> Query: + """Create an instance of Query from a dict""" + + diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/models/string_enum_ref.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/string_enum_ref.py new file mode 100644 index 00000000000..f200a1dafb8 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/string_enum_ref.py @@ -0,0 +1,42 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class StringEnumRef(str, Enum): + """ + StringEnumRef + """ + + """ + allowed enum values + """ + SUCCESS = 'success' + FAILURE = 'failure' + UNCLASSIFIED = 'unclassified' + + @classmethod + def from_json(cls, json_str: str) -> StringEnumRef: + """Create an instance of StringEnumRef from a JSON string""" + return StringEnumRef(json.loads(json_str)) + + diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/models/tag.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/tag.py new file mode 100644 index 00000000000..66a39adff29 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/tag.py @@ -0,0 +1,74 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + 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 Optional +from pydantic import BaseModel, StrictInt, StrictStr + +class Tag(BaseModel): + """ + Tag + """ + id: Optional[StrictInt] = None + name: Optional[StrictStr] = None + __properties = ["id", "name"] + + 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) -> Tag: + """Create an instance of Tag 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) -> Tag: + """Create an instance of Tag from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Tag.parse_obj(obj) + + _obj = Tag.parse_obj({ + "id": obj.get("id"), + "name": obj.get("name") + }) + return _obj + + diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py new file mode 100644 index 00000000000..42e1101ec02 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py @@ -0,0 +1,78 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + 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 Optional +from pydantic import BaseModel, StrictInt, StrictStr + +class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(BaseModel): + """ + TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + """ + size: Optional[StrictStr] = None + color: Optional[StrictStr] = None + id: Optional[StrictInt] = None + name: Optional[StrictStr] = None + __properties = ["size", "color", "id", "name"] + + 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) -> TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter: + """Create an instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter 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) -> TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter: + """Create an instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.parse_obj(obj) + + _obj = TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.parse_obj({ + "size": obj.get("size"), + "color": obj.get("color"), + "id": obj.get("id"), + "name": obj.get("name") + }) + return _obj + + diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py new file mode 100644 index 00000000000..1bff80a6df1 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py @@ -0,0 +1,72 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + 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 List, Optional +from pydantic import BaseModel, StrictStr, conlist + +class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(BaseModel): + """ + TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + """ + values: Optional[conlist(StrictStr)] = None + __properties = ["values"] + + 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) -> TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter: + """Create an instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter 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) -> TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter: + """Create an instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.parse_obj(obj) + + _obj = TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.parse_obj({ + "values": obj.get("values") + }) + return _obj + + diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/py.typed b/samples/client/echo_api/python-pydantic-v1/openapi_client/py.typed new file mode 100644 index 00000000000..e69de29bb2d diff --git a/samples/client/echo_api/python-pydantic-v1/openapi_client/rest.py b/samples/client/echo_api/python-pydantic-v1/openapi_client/rest.py new file mode 100644 index 00000000000..d05e077260d --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/openapi_client/rest.py @@ -0,0 +1,304 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import io +import json +import logging +import re +import ssl + +from urllib.parse import urlencode, quote_plus +import urllib3 + +from openapi_client.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError, BadRequestException + + +logger = logging.getLogger(__name__) + + +class RESTResponse(io.IOBase): + + def __init__(self, resp) -> None: + self.urllib3_response = resp + self.status = resp.status + self.reason = resp.reason + self.data = resp.data + + def getheaders(self): + """Returns a dictionary of the response headers.""" + return self.urllib3_response.headers + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.urllib3_response.headers.get(name, default) + + +class RESTClientObject: + + def __init__(self, configuration, pools_size=4, maxsize=None) -> None: + # urllib3.PoolManager will pass all kw parameters to connectionpool + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 + # maxsize is the number of requests to host that are allowed in parallel # noqa: E501 + # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 + + # cert_reqs + if configuration.verify_ssl: + cert_reqs = ssl.CERT_REQUIRED + else: + cert_reqs = ssl.CERT_NONE + + addition_pool_args = {} + if configuration.assert_hostname is not None: + addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 + + if configuration.retries is not None: + addition_pool_args['retries'] = configuration.retries + + if configuration.tls_server_name: + addition_pool_args['server_hostname'] = configuration.tls_server_name + + + if configuration.socket_options is not None: + addition_pool_args['socket_options'] = configuration.socket_options + + if maxsize is None: + if configuration.connection_pool_maxsize is not None: + maxsize = configuration.connection_pool_maxsize + else: + maxsize = 4 + + # https pool manager + if configuration.proxy: + self.pool_manager = urllib3.ProxyManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=configuration.ssl_ca_cert, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + proxy_url=configuration.proxy, + proxy_headers=configuration.proxy_headers, + **addition_pool_args + ) + else: + self.pool_manager = urllib3.PoolManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=configuration.ssl_ca_cert, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + **addition_pool_args + ) + + def request(self, method, url, query_params=None, headers=None, + body=None, post_params=None, _preload_content=True, + _request_timeout=None): + """Perform requests. + + :param method: http request method + :param url: http request url + :param query_params: query parameters in the url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + """ + method = method.upper() + assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', + 'PATCH', 'OPTIONS'] + + if post_params and body: + raise ApiValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + # url already contains the URL query string + # so reset query_params to empty dict + query_params = {} + + timeout = None + if _request_timeout: + if isinstance(_request_timeout, (int,float)): # noqa: E501,F821 + timeout = urllib3.Timeout(total=_request_timeout) + elif (isinstance(_request_timeout, tuple) and + len(_request_timeout) == 2): + timeout = urllib3.Timeout( + connect=_request_timeout[0], read=_request_timeout[1]) + + try: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + + # no content type provided or payload is json + if not headers.get('Content-Type') or re.search('json', headers['Content-Type'], re.IGNORECASE): + request_body = None + if body is not None: + request_body = json.dumps(body) + r = self.pool_manager.request( + method, url, + body=request_body, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + r = self.pool_manager.request( + method, url, + fields=post_params, + encode_multipart=False, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + elif headers['Content-Type'] == 'multipart/form-data': + # must del headers['Content-Type'], or the correct + # Content-Type which generated by urllib3 will be + # overwritten. + del headers['Content-Type'] + r = self.pool_manager.request( + method, url, + fields=post_params, + encode_multipart=True, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + # Pass a `string` parameter directly in the body to support + # other content types than Json when `body` argument is + # provided in serialized form + elif isinstance(body, str) or isinstance(body, bytes): + request_body = body + r = self.pool_manager.request( + method, url, + body=request_body, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + # For `GET`, `HEAD` + else: + r = self.pool_manager.request(method, url, + fields={}, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + except urllib3.exceptions.SSLError as e: + msg = "{0}\n{1}".format(type(e).__name__, str(e)) + raise ApiException(status=0, reason=msg) + + if _preload_content: + r = RESTResponse(r) + + # log response body + logger.debug("response body: %s", r.data) + + if not 200 <= r.status <= 299: + if r.status == 400: + raise BadRequestException(http_resp=r) + + if r.status == 401: + raise UnauthorizedException(http_resp=r) + + if r.status == 403: + raise ForbiddenException(http_resp=r) + + if r.status == 404: + raise NotFoundException(http_resp=r) + + if 500 <= r.status <= 599: + raise ServiceException(http_resp=r) + + raise ApiException(http_resp=r) + + return r + + def get_request(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("GET", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def head_request(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("HEAD", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def options_request(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("OPTIONS", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def delete_request(self, url, headers=None, query_params=None, body=None, + _preload_content=True, _request_timeout=None): + return self.request("DELETE", url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def post_request(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("POST", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def put_request(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PUT", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def patch_request(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PATCH", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) diff --git a/samples/client/echo_api/python-pydantic-v1/pyproject.toml b/samples/client/echo_api/python-pydantic-v1/pyproject.toml new file mode 100644 index 00000000000..caaec1be1b2 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/pyproject.toml @@ -0,0 +1,30 @@ +[tool.poetry] +name = "openapi_client" +version = "1.0.0" +description = "Echo Server API" +authors = ["OpenAPI Generator Community "] +license = "Apache 2.0" +readme = "README.md" +repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID" +keywords = ["OpenAPI", "OpenAPI-Generator", "Echo Server API"] +include = ["openapi_client/py.typed"] + +[tool.poetry.dependencies] +python = "^3.7" + +urllib3 = ">= 1.25.3" +python-dateutil = ">=2.8.2" +pydantic = "^1.10.5, <2" +aenum = ">=3.1.11" + +[tool.poetry.dev-dependencies] +pytest = ">=7.2.1" +tox = ">=3.9.0" +flake8 = ">=4.0.0" + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[tool.pylint.'MESSAGES CONTROL'] +extension-pkg-whitelist = "pydantic" diff --git a/samples/client/echo_api/python-pydantic-v1/requirements.txt b/samples/client/echo_api/python-pydantic-v1/requirements.txt new file mode 100644 index 00000000000..258c179c10b --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/requirements.txt @@ -0,0 +1,5 @@ +python_dateutil >= 2.5.3 +setuptools >= 21.0.0 +urllib3 >= 1.25.3, < 2.1.0 +pydantic >= 1.10.5, < 2 +aenum >= 3.1.11 diff --git a/samples/client/echo_api/python-pydantic-v1/setup.cfg b/samples/client/echo_api/python-pydantic-v1/setup.cfg new file mode 100644 index 00000000000..11433ee875a --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/setup.cfg @@ -0,0 +1,2 @@ +[flake8] +max-line-length=99 diff --git a/samples/client/echo_api/python-pydantic-v1/setup.py b/samples/client/echo_api/python-pydantic-v1/setup.py new file mode 100644 index 00000000000..192f8f2b040 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/setup.py @@ -0,0 +1,51 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from setuptools import setup, find_packages # noqa: H301 + +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools +NAME = "openapi-client" +VERSION = "1.0.0" +PYTHON_REQUIRES = ">=3.7" +REQUIRES = [ + "urllib3 >= 1.25.3, < 2.1.0", + "python-dateutil", + "pydantic >= 1.10.5, < 2", + "aenum" +] + +setup( + name=NAME, + version=VERSION, + description="Echo Server API", + author="OpenAPI Generator community", + author_email="team@openapitools.org", + url="", + keywords=["OpenAPI", "OpenAPI-Generator", "Echo Server API"], + install_requires=REQUIRES, + packages=find_packages(exclude=["test", "tests"]), + include_package_data=True, + license="Apache 2.0", + long_description_content_type='text/markdown', + long_description="""\ + Echo Server API + """, # noqa: E501 + package_data={"openapi_client": ["py.typed"]}, +) diff --git a/samples/client/echo_api/python-pydantic-v1/test-requirements.txt b/samples/client/echo_api/python-pydantic-v1/test-requirements.txt new file mode 100644 index 00000000000..3a0d0b939a1 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/test-requirements.txt @@ -0,0 +1,3 @@ +pytest~=7.1.3 +pytest-cov>=2.8.1 +pytest-randomly>=3.12.0 diff --git a/samples/client/echo_api/python-pydantic-v1/test/__init__.py b/samples/client/echo_api/python-pydantic-v1/test/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_auth_api.py b/samples/client/echo_api/python-pydantic-v1/test/test_auth_api.py new file mode 100644 index 00000000000..bfd827933bd --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/test/test_auth_api.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.api.auth_api import AuthApi # noqa: E501 + + +class TestAuthApi(unittest.TestCase): + """AuthApi unit test stubs""" + + def setUp(self) -> None: + self.api = AuthApi() # noqa: E501 + + def tearDown(self) -> None: + pass + + def test_test_auth_http_basic(self) -> None: + """Test case for test_auth_http_basic + + To test HTTP basic authentication # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_bird.py b/samples/client/echo_api/python-pydantic-v1/test/test_bird.py new file mode 100644 index 00000000000..0ce8736bd8a --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/test/test_bird.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from openapi_client.models.bird import Bird # noqa: E501 + +class TestBird(unittest.TestCase): + """Bird unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Bird: + """Test Bird + 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 `Bird` + """ + model = Bird() # noqa: E501 + if include_optional: + return Bird( + size = '', + color = '' + ) + else: + return Bird( + ) + """ + + def testBird(self): + """Test Bird""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_body_api.py b/samples/client/echo_api/python-pydantic-v1/test/test_body_api.py new file mode 100644 index 00000000000..c98a3ed7e65 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/test/test_body_api.py @@ -0,0 +1,81 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.api.body_api import BodyApi # noqa: E501 + + +class TestBodyApi(unittest.TestCase): + """BodyApi unit test stubs""" + + def setUp(self) -> None: + self.api = BodyApi() # noqa: E501 + + def tearDown(self) -> None: + pass + + def test_test_binary_gif(self) -> None: + """Test case for test_binary_gif + + Test binary (gif) response body # noqa: E501 + """ + pass + + def test_test_body_application_octetstream_binary(self) -> None: + """Test case for test_body_application_octetstream_binary + + Test body parameter(s) # noqa: E501 + """ + pass + + def test_test_body_multipart_formdata_array_of_binary(self) -> None: + """Test case for test_body_multipart_formdata_array_of_binary + + Test array of binary in multipart mime # noqa: E501 + """ + pass + + def test_test_echo_body_free_form_object_response_string(self) -> None: + """Test case for test_echo_body_free_form_object_response_string + + Test free form object # noqa: E501 + """ + pass + + def test_test_echo_body_pet(self) -> None: + """Test case for test_echo_body_pet + + Test body parameter(s) # noqa: E501 + """ + pass + + def test_test_echo_body_pet_response_string(self) -> None: + """Test case for test_echo_body_pet_response_string + + Test empty response body # noqa: E501 + """ + pass + + def test_test_echo_body_tag_response_string(self) -> None: + """Test case for test_echo_body_tag_response_string + + Test empty json (request body) # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_category.py b/samples/client/echo_api/python-pydantic-v1/test/test_category.py new file mode 100644 index 00000000000..487e50d95d5 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/test/test_category.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from openapi_client.models.category import Category # noqa: E501 + +class TestCategory(unittest.TestCase): + """Category unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Category: + """Test Category + 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 `Category` + """ + model = Category() # noqa: E501 + if include_optional: + return Category( + id = 1, + name = 'Dogs' + ) + else: + return Category( + ) + """ + + def testCategory(self): + """Test Category""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_data_query.py b/samples/client/echo_api/python-pydantic-v1/test/test_data_query.py new file mode 100644 index 00000000000..5ae6bdbf877 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/test/test_data_query.py @@ -0,0 +1,55 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from openapi_client.models.data_query import DataQuery # noqa: E501 + +class TestDataQuery(unittest.TestCase): + """DataQuery unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DataQuery: + """Test DataQuery + 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 `DataQuery` + """ + model = DataQuery() # noqa: E501 + if include_optional: + return DataQuery( + suffix = '', + text = 'Some text', + var_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') + ) + else: + return DataQuery( + ) + """ + + def testDataQuery(self): + """Test DataQuery""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_default_value.py b/samples/client/echo_api/python-pydantic-v1/test/test_default_value.py new file mode 100644 index 00000000000..a38f9d85c97 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/test/test_default_value.py @@ -0,0 +1,74 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from openapi_client.models.default_value import DefaultValue # noqa: E501 + +class TestDefaultValue(unittest.TestCase): + """DefaultValue unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DefaultValue: + """Test DefaultValue + 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 `DefaultValue` + """ + model = DefaultValue() # noqa: E501 + if include_optional: + return DefaultValue( + array_string_enum_ref_default = [ + 'success' + ], + array_string_enum_default = [ + 'success' + ], + array_string_default = [ + '' + ], + array_integer_default = [ + 56 + ], + array_string = [ + '' + ], + array_string_nullable = [ + '' + ], + array_string_extension_nullable = [ + '' + ], + string_nullable = '' + ) + else: + return DefaultValue( + ) + """ + + def testDefaultValue(self): + """Test DefaultValue""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_form_api.py b/samples/client/echo_api/python-pydantic-v1/test/test_form_api.py new file mode 100644 index 00000000000..c14aed19441 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/test/test_form_api.py @@ -0,0 +1,46 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.api.form_api import FormApi # noqa: E501 + + +class TestFormApi(unittest.TestCase): + """FormApi unit test stubs""" + + def setUp(self) -> None: + self.api = FormApi() # noqa: E501 + + def tearDown(self) -> None: + pass + + def test_test_form_integer_boolean_string(self) -> None: + """Test case for test_form_integer_boolean_string + + Test form parameter(s) # noqa: E501 + """ + pass + + def test_test_form_oneof(self) -> None: + """Test case for test_form_oneof + + Test form parameter(s) for oneOf schema # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_header_api.py b/samples/client/echo_api/python-pydantic-v1/test/test_header_api.py new file mode 100644 index 00000000000..137bd91a65a --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/test/test_header_api.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.api.header_api import HeaderApi # noqa: E501 + + +class TestHeaderApi(unittest.TestCase): + """HeaderApi unit test stubs""" + + def setUp(self) -> None: + self.api = HeaderApi() # noqa: E501 + + def tearDown(self) -> None: + pass + + def test_test_header_integer_boolean_string(self) -> None: + """Test case for test_header_integer_boolean_string + + Test header parameter(s) # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_number_properties_only.py b/samples/client/echo_api/python-pydantic-v1/test/test_number_properties_only.py new file mode 100644 index 00000000000..e5072e660a2 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/test/test_number_properties_only.py @@ -0,0 +1,55 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from openapi_client.models.number_properties_only import NumberPropertiesOnly # noqa: E501 + +class TestNumberPropertiesOnly(unittest.TestCase): + """NumberPropertiesOnly unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> NumberPropertiesOnly: + """Test NumberPropertiesOnly + 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 `NumberPropertiesOnly` + """ + model = NumberPropertiesOnly() # noqa: E501 + if include_optional: + return NumberPropertiesOnly( + number = 1.337, + float = 1.337, + double = 0.8 + ) + else: + return NumberPropertiesOnly( + ) + """ + + def testNumberPropertiesOnly(self): + """Test NumberPropertiesOnly""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_path_api.py b/samples/client/echo_api/python-pydantic-v1/test/test_path_api.py new file mode 100644 index 00000000000..3a75526f384 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/test/test_path_api.py @@ -0,0 +1,39 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.api.path_api import PathApi # noqa: E501 + + +class TestPathApi(unittest.TestCase): + """PathApi unit test stubs""" + + def setUp(self) -> None: + self.api = PathApi() # noqa: E501 + + def tearDown(self) -> None: + pass + + def test_tests_path_string_path_string_integer_path_integer(self) -> None: + """Test case for tests_path_string_path_string_integer_path_integer + + Test path parameter(s) # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_pet.py b/samples/client/echo_api/python-pydantic-v1/test/test_pet.py new file mode 100644 index 00000000000..17f0d122141 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/test/test_pet.py @@ -0,0 +1,70 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from openapi_client.models.pet import Pet # noqa: E501 + +class TestPet(unittest.TestCase): + """Pet unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Pet: + """Test Pet + 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 `Pet` + """ + model = Pet() # noqa: E501 + if include_optional: + return Pet( + id = 10, + name = 'doggie', + category = openapi_client.models.category.Category( + id = 1, + name = 'Dogs', ), + photo_urls = [ + '' + ], + tags = [ + openapi_client.models.tag.Tag( + id = 56, + name = '', ) + ], + status = 'available' + ) + else: + return Pet( + name = 'doggie', + photo_urls = [ + '' + ], + ) + """ + + def testPet(self): + """Test Pet""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_query.py b/samples/client/echo_api/python-pydantic-v1/test/test_query.py new file mode 100644 index 00000000000..bc3dfd5afd1 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/test/test_query.py @@ -0,0 +1,56 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from openapi_client.models.query import Query # noqa: E501 + +class TestQuery(unittest.TestCase): + """Query unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Query: + """Test Query + 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 `Query` + """ + model = Query() # noqa: E501 + if include_optional: + return Query( + id = 56, + outcomes = [ + 'SUCCESS' + ] + ) + else: + return Query( + ) + """ + + def testQuery(self): + """Test Query""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_query_api.py b/samples/client/echo_api/python-pydantic-v1/test/test_query_api.py new file mode 100644 index 00000000000..b5d971e159c --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/test/test_query_api.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from openapi_client.api.query_api import QueryApi # noqa: E501 + + +class TestQueryApi(unittest.TestCase): + """QueryApi unit test stubs""" + + def setUp(self) -> None: + self.api = QueryApi() # noqa: E501 + + def tearDown(self) -> None: + pass + + def test_test_enum_ref_string(self) -> None: + """Test case for test_enum_ref_string + + Test query parameter(s) # noqa: E501 + """ + pass + + def test_test_query_datetime_date_string(self) -> None: + """Test case for test_query_datetime_date_string + + Test query parameter(s) # noqa: E501 + """ + pass + + def test_test_query_integer_boolean_string(self) -> None: + """Test case for test_query_integer_boolean_string + + Test query parameter(s) # noqa: E501 + """ + pass + + def test_test_query_style_deep_object_explode_true_object(self) -> None: + """Test case for test_query_style_deep_object_explode_true_object + + Test query parameter(s) # noqa: E501 + """ + pass + + def test_test_query_style_deep_object_explode_true_object_all_of(self) -> None: + """Test case for test_query_style_deep_object_explode_true_object_all_of + + Test query parameter(s) # noqa: E501 + """ + pass + + def test_test_query_style_form_explode_true_array_string(self) -> None: + """Test case for test_query_style_form_explode_true_array_string + + Test query parameter(s) # noqa: E501 + """ + pass + + def test_test_query_style_form_explode_true_object(self) -> None: + """Test case for test_query_style_form_explode_true_object + + Test query parameter(s) # noqa: E501 + """ + pass + + def test_test_query_style_form_explode_true_object_all_of(self) -> None: + """Test case for test_query_style_form_explode_true_object_all_of + + Test query parameter(s) # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_string_enum_ref.py b/samples/client/echo_api/python-pydantic-v1/test/test_string_enum_ref.py new file mode 100644 index 00000000000..f48d7776fcc --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/test/test_string_enum_ref.py @@ -0,0 +1,35 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from openapi_client.models.string_enum_ref import StringEnumRef # noqa: E501 + +class TestStringEnumRef(unittest.TestCase): + """StringEnumRef unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testStringEnumRef(self): + """Test StringEnumRef""" + # inst = StringEnumRef() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_tag.py b/samples/client/echo_api/python-pydantic-v1/test/test_tag.py new file mode 100644 index 00000000000..ce6f8f0cdbc --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/test/test_tag.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from openapi_client.models.tag import Tag # noqa: E501 + +class TestTag(unittest.TestCase): + """Tag unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Tag: + """Test Tag + 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 `Tag` + """ + model = Tag() # noqa: E501 + if include_optional: + return Tag( + id = 56, + name = '' + ) + else: + return Tag( + ) + """ + + def testTag(self): + """Test Tag""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py b/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py new file mode 100644 index 00000000000..8063f5b7b63 --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py @@ -0,0 +1,56 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter import TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter # noqa: E501 + +class TestTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(unittest.TestCase): + """TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter: + """Test TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + 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 `TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter` + """ + model = TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter() # noqa: E501 + if include_optional: + return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter( + size = '', + color = '', + id = 1, + name = 'Dogs' + ) + else: + return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter( + ) + """ + + def testTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(self): + """Test TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_form_explode_true_array_string_query_object_parameter.py b/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_form_explode_true_array_string_query_object_parameter.py new file mode 100644 index 00000000000..f0ce75f334f --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_form_explode_true_array_string_query_object_parameter.py @@ -0,0 +1,55 @@ +# coding: utf-8 + +""" + Echo Server API + + Echo Server API + + The version of the OpenAPI document: 0.1.0 + Contact: team@openapitools.org + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter # noqa: E501 + +class TestTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(unittest.TestCase): + """TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter: + """Test TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + 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 `TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter` + """ + model = TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() # noqa: E501 + if include_optional: + return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter( + values = [ + '' + ] + ) + else: + return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter( + ) + """ + + def testTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(self): + """Test TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/tox.ini b/samples/client/echo_api/python-pydantic-v1/tox.ini new file mode 100644 index 00000000000..1a9028b78cc --- /dev/null +++ b/samples/client/echo_api/python-pydantic-v1/tox.ini @@ -0,0 +1,9 @@ +[tox] +envlist = py3 + +[testenv] +deps=-r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + +commands= + pytest --cov=openapi_client diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.github/workflows/python.yml b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.github/workflows/python.yml new file mode 100644 index 00000000000..fed030f265e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.github/workflows/python.yml @@ -0,0 +1,38 @@ +# NOTE: This file is auto generated by OpenAPI Generator. +# URL: https://openapi-generator.tech +# +# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: petstore_api Python package + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.gitignore b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.gitignore new file mode 100644 index 00000000000..43995bd42fa --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.gitignore @@ -0,0 +1,66 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ +venv/ +.venv/ +.python-version +.pytest_cache + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +#Ipython Notebook +.ipynb_checkpoints diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.gitlab-ci.yml b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.gitlab-ci.yml new file mode 100644 index 00000000000..b4719756536 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.gitlab-ci.yml @@ -0,0 +1,31 @@ +# NOTE: This file is auto generated by OpenAPI Generator. +# URL: https://openapi-generator.tech +# +# ref: https://docs.gitlab.com/ee/ci/README.html +# ref: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml + +stages: + - test + +.pytest: + stage: test + script: + - pip install -r requirements.txt + - pip install -r test-requirements.txt + - pytest --cov=petstore_api + +pytest-3.7: + extends: .pytest + image: python:3.7-alpine +pytest-3.8: + extends: .pytest + image: python:3.8-alpine +pytest-3.9: + extends: .pytest + image: python:3.9-alpine +pytest-3.10: + extends: .pytest + image: python:3.10-alpine +pytest-3.11: + extends: .pytest + image: python:3.11-alpine diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator-ignore b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/FILES b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/FILES new file mode 100644 index 00000000000..e943667b1f6 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/FILES @@ -0,0 +1,195 @@ +.github/workflows/python.yml +.gitignore +.gitlab-ci.yml +.travis.yml +README.md +docs/AdditionalPropertiesAnyType.md +docs/AdditionalPropertiesClass.md +docs/AdditionalPropertiesObject.md +docs/AdditionalPropertiesWithDescriptionOnly.md +docs/AllOfWithSingleRef.md +docs/Animal.md +docs/AnotherFakeApi.md +docs/AnyOfColor.md +docs/AnyOfPig.md +docs/ApiResponse.md +docs/ArrayOfArrayOfModel.md +docs/ArrayOfArrayOfNumberOnly.md +docs/ArrayOfNumberOnly.md +docs/ArrayTest.md +docs/BasquePig.md +docs/Capitalization.md +docs/Cat.md +docs/Category.md +docs/CircularReferenceModel.md +docs/ClassModel.md +docs/Client.md +docs/Color.md +docs/Creature.md +docs/CreatureInfo.md +docs/DanishPig.md +docs/DefaultApi.md +docs/DeprecatedObject.md +docs/Dog.md +docs/DummyModel.md +docs/EnumArrays.md +docs/EnumClass.md +docs/EnumString1.md +docs/EnumString2.md +docs/EnumTest.md +docs/FakeApi.md +docs/FakeClassnameTags123Api.md +docs/File.md +docs/FileSchemaTestClass.md +docs/FirstRef.md +docs/Foo.md +docs/FooGetDefaultResponse.md +docs/FormatTest.md +docs/HasOnlyReadOnly.md +docs/HealthCheckResult.md +docs/InnerDictWithProperty.md +docs/IntOrString.md +docs/List.md +docs/MapOfArrayOfModel.md +docs/MapTest.md +docs/MixedPropertiesAndAdditionalPropertiesClass.md +docs/Model200Response.md +docs/ModelReturn.md +docs/Name.md +docs/NullableClass.md +docs/NullableProperty.md +docs/NumberOnly.md +docs/ObjectToTestAdditionalProperties.md +docs/ObjectWithDeprecatedFields.md +docs/OneOfEnumString.md +docs/Order.md +docs/OuterComposite.md +docs/OuterEnum.md +docs/OuterEnumDefaultValue.md +docs/OuterEnumInteger.md +docs/OuterEnumIntegerDefaultValue.md +docs/OuterObjectWithEnumProperty.md +docs/Parent.md +docs/ParentWithOptionalDict.md +docs/Pet.md +docs/PetApi.md +docs/Pig.md +docs/PropertyNameCollision.md +docs/ReadOnlyFirst.md +docs/SecondRef.md +docs/SelfReferenceModel.md +docs/SingleRefType.md +docs/SpecialCharacterEnum.md +docs/SpecialModelName.md +docs/SpecialName.md +docs/StoreApi.md +docs/Tag.md +docs/TestInlineFreeformAdditionalPropertiesRequest.md +docs/Tiger.md +docs/User.md +docs/UserApi.md +docs/WithNestedOneOf.md +git_push.sh +petstore_api/__init__.py +petstore_api/api/__init__.py +petstore_api/api/another_fake_api.py +petstore_api/api/default_api.py +petstore_api/api/fake_api.py +petstore_api/api/fake_classname_tags123_api.py +petstore_api/api/pet_api.py +petstore_api/api/store_api.py +petstore_api/api/user_api.py +petstore_api/api_client.py +petstore_api/api_response.py +petstore_api/configuration.py +petstore_api/exceptions.py +petstore_api/models/__init__.py +petstore_api/models/additional_properties_any_type.py +petstore_api/models/additional_properties_class.py +petstore_api/models/additional_properties_object.py +petstore_api/models/additional_properties_with_description_only.py +petstore_api/models/all_of_with_single_ref.py +petstore_api/models/animal.py +petstore_api/models/any_of_color.py +petstore_api/models/any_of_pig.py +petstore_api/models/api_response.py +petstore_api/models/array_of_array_of_model.py +petstore_api/models/array_of_array_of_number_only.py +petstore_api/models/array_of_number_only.py +petstore_api/models/array_test.py +petstore_api/models/basque_pig.py +petstore_api/models/capitalization.py +petstore_api/models/cat.py +petstore_api/models/category.py +petstore_api/models/circular_reference_model.py +petstore_api/models/class_model.py +petstore_api/models/client.py +petstore_api/models/color.py +petstore_api/models/creature.py +petstore_api/models/creature_info.py +petstore_api/models/danish_pig.py +petstore_api/models/deprecated_object.py +petstore_api/models/dog.py +petstore_api/models/dummy_model.py +petstore_api/models/enum_arrays.py +petstore_api/models/enum_class.py +petstore_api/models/enum_string1.py +petstore_api/models/enum_string2.py +petstore_api/models/enum_test.py +petstore_api/models/file.py +petstore_api/models/file_schema_test_class.py +petstore_api/models/first_ref.py +petstore_api/models/foo.py +petstore_api/models/foo_get_default_response.py +petstore_api/models/format_test.py +petstore_api/models/has_only_read_only.py +petstore_api/models/health_check_result.py +petstore_api/models/inner_dict_with_property.py +petstore_api/models/int_or_string.py +petstore_api/models/list.py +petstore_api/models/map_of_array_of_model.py +petstore_api/models/map_test.py +petstore_api/models/mixed_properties_and_additional_properties_class.py +petstore_api/models/model200_response.py +petstore_api/models/model_return.py +petstore_api/models/name.py +petstore_api/models/nullable_class.py +petstore_api/models/nullable_property.py +petstore_api/models/number_only.py +petstore_api/models/object_to_test_additional_properties.py +petstore_api/models/object_with_deprecated_fields.py +petstore_api/models/one_of_enum_string.py +petstore_api/models/order.py +petstore_api/models/outer_composite.py +petstore_api/models/outer_enum.py +petstore_api/models/outer_enum_default_value.py +petstore_api/models/outer_enum_integer.py +petstore_api/models/outer_enum_integer_default_value.py +petstore_api/models/outer_object_with_enum_property.py +petstore_api/models/parent.py +petstore_api/models/parent_with_optional_dict.py +petstore_api/models/pet.py +petstore_api/models/pig.py +petstore_api/models/property_name_collision.py +petstore_api/models/read_only_first.py +petstore_api/models/second_ref.py +petstore_api/models/self_reference_model.py +petstore_api/models/single_ref_type.py +petstore_api/models/special_character_enum.py +petstore_api/models/special_model_name.py +petstore_api/models/special_name.py +petstore_api/models/tag.py +petstore_api/models/test_inline_freeform_additional_properties_request.py +petstore_api/models/tiger.py +petstore_api/models/user.py +petstore_api/models/with_nested_one_of.py +petstore_api/py.typed +petstore_api/rest.py +petstore_api/signing.py +pyproject.toml +requirements.txt +setup.cfg +setup.py +test-requirements.txt +test/__init__.py +tox.ini diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/VERSION b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/VERSION new file mode 100644 index 00000000000..40e36364ab2 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.travis.yml b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.travis.yml new file mode 100644 index 00000000000..bb28138c5b1 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.travis.yml @@ -0,0 +1,17 @@ +# ref: https://docs.travis-ci.com/user/languages/python +language: python +python: + - "3.7" + - "3.8" + - "3.9" + - "3.10" + - "3.11" + # uncomment the following if needed + #- "3.11-dev" # 3.11 development branch + #- "nightly" # nightly build +# command to install dependencies +install: + - "pip install -r requirements.txt" + - "pip install -r test-requirements.txt" +# command to run tests +script: pytest --cov=petstore_api diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md new file mode 100644 index 00000000000..19e8359feb8 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md @@ -0,0 +1,268 @@ +# petstore-api +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 1.0.0 +- Package version: 1.0.0 +- Build package: org.openapitools.codegen.languages.PythonClientPydanticV1Codegen + +## Requirements. + +Python 3.7+ + +## Installation & Usage +### pip install + +If the python package is hosted on a repository, you can install directly using: + +```sh +pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git +``` +(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`) + +Then import the package: +```python +import petstore_api +``` + +### Setuptools + +Install via [Setuptools](http://pypi.python.org/pypi/setuptools). + +```sh +python setup.py install --user +``` +(or `sudo python setup.py install` to install the package for all users) + +Then import the package: +```python +import petstore_api +``` + +### Tests + +Execute `pytest` to run the tests. + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```python +import datetime +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.AnotherFakeApi(api_client) + client = petstore_api.Client() # Client | client model + + try: + # To test special tags + api_response = await api_instance.call_123_test_special_tags(client) + print("The response of AnotherFakeApi->call_123_test_special_tags:\n") + pprint(api_response) + except ApiException as e: + print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e) + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags +*DefaultApi* | [**foo_get**](docs/DefaultApi.md#foo_get) | **GET** /foo | +*FakeApi* | [**fake_any_type_request_body**](docs/FakeApi.md#fake_any_type_request_body) | **POST** /fake/any_type_body | test any type request body +*FakeApi* | [**fake_enum_ref_query_parameter**](docs/FakeApi.md#fake_enum_ref_query_parameter) | **GET** /fake/enum_ref_query_parameter | test enum reference query parameter +*FakeApi* | [**fake_health_get**](docs/FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint +*FakeApi* | [**fake_http_signature_test**](docs/FakeApi.md#fake_http_signature_test) | **GET** /fake/http-signature-test | test http signature authentication +*FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | +*FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | +*FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | +*FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | +*FakeApi* | [**fake_property_enum_integer_serialize**](docs/FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | +*FakeApi* | [**fake_return_list_of_objects**](docs/FakeApi.md#fake_return_list_of_objects) | **GET** /fake/return_list_of_object | test returning list of objects +*FakeApi* | [**fake_uuid_example**](docs/FakeApi.md#fake_uuid_example) | **GET** /fake/uuid_example | test uuid example +*FakeApi* | [**test_body_with_binary**](docs/FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | +*FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | +*FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | +*FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model +*FakeApi* | [**test_date_time_query_parameter**](docs/FakeApi.md#test_date_time_query_parameter) | **PUT** /fake/date-time-query-params | +*FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**test_group_parameters**](docs/FakeApi.md#test_group_parameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +*FakeApi* | [**test_inline_additional_properties**](docs/FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +*FakeApi* | [**test_inline_freeform_additional_properties**](docs/FakeApi.md#test_inline_freeform_additional_properties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties +*FakeApi* | [**test_json_form_data**](docs/FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeApi* | [**test_query_parameter_collection_format**](docs/FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters | +*FakeClassnameTags123Api* | [**test_classname**](docs/FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case +*PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet +*PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**upload_file_with_required_file**](docs/PetApi.md#upload_file_with_required_file) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +*StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +*StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{order_id} | Find purchase order by ID +*StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet +*UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user +*UserApi* | [**create_users_with_array_input**](docs/UserApi.md#create_users_with_array_input) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**create_users_with_list_input**](docs/UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**delete_user**](docs/UserApi.md#delete_user) | **DELETE** /user/{username} | Delete user +*UserApi* | [**get_user_by_name**](docs/UserApi.md#get_user_by_name) | **GET** /user/{username} | Get user by user name +*UserApi* | [**login_user**](docs/UserApi.md#login_user) | **GET** /user/login | Logs user into the system +*UserApi* | [**logout_user**](docs/UserApi.md#logout_user) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**update_user**](docs/UserApi.md#update_user) | **PUT** /user/{username} | Updated user + + +## Documentation For Models + + - [AdditionalPropertiesAnyType](docs/AdditionalPropertiesAnyType.md) + - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [AdditionalPropertiesObject](docs/AdditionalPropertiesObject.md) + - [AdditionalPropertiesWithDescriptionOnly](docs/AdditionalPropertiesWithDescriptionOnly.md) + - [AllOfWithSingleRef](docs/AllOfWithSingleRef.md) + - [Animal](docs/Animal.md) + - [AnyOfColor](docs/AnyOfColor.md) + - [AnyOfPig](docs/AnyOfPig.md) + - [ApiResponse](docs/ApiResponse.md) + - [ArrayOfArrayOfModel](docs/ArrayOfArrayOfModel.md) + - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) + - [ArrayTest](docs/ArrayTest.md) + - [BasquePig](docs/BasquePig.md) + - [Capitalization](docs/Capitalization.md) + - [Cat](docs/Cat.md) + - [Category](docs/Category.md) + - [CircularReferenceModel](docs/CircularReferenceModel.md) + - [ClassModel](docs/ClassModel.md) + - [Client](docs/Client.md) + - [Color](docs/Color.md) + - [Creature](docs/Creature.md) + - [CreatureInfo](docs/CreatureInfo.md) + - [DanishPig](docs/DanishPig.md) + - [DeprecatedObject](docs/DeprecatedObject.md) + - [Dog](docs/Dog.md) + - [DummyModel](docs/DummyModel.md) + - [EnumArrays](docs/EnumArrays.md) + - [EnumClass](docs/EnumClass.md) + - [EnumString1](docs/EnumString1.md) + - [EnumString2](docs/EnumString2.md) + - [EnumTest](docs/EnumTest.md) + - [File](docs/File.md) + - [FileSchemaTestClass](docs/FileSchemaTestClass.md) + - [FirstRef](docs/FirstRef.md) + - [Foo](docs/Foo.md) + - [FooGetDefaultResponse](docs/FooGetDefaultResponse.md) + - [FormatTest](docs/FormatTest.md) + - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [HealthCheckResult](docs/HealthCheckResult.md) + - [InnerDictWithProperty](docs/InnerDictWithProperty.md) + - [IntOrString](docs/IntOrString.md) + - [List](docs/List.md) + - [MapOfArrayOfModel](docs/MapOfArrayOfModel.md) + - [MapTest](docs/MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](docs/Model200Response.md) + - [ModelReturn](docs/ModelReturn.md) + - [Name](docs/Name.md) + - [NullableClass](docs/NullableClass.md) + - [NullableProperty](docs/NullableProperty.md) + - [NumberOnly](docs/NumberOnly.md) + - [ObjectToTestAdditionalProperties](docs/ObjectToTestAdditionalProperties.md) + - [ObjectWithDeprecatedFields](docs/ObjectWithDeprecatedFields.md) + - [OneOfEnumString](docs/OneOfEnumString.md) + - [Order](docs/Order.md) + - [OuterComposite](docs/OuterComposite.md) + - [OuterEnum](docs/OuterEnum.md) + - [OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md) + - [OuterEnumInteger](docs/OuterEnumInteger.md) + - [OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md) + - [OuterObjectWithEnumProperty](docs/OuterObjectWithEnumProperty.md) + - [Parent](docs/Parent.md) + - [ParentWithOptionalDict](docs/ParentWithOptionalDict.md) + - [Pet](docs/Pet.md) + - [Pig](docs/Pig.md) + - [PropertyNameCollision](docs/PropertyNameCollision.md) + - [ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [SecondRef](docs/SecondRef.md) + - [SelfReferenceModel](docs/SelfReferenceModel.md) + - [SingleRefType](docs/SingleRefType.md) + - [SpecialCharacterEnum](docs/SpecialCharacterEnum.md) + - [SpecialModelName](docs/SpecialModelName.md) + - [SpecialName](docs/SpecialName.md) + - [Tag](docs/Tag.md) + - [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md) + - [Tiger](docs/Tiger.md) + - [User](docs/User.md) + - [WithNestedOneOf](docs/WithNestedOneOf.md) + + + +## Documentation For Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - **write:pets**: modify pets in your account + - **read:pets**: read your pets + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +### api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + + +### http_basic_test + +- **Type**: HTTP basic authentication + + +### bearer_test + +- **Type**: Bearer authentication (JWT) + + +### http_signature_test + +- **Type**: HTTP signature authentication + + +## Author + + + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesAnyType.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesAnyType.md new file mode 100644 index 00000000000..beedef76c05 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesAnyType.md @@ -0,0 +1,28 @@ +# AdditionalPropertiesAnyType + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType + +# TODO update the JSON string below +json = "{}" +# create an instance of AdditionalPropertiesAnyType from a JSON string +additional_properties_any_type_instance = AdditionalPropertiesAnyType.from_json(json) +# print the JSON string representation of the object +print AdditionalPropertiesAnyType.to_json() + +# convert the object into a dict +additional_properties_any_type_dict = additional_properties_any_type_instance.to_dict() +# create an instance of AdditionalPropertiesAnyType from a dict +additional_properties_any_type_form_dict = additional_properties_any_type.from_dict(additional_properties_any_type_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesClass.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesClass.md new file mode 100644 index 00000000000..6abc3136b9c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesClass.md @@ -0,0 +1,29 @@ +# AdditionalPropertiesClass + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**map_property** | **Dict[str, str]** | | [optional] +**map_of_map_property** | **Dict[str, Dict[str, str]]** | | [optional] + +## Example + +```python +from petstore_api.models.additional_properties_class import AdditionalPropertiesClass + +# TODO update the JSON string below +json = "{}" +# create an instance of AdditionalPropertiesClass from a JSON string +additional_properties_class_instance = AdditionalPropertiesClass.from_json(json) +# print the JSON string representation of the object +print AdditionalPropertiesClass.to_json() + +# convert the object into a dict +additional_properties_class_dict = additional_properties_class_instance.to_dict() +# create an instance of AdditionalPropertiesClass from a dict +additional_properties_class_form_dict = additional_properties_class.from_dict(additional_properties_class_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesObject.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesObject.md new file mode 100644 index 00000000000..8b9259c687f --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesObject.md @@ -0,0 +1,28 @@ +# AdditionalPropertiesObject + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.additional_properties_object import AdditionalPropertiesObject + +# TODO update the JSON string below +json = "{}" +# create an instance of AdditionalPropertiesObject from a JSON string +additional_properties_object_instance = AdditionalPropertiesObject.from_json(json) +# print the JSON string representation of the object +print AdditionalPropertiesObject.to_json() + +# convert the object into a dict +additional_properties_object_dict = additional_properties_object_instance.to_dict() +# create an instance of AdditionalPropertiesObject from a dict +additional_properties_object_form_dict = additional_properties_object.from_dict(additional_properties_object_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesWithDescriptionOnly.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesWithDescriptionOnly.md new file mode 100644 index 00000000000..d66094f18e5 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AdditionalPropertiesWithDescriptionOnly.md @@ -0,0 +1,28 @@ +# AdditionalPropertiesWithDescriptionOnly + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.additional_properties_with_description_only import AdditionalPropertiesWithDescriptionOnly + +# TODO update the JSON string below +json = "{}" +# create an instance of AdditionalPropertiesWithDescriptionOnly from a JSON string +additional_properties_with_description_only_instance = AdditionalPropertiesWithDescriptionOnly.from_json(json) +# print the JSON string representation of the object +print AdditionalPropertiesWithDescriptionOnly.to_json() + +# convert the object into a dict +additional_properties_with_description_only_dict = additional_properties_with_description_only_instance.to_dict() +# create an instance of AdditionalPropertiesWithDescriptionOnly from a dict +additional_properties_with_description_only_form_dict = additional_properties_with_description_only.from_dict(additional_properties_with_description_only_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AllOfWithSingleRef.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AllOfWithSingleRef.md new file mode 100644 index 00000000000..1a8b4df7ecc --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AllOfWithSingleRef.md @@ -0,0 +1,29 @@ +# AllOfWithSingleRef + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**username** | **str** | | [optional] +**single_ref_type** | [**SingleRefType**](SingleRefType.md) | | [optional] + +## Example + +```python +from petstore_api.models.all_of_with_single_ref import AllOfWithSingleRef + +# TODO update the JSON string below +json = "{}" +# create an instance of AllOfWithSingleRef from a JSON string +all_of_with_single_ref_instance = AllOfWithSingleRef.from_json(json) +# print the JSON string representation of the object +print AllOfWithSingleRef.to_json() + +# convert the object into a dict +all_of_with_single_ref_dict = all_of_with_single_ref_instance.to_dict() +# create an instance of AllOfWithSingleRef from a dict +all_of_with_single_ref_form_dict = all_of_with_single_ref.from_dict(all_of_with_single_ref_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Animal.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Animal.md new file mode 100644 index 00000000000..b62f1969099 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Animal.md @@ -0,0 +1,29 @@ +# Animal + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_name** | **str** | | +**color** | **str** | | [optional] [default to 'red'] + +## Example + +```python +from petstore_api.models.animal import Animal + +# TODO update the JSON string below +json = "{}" +# create an instance of Animal from a JSON string +animal_instance = Animal.from_json(json) +# print the JSON string representation of the object +print Animal.to_json() + +# convert the object into a dict +animal_dict = animal_instance.to_dict() +# create an instance of Animal from a dict +animal_form_dict = animal.from_dict(animal_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnotherFakeApi.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnotherFakeApi.md new file mode 100644 index 00000000000..95447def35e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnotherFakeApi.md @@ -0,0 +1,76 @@ +# petstore_api.AnotherFakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**call_123_test_special_tags**](AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags + + +# **call_123_test_special_tags** +> Client call_123_test_special_tags(client) + +To test special tags + +To test special tags and operation ID starting with number + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.client import Client +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.AnotherFakeApi(api_client) + client = petstore_api.Client() # Client | client model + + try: + # To test special tags + api_response = await api_instance.call_123_test_special_tags(client) + print("The response of AnotherFakeApi->call_123_test_special_tags:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **client** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnyOfColor.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnyOfColor.md new file mode 100644 index 00000000000..9b161ccba1c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnyOfColor.md @@ -0,0 +1,28 @@ +# AnyOfColor + +Any of RGB array, RGBA array, or hex string. + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Example + +```python +from petstore_api.models.any_of_color import AnyOfColor + +# TODO update the JSON string below +json = "{}" +# create an instance of AnyOfColor from a JSON string +any_of_color_instance = AnyOfColor.from_json(json) +# print the JSON string representation of the object +print AnyOfColor.to_json() + +# convert the object into a dict +any_of_color_dict = any_of_color_instance.to_dict() +# create an instance of AnyOfColor from a dict +any_of_color_form_dict = any_of_color.from_dict(any_of_color_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnyOfPig.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnyOfPig.md new file mode 100644 index 00000000000..2da7ca6eefe --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/AnyOfPig.md @@ -0,0 +1,30 @@ +# AnyOfPig + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_name** | **str** | | +**color** | **str** | | +**size** | **int** | | + +## Example + +```python +from petstore_api.models.any_of_pig import AnyOfPig + +# TODO update the JSON string below +json = "{}" +# create an instance of AnyOfPig from a JSON string +any_of_pig_instance = AnyOfPig.from_json(json) +# print the JSON string representation of the object +print AnyOfPig.to_json() + +# convert the object into a dict +any_of_pig_dict = any_of_pig_instance.to_dict() +# create an instance of AnyOfPig from a dict +any_of_pig_form_dict = any_of_pig.from_dict(any_of_pig_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ApiResponse.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ApiResponse.md new file mode 100644 index 00000000000..ba35ea9e2f0 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ApiResponse.md @@ -0,0 +1,30 @@ +# ApiResponse + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | [optional] +**type** | **str** | | [optional] +**message** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.api_response import ApiResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of ApiResponse from a JSON string +api_response_instance = ApiResponse.from_json(json) +# print the JSON string representation of the object +print ApiResponse.to_json() + +# convert the object into a dict +api_response_dict = api_response_instance.to_dict() +# create an instance of ApiResponse from a dict +api_response_form_dict = api_response.from_dict(api_response_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfArrayOfModel.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfArrayOfModel.md new file mode 100644 index 00000000000..09406159261 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfArrayOfModel.md @@ -0,0 +1,28 @@ +# ArrayOfArrayOfModel + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**another_property** | **List[List[Tag]]** | | [optional] + +## Example + +```python +from petstore_api.models.array_of_array_of_model import ArrayOfArrayOfModel + +# TODO update the JSON string below +json = "{}" +# create an instance of ArrayOfArrayOfModel from a JSON string +array_of_array_of_model_instance = ArrayOfArrayOfModel.from_json(json) +# print the JSON string representation of the object +print ArrayOfArrayOfModel.to_json() + +# convert the object into a dict +array_of_array_of_model_dict = array_of_array_of_model_instance.to_dict() +# create an instance of ArrayOfArrayOfModel from a dict +array_of_array_of_model_form_dict = array_of_array_of_model.from_dict(array_of_array_of_model_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfArrayOfNumberOnly.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 00000000000..3f0c127d4fa --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,28 @@ +# ArrayOfArrayOfNumberOnly + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**array_array_number** | **List[List[float]]** | | [optional] + +## Example + +```python +from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly + +# TODO update the JSON string below +json = "{}" +# create an instance of ArrayOfArrayOfNumberOnly from a JSON string +array_of_array_of_number_only_instance = ArrayOfArrayOfNumberOnly.from_json(json) +# print the JSON string representation of the object +print ArrayOfArrayOfNumberOnly.to_json() + +# convert the object into a dict +array_of_array_of_number_only_dict = array_of_array_of_number_only_instance.to_dict() +# create an instance of ArrayOfArrayOfNumberOnly from a dict +array_of_array_of_number_only_form_dict = array_of_array_of_number_only.from_dict(array_of_array_of_number_only_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfNumberOnly.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfNumberOnly.md new file mode 100644 index 00000000000..c10191915a7 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayOfNumberOnly.md @@ -0,0 +1,28 @@ +# ArrayOfNumberOnly + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**array_number** | **List[float]** | | [optional] + +## Example + +```python +from petstore_api.models.array_of_number_only import ArrayOfNumberOnly + +# TODO update the JSON string below +json = "{}" +# create an instance of ArrayOfNumberOnly from a JSON string +array_of_number_only_instance = ArrayOfNumberOnly.from_json(json) +# print the JSON string representation of the object +print ArrayOfNumberOnly.to_json() + +# convert the object into a dict +array_of_number_only_dict = array_of_number_only_instance.to_dict() +# create an instance of ArrayOfNumberOnly from a dict +array_of_number_only_form_dict = array_of_number_only.from_dict(array_of_number_only_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayTest.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayTest.md new file mode 100644 index 00000000000..0a40fb36d26 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ArrayTest.md @@ -0,0 +1,30 @@ +# ArrayTest + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**array_of_string** | **List[str]** | | [optional] +**array_array_of_integer** | **List[List[int]]** | | [optional] +**array_array_of_model** | **List[List[ReadOnlyFirst]]** | | [optional] + +## Example + +```python +from petstore_api.models.array_test import ArrayTest + +# TODO update the JSON string below +json = "{}" +# create an instance of ArrayTest from a JSON string +array_test_instance = ArrayTest.from_json(json) +# print the JSON string representation of the object +print ArrayTest.to_json() + +# convert the object into a dict +array_test_dict = array_test_instance.to_dict() +# create an instance of ArrayTest from a dict +array_test_form_dict = array_test.from_dict(array_test_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/BasquePig.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/BasquePig.md new file mode 100644 index 00000000000..552b9390c7e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/BasquePig.md @@ -0,0 +1,29 @@ +# BasquePig + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_name** | **str** | | +**color** | **str** | | + +## Example + +```python +from petstore_api.models.basque_pig import BasquePig + +# TODO update the JSON string below +json = "{}" +# create an instance of BasquePig from a JSON string +basque_pig_instance = BasquePig.from_json(json) +# print the JSON string representation of the object +print BasquePig.to_json() + +# convert the object into a dict +basque_pig_dict = basque_pig_instance.to_dict() +# create an instance of BasquePig from a dict +basque_pig_form_dict = basque_pig.from_dict(basque_pig_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Capitalization.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Capitalization.md new file mode 100644 index 00000000000..99e6fae88fd --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Capitalization.md @@ -0,0 +1,33 @@ +# Capitalization + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**small_camel** | **str** | | [optional] +**capital_camel** | **str** | | [optional] +**small_snake** | **str** | | [optional] +**capital_snake** | **str** | | [optional] +**sca_eth_flow_points** | **str** | | [optional] +**att_name** | **str** | Name of the pet | [optional] + +## Example + +```python +from petstore_api.models.capitalization import Capitalization + +# TODO update the JSON string below +json = "{}" +# create an instance of Capitalization from a JSON string +capitalization_instance = Capitalization.from_json(json) +# print the JSON string representation of the object +print Capitalization.to_json() + +# convert the object into a dict +capitalization_dict = capitalization_instance.to_dict() +# create an instance of Capitalization from a dict +capitalization_form_dict = capitalization.from_dict(capitalization_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Cat.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Cat.md new file mode 100644 index 00000000000..4b509dda7ea --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Cat.md @@ -0,0 +1,28 @@ +# Cat + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | **bool** | | [optional] + +## Example + +```python +from petstore_api.models.cat import Cat + +# TODO update the JSON string below +json = "{}" +# create an instance of Cat from a JSON string +cat_instance = Cat.from_json(json) +# print the JSON string representation of the object +print Cat.to_json() + +# convert the object into a dict +cat_dict = cat_instance.to_dict() +# create an instance of Cat from a dict +cat_form_dict = cat.from_dict(cat_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Category.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Category.md new file mode 100644 index 00000000000..c49514ef802 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Category.md @@ -0,0 +1,29 @@ +# Category + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **str** | | [default to 'default-name'] + +## Example + +```python +from petstore_api.models.category import Category + +# TODO update the JSON string below +json = "{}" +# create an instance of Category from a JSON string +category_instance = Category.from_json(json) +# print the JSON string representation of the object +print Category.to_json() + +# convert the object into a dict +category_dict = category_instance.to_dict() +# create an instance of Category from a dict +category_form_dict = category.from_dict(category_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/CircularReferenceModel.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/CircularReferenceModel.md new file mode 100644 index 00000000000..d5e97934d2b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/CircularReferenceModel.md @@ -0,0 +1,29 @@ +# CircularReferenceModel + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | **int** | | [optional] +**nested** | [**FirstRef**](FirstRef.md) | | [optional] + +## Example + +```python +from petstore_api.models.circular_reference_model import CircularReferenceModel + +# TODO update the JSON string below +json = "{}" +# create an instance of CircularReferenceModel from a JSON string +circular_reference_model_instance = CircularReferenceModel.from_json(json) +# print the JSON string representation of the object +print CircularReferenceModel.to_json() + +# convert the object into a dict +circular_reference_model_dict = circular_reference_model_instance.to_dict() +# create an instance of CircularReferenceModel from a dict +circular_reference_model_form_dict = circular_reference_model.from_dict(circular_reference_model_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ClassModel.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ClassModel.md new file mode 100644 index 00000000000..1b6fb7cfc77 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ClassModel.md @@ -0,0 +1,29 @@ +# ClassModel + +Model for testing model with \"_class\" property + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_class** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.class_model import ClassModel + +# TODO update the JSON string below +json = "{}" +# create an instance of ClassModel from a JSON string +class_model_instance = ClassModel.from_json(json) +# print the JSON string representation of the object +print ClassModel.to_json() + +# convert the object into a dict +class_model_dict = class_model_instance.to_dict() +# create an instance of ClassModel from a dict +class_model_form_dict = class_model.from_dict(class_model_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Client.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Client.md new file mode 100644 index 00000000000..b0ded10dd76 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Client.md @@ -0,0 +1,28 @@ +# Client + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**client** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.client import Client + +# TODO update the JSON string below +json = "{}" +# create an instance of Client from a JSON string +client_instance = Client.from_json(json) +# print the JSON string representation of the object +print Client.to_json() + +# convert the object into a dict +client_dict = client_instance.to_dict() +# create an instance of Client from a dict +client_form_dict = client.from_dict(client_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Color.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Color.md new file mode 100644 index 00000000000..07fcd01991a --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Color.md @@ -0,0 +1,28 @@ +# Color + +RGB array, RGBA array, or hex string. + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Example + +```python +from petstore_api.models.color import Color + +# TODO update the JSON string below +json = "{}" +# create an instance of Color from a JSON string +color_instance = Color.from_json(json) +# print the JSON string representation of the object +print Color.to_json() + +# convert the object into a dict +color_dict = color_instance.to_dict() +# create an instance of Color from a dict +color_form_dict = color.from_dict(color_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Creature.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Creature.md new file mode 100644 index 00000000000..54249d5871e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Creature.md @@ -0,0 +1,29 @@ +# Creature + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**info** | [**CreatureInfo**](CreatureInfo.md) | | +**type** | **str** | | + +## Example + +```python +from petstore_api.models.creature import Creature + +# TODO update the JSON string below +json = "{}" +# create an instance of Creature from a JSON string +creature_instance = Creature.from_json(json) +# print the JSON string representation of the object +print Creature.to_json() + +# convert the object into a dict +creature_dict = creature_instance.to_dict() +# create an instance of Creature from a dict +creature_form_dict = creature.from_dict(creature_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/CreatureInfo.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/CreatureInfo.md new file mode 100644 index 00000000000..5a600b9f337 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/CreatureInfo.md @@ -0,0 +1,28 @@ +# CreatureInfo + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | + +## Example + +```python +from petstore_api.models.creature_info import CreatureInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of CreatureInfo from a JSON string +creature_info_instance = CreatureInfo.from_json(json) +# print the JSON string representation of the object +print CreatureInfo.to_json() + +# convert the object into a dict +creature_info_dict = creature_info_instance.to_dict() +# create an instance of CreatureInfo from a dict +creature_info_form_dict = creature_info.from_dict(creature_info_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DanishPig.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DanishPig.md new file mode 100644 index 00000000000..253616c2fc3 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DanishPig.md @@ -0,0 +1,29 @@ +# DanishPig + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_name** | **str** | | +**size** | **int** | | + +## Example + +```python +from petstore_api.models.danish_pig import DanishPig + +# TODO update the JSON string below +json = "{}" +# create an instance of DanishPig from a JSON string +danish_pig_instance = DanishPig.from_json(json) +# print the JSON string representation of the object +print DanishPig.to_json() + +# convert the object into a dict +danish_pig_dict = danish_pig_instance.to_dict() +# create an instance of DanishPig from a dict +danish_pig_form_dict = danish_pig.from_dict(danish_pig_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DefaultApi.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DefaultApi.md new file mode 100644 index 00000000000..55853548401 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DefaultApi.md @@ -0,0 +1,69 @@ +# petstore_api.DefaultApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**foo_get**](DefaultApi.md#foo_get) | **GET** /foo | + + +# **foo_get** +> FooGetDefaultResponse foo_get() + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.foo_get_default_response import FooGetDefaultResponse +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.DefaultApi(api_client) + + try: + api_response = await api_instance.foo_get() + print("The response of DefaultApi->foo_get:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling DefaultApi->foo_get: %s\n" % e) +``` + + + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**0** | response | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DeprecatedObject.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DeprecatedObject.md new file mode 100644 index 00000000000..e6cf5718963 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DeprecatedObject.md @@ -0,0 +1,28 @@ +# DeprecatedObject + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.deprecated_object import DeprecatedObject + +# TODO update the JSON string below +json = "{}" +# create an instance of DeprecatedObject from a JSON string +deprecated_object_instance = DeprecatedObject.from_json(json) +# print the JSON string representation of the object +print DeprecatedObject.to_json() + +# convert the object into a dict +deprecated_object_dict = deprecated_object_instance.to_dict() +# create an instance of DeprecatedObject from a dict +deprecated_object_form_dict = deprecated_object.from_dict(deprecated_object_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Dog.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Dog.md new file mode 100644 index 00000000000..3469be73a76 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Dog.md @@ -0,0 +1,28 @@ +# Dog + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.dog import Dog + +# TODO update the JSON string below +json = "{}" +# create an instance of Dog from a JSON string +dog_instance = Dog.from_json(json) +# print the JSON string representation of the object +print Dog.to_json() + +# convert the object into a dict +dog_dict = dog_instance.to_dict() +# create an instance of Dog from a dict +dog_form_dict = dog.from_dict(dog_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DummyModel.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DummyModel.md new file mode 100644 index 00000000000..e690a8874f8 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/DummyModel.md @@ -0,0 +1,29 @@ +# DummyModel + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**category** | **str** | | [optional] +**self_ref** | [**SelfReferenceModel**](SelfReferenceModel.md) | | [optional] + +## Example + +```python +from petstore_api.models.dummy_model import DummyModel + +# TODO update the JSON string below +json = "{}" +# create an instance of DummyModel from a JSON string +dummy_model_instance = DummyModel.from_json(json) +# print the JSON string representation of the object +print DummyModel.to_json() + +# convert the object into a dict +dummy_model_dict = dummy_model_instance.to_dict() +# create an instance of DummyModel from a dict +dummy_model_form_dict = dummy_model.from_dict(dummy_model_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumArrays.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumArrays.md new file mode 100644 index 00000000000..d21f58a6608 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumArrays.md @@ -0,0 +1,29 @@ +# EnumArrays + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**just_symbol** | **str** | | [optional] +**array_enum** | **List[str]** | | [optional] + +## Example + +```python +from petstore_api.models.enum_arrays import EnumArrays + +# TODO update the JSON string below +json = "{}" +# create an instance of EnumArrays from a JSON string +enum_arrays_instance = EnumArrays.from_json(json) +# print the JSON string representation of the object +print EnumArrays.to_json() + +# convert the object into a dict +enum_arrays_dict = enum_arrays_instance.to_dict() +# create an instance of EnumArrays from a dict +enum_arrays_form_dict = enum_arrays.from_dict(enum_arrays_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumClass.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumClass.md new file mode 100644 index 00000000000..64830e3d1de --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumClass.md @@ -0,0 +1,10 @@ +# EnumClass + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumString1.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumString1.md new file mode 100644 index 00000000000..194d65b48fa --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumString1.md @@ -0,0 +1,10 @@ +# EnumString1 + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumString2.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumString2.md new file mode 100644 index 00000000000..0d8568bfbef --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumString2.md @@ -0,0 +1,10 @@ +# EnumString2 + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumTest.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumTest.md new file mode 100644 index 00000000000..5bcb8e7027e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumTest.md @@ -0,0 +1,36 @@ +# 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] +**outer_enum** | [**OuterEnum**](OuterEnum.md) | | [optional] +**outer_enum_integer** | [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional] +**outer_enum_default_value** | [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] +**outer_enum_integer_default_value** | [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional] + +## Example + +```python +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_form_dict = enum_test.from_dict(enum_test_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeApi.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeApi.md new file mode 100644 index 00000000000..be5d5e850c7 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeApi.md @@ -0,0 +1,1579 @@ +# petstore_api.FakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fake_any_type_request_body**](FakeApi.md#fake_any_type_request_body) | **POST** /fake/any_type_body | test any type request body +[**fake_enum_ref_query_parameter**](FakeApi.md#fake_enum_ref_query_parameter) | **GET** /fake/enum_ref_query_parameter | test enum reference query parameter +[**fake_health_get**](FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint +[**fake_http_signature_test**](FakeApi.md#fake_http_signature_test) | **GET** /fake/http-signature-test | test http signature authentication +[**fake_outer_boolean_serialize**](FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | +[**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | +[**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | +[**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | +[**fake_property_enum_integer_serialize**](FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | +[**fake_return_list_of_objects**](FakeApi.md#fake_return_list_of_objects) | **GET** /fake/return_list_of_object | test returning list of objects +[**fake_uuid_example**](FakeApi.md#fake_uuid_example) | **GET** /fake/uuid_example | test uuid example +[**test_body_with_binary**](FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | +[**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | +[**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | +[**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model +[**test_date_time_query_parameter**](FakeApi.md#test_date_time_query_parameter) | **PUT** /fake/date-time-query-params | +[**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**test_group_parameters**](FakeApi.md#test_group_parameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +[**test_inline_additional_properties**](FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +[**test_inline_freeform_additional_properties**](FakeApi.md#test_inline_freeform_additional_properties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties +[**test_json_form_data**](FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data +[**test_query_parameter_collection_format**](FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters | + + +# **fake_any_type_request_body** +> fake_any_type_request_body(body=body) + +test any type request body + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + body = None # object | (optional) + + try: + # test any type request body + await api_instance.fake_any_type_request_body(body=body) + except Exception as e: + print("Exception when calling FakeApi->fake_any_type_request_body: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **object**| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_enum_ref_query_parameter** +> fake_enum_ref_query_parameter(enum_ref=enum_ref) + +test enum reference query parameter + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.enum_class import EnumClass +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + enum_ref = petstore_api.EnumClass() # EnumClass | enum reference (optional) + + try: + # test enum reference query parameter + await api_instance.fake_enum_ref_query_parameter(enum_ref=enum_ref) + except Exception as e: + print("Exception when calling FakeApi->fake_enum_ref_query_parameter: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enum_ref** | [**EnumClass**](.md)| enum reference | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get successful | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_health_get** +> HealthCheckResult fake_health_get() + +Health check endpoint + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.health_check_result import HealthCheckResult +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + + try: + # Health check endpoint + api_response = await api_instance.fake_health_get() + print("The response of FakeApi->fake_health_get:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FakeApi->fake_health_get: %s\n" % e) +``` + + + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**HealthCheckResult**](HealthCheckResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The instance started successfully | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_http_signature_test** +> fake_http_signature_test(pet, query_1=query_1, header_1=header_1) + +test http signature authentication + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.pet import Pet +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure HTTP message signature: http_signature_test +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See petstore_api.signing for a list of all supported parameters. +from petstore_api import signing +import datetime + +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + signing_info = petstore_api.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, + signed_headers = [ + petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store + query_1 = 'query_1_example' # str | query parameter (optional) + header_1 = 'header_1_example' # str | header parameter (optional) + + try: + # test http signature authentication + await api_instance.fake_http_signature_test(pet, query_1=query_1, header_1=header_1) + except Exception as e: + print("Exception when calling FakeApi->fake_http_signature_test: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **query_1** | **str**| query parameter | [optional] + **header_1** | **str**| header parameter | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[http_signature_test](../README.md#http_signature_test) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The instance started successfully | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_outer_boolean_serialize** +> bool fake_outer_boolean_serialize(body=body) + + + +Test serialization of outer boolean types + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + body = True # bool | Input boolean as post body (optional) + + try: + api_response = await api_instance.fake_outer_boolean_serialize(body=body) + print("The response of FakeApi->fake_outer_boolean_serialize:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FakeApi->fake_outer_boolean_serialize: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **bool**| Input boolean as post body | [optional] + +### Return type + +**bool** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Output boolean | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_outer_composite_serialize** +> OuterComposite fake_outer_composite_serialize(outer_composite=outer_composite) + + + +Test serialization of object with outer number type + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.outer_composite import OuterComposite +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + outer_composite = petstore_api.OuterComposite() # OuterComposite | Input composite as post body (optional) + + try: + api_response = await api_instance.fake_outer_composite_serialize(outer_composite=outer_composite) + print("The response of FakeApi->fake_outer_composite_serialize:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FakeApi->fake_outer_composite_serialize: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **outer_composite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Output composite | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_outer_number_serialize** +> float fake_outer_number_serialize(body=body) + + + +Test serialization of outer number types + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + body = 3.4 # float | Input number as post body (optional) + + try: + api_response = await api_instance.fake_outer_number_serialize(body=body) + print("The response of FakeApi->fake_outer_number_serialize:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FakeApi->fake_outer_number_serialize: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **float**| Input number as post body | [optional] + +### Return type + +**float** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Output number | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_outer_string_serialize** +> str fake_outer_string_serialize(body=body) + + + +Test serialization of outer string types + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + body = 'body_example' # str | Input string as post body (optional) + + try: + api_response = await api_instance.fake_outer_string_serialize(body=body) + print("The response of FakeApi->fake_outer_string_serialize:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FakeApi->fake_outer_string_serialize: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **str**| Input string as post body | [optional] + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Output string | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_property_enum_integer_serialize** +> OuterObjectWithEnumProperty fake_property_enum_integer_serialize(outer_object_with_enum_property) + + + +Test serialization of enum (int) properties with examples + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + outer_object_with_enum_property = petstore_api.OuterObjectWithEnumProperty() # OuterObjectWithEnumProperty | Input enum (int) as post body + + try: + api_response = await api_instance.fake_property_enum_integer_serialize(outer_object_with_enum_property) + print("The response of FakeApi->fake_property_enum_integer_serialize:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FakeApi->fake_property_enum_integer_serialize: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **outer_object_with_enum_property** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)| Input enum (int) as post body | + +### Return type + +[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Output enum (int) | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_return_list_of_objects** +> List[List[Tag]] fake_return_list_of_objects() + +test returning list of objects + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.tag import Tag +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + + try: + # test returning list of objects + api_response = await api_instance.fake_return_list_of_objects() + print("The response of FakeApi->fake_return_list_of_objects:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FakeApi->fake_return_list_of_objects: %s\n" % e) +``` + + + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**List[List[Tag]]** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_uuid_example** +> fake_uuid_example(uuid_example) + +test uuid example + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + uuid_example = '84529ad2-2265-4e15-b76b-c17025d848f6' # str | uuid example + + try: + # test uuid example + await api_instance.fake_uuid_example(uuid_example) + except Exception as e: + print("Exception when calling FakeApi->fake_uuid_example: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **uuid_example** | **str**| uuid example | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get successful | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_body_with_binary** +> test_body_with_binary(body) + + + +For this test, the body has to be a binary file. + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + body = None # bytearray | image to upload + + try: + await api_instance.test_body_with_binary(body) + except Exception as e: + print("Exception when calling FakeApi->test_body_with_binary: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **bytearray**| image to upload | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: image/png + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_body_with_file_schema** +> test_body_with_file_schema(file_schema_test_class) + + + +For this test, the body for this request must reference a schema named `File`. + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.file_schema_test_class import FileSchemaTestClass +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + file_schema_test_class = petstore_api.FileSchemaTestClass() # FileSchemaTestClass | + + try: + await api_instance.test_body_with_file_schema(file_schema_test_class) + except Exception as e: + print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **file_schema_test_class** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_body_with_query_params** +> test_body_with_query_params(query, user) + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.user import User +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + query = 'query_example' # str | + user = petstore_api.User() # User | + + try: + await api_instance.test_body_with_query_params(query, user) + except Exception as e: + print("Exception when calling FakeApi->test_body_with_query_params: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query** | **str**| | + **user** | [**User**](User.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_client_model** +> Client test_client_model(client) + +To test \"client\" model + +To test \"client\" model + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.client import Client +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + client = petstore_api.Client() # Client | client model + + try: + # To test \"client\" model + api_response = await api_instance.test_client_model(client) + print("The response of FakeApi->test_client_model:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FakeApi->test_client_model: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **client** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_date_time_query_parameter** +> test_date_time_query_parameter(date_time_query, str_query) + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + date_time_query = '2013-10-20T19:20:30+01:00' # datetime | + str_query = 'str_query_example' # str | + + try: + await api_instance.test_date_time_query_parameter(date_time_query, str_query) + except Exception as e: + print("Exception when calling FakeApi->test_date_time_query_parameter: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **date_time_query** | **datetime**| | + **str_query** | **str**| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_endpoint_parameters** +> test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, byte_with_max_length=byte_with_max_length, var_date=var_date, date_time=date_time, password=password, param_callback=param_callback) + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example + +* Basic Authentication (http_basic_test): +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure HTTP basic authorization: http_basic_test +configuration = petstore_api.Configuration( + username = os.environ["USERNAME"], + password = os.environ["PASSWORD"] +) + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + number = 3.4 # float | None + double = 3.4 # float | None + pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None + byte = None # bytearray | None + integer = 56 # int | None (optional) + int32 = 56 # int | None (optional) + int64 = 56 # int | None (optional) + float = 3.4 # float | None (optional) + string = 'string_example' # str | None (optional) + binary = None # bytearray | None (optional) + byte_with_max_length = None # bytearray | None (optional) + var_date = '2013-10-20' # date | None (optional) + date_time = '2013-10-20T19:20:30+01:00' # datetime | None (optional) + password = 'password_example' # str | None (optional) + param_callback = 'param_callback_example' # str | None (optional) + + try: + # Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + await api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, byte_with_max_length=byte_with_max_length, var_date=var_date, date_time=date_time, password=password, param_callback=param_callback) + except Exception as e: + print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **float**| None | + **double** | **float**| None | + **pattern_without_delimiter** | **str**| None | + **byte** | **bytearray**| None | + **integer** | **int**| None | [optional] + **int32** | **int**| None | [optional] + **int64** | **int**| None | [optional] + **float** | **float**| None | [optional] + **string** | **str**| None | [optional] + **binary** | **bytearray**| None | [optional] + **byte_with_max_length** | **bytearray**| None | [optional] + **var_date** | **date**| None | [optional] + **date_time** | **datetime**| None | [optional] + **password** | **str**| None | [optional] + **param_callback** | **str**| None | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**400** | Invalid username supplied | - | +**404** | User not found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_group_parameters** +> test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group) + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example + +* Bearer (JWT) Authentication (bearer_test): +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization (JWT): bearer_test +configuration = petstore_api.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + required_string_group = 56 # int | Required String in group parameters + required_boolean_group = True # bool | Required Boolean in group parameters + required_int64_group = 56 # int | Required Integer in group parameters + string_group = 56 # int | String in group parameters (optional) + boolean_group = True # bool | Boolean in group parameters (optional) + int64_group = 56 # int | Integer in group parameters (optional) + + try: + # Fake endpoint to test group parameters (optional) + await api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group) + except Exception as e: + print("Exception when calling FakeApi->test_group_parameters: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **required_string_group** | **int**| Required String in group parameters | + **required_boolean_group** | **bool**| Required Boolean in group parameters | + **required_int64_group** | **int**| Required Integer in group parameters | + **string_group** | **int**| String in group parameters | [optional] + **boolean_group** | **bool**| Boolean in group parameters | [optional] + **int64_group** | **int**| Integer in group parameters | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[bearer_test](../README.md#bearer_test) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**400** | Someting wrong | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_inline_additional_properties** +> test_inline_additional_properties(request_body) + +test inline additionalProperties + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + request_body = {'key': 'request_body_example'} # Dict[str, str] | request body + + try: + # test inline additionalProperties + await api_instance.test_inline_additional_properties(request_body) + except Exception as e: + print("Exception when calling FakeApi->test_inline_additional_properties: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **request_body** | [**Dict[str, str]**](str.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_inline_freeform_additional_properties** +> test_inline_freeform_additional_properties(test_inline_freeform_additional_properties_request) + +test inline free-form additionalProperties + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + test_inline_freeform_additional_properties_request = petstore_api.TestInlineFreeformAdditionalPropertiesRequest() # TestInlineFreeformAdditionalPropertiesRequest | request body + + try: + # test inline free-form additionalProperties + await api_instance.test_inline_freeform_additional_properties(test_inline_freeform_additional_properties_request) + except Exception as e: + print("Exception when calling FakeApi->test_inline_freeform_additional_properties: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **test_inline_freeform_additional_properties_request** | [**TestInlineFreeformAdditionalPropertiesRequest**](TestInlineFreeformAdditionalPropertiesRequest.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_json_form_data** +> test_json_form_data(param, param2) + +test json serialization of form data + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + param = 'param_example' # str | field1 + param2 = 'param2_example' # str | field2 + + try: + # test json serialization of form data + await api_instance.test_json_form_data(param, param2) + except Exception as e: + print("Exception when calling FakeApi->test_json_form_data: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | **str**| field1 | + **param2** | **str**| field2 | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_query_parameter_collection_format** +> test_query_parameter_collection_format(pipe, ioutil, http, url, context, allow_empty, language=language) + + + +To test the collection format in query parameters + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + pipe = ['pipe_example'] # List[str] | + ioutil = ['ioutil_example'] # List[str] | + http = ['http_example'] # List[str] | + url = ['url_example'] # List[str] | + context = ['context_example'] # List[str] | + allow_empty = 'allow_empty_example' # str | + language = {'key': 'language_example'} # Dict[str, str] | (optional) + + try: + await api_instance.test_query_parameter_collection_format(pipe, ioutil, http, url, context, allow_empty, language=language) + except Exception as e: + print("Exception when calling FakeApi->test_query_parameter_collection_format: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pipe** | [**List[str]**](str.md)| | + **ioutil** | [**List[str]**](str.md)| | + **http** | [**List[str]**](str.md)| | + **url** | [**List[str]**](str.md)| | + **context** | [**List[str]**](str.md)| | + **allow_empty** | **str**| | + **language** | [**Dict[str, str]**](str.md)| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeClassnameTags123Api.md new file mode 100644 index 00000000000..3f833a270cd --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FakeClassnameTags123Api.md @@ -0,0 +1,87 @@ +# petstore_api.FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**test_classname**](FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case + + +# **test_classname** +> Client test_classname(client) + +To test class name in snake case + +To test class name in snake case + +### Example + +* Api Key Authentication (api_key_query): +```python +import time +import os +import petstore_api +from petstore_api.models.client import Client +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: api_key_query +configuration.api_key['api_key_query'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['api_key_query'] = 'Bearer' + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeClassnameTags123Api(api_client) + client = petstore_api.Client() # Client | client model + + try: + # To test class name in snake case + api_response = await api_instance.test_classname(client) + print("The response of FakeClassnameTags123Api->test_classname:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FakeClassnameTags123Api->test_classname: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **client** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/File.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/File.md new file mode 100644 index 00000000000..586da8e3255 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/File.md @@ -0,0 +1,29 @@ +# File + +Must be named `File` for test. + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**source_uri** | **str** | Test capitalization | [optional] + +## Example + +```python +from petstore_api.models.file import File + +# TODO update the JSON string below +json = "{}" +# create an instance of File from a JSON string +file_instance = File.from_json(json) +# print the JSON string representation of the object +print File.to_json() + +# convert the object into a dict +file_dict = file_instance.to_dict() +# create an instance of File from a dict +file_form_dict = file.from_dict(file_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FileSchemaTestClass.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FileSchemaTestClass.md new file mode 100644 index 00000000000..fb967a8d992 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FileSchemaTestClass.md @@ -0,0 +1,29 @@ +# FileSchemaTestClass + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | [**File**](File.md) | | [optional] +**files** | [**List[File]**](File.md) | | [optional] + +## Example + +```python +from petstore_api.models.file_schema_test_class import FileSchemaTestClass + +# TODO update the JSON string below +json = "{}" +# create an instance of FileSchemaTestClass from a JSON string +file_schema_test_class_instance = FileSchemaTestClass.from_json(json) +# print the JSON string representation of the object +print FileSchemaTestClass.to_json() + +# convert the object into a dict +file_schema_test_class_dict = file_schema_test_class_instance.to_dict() +# create an instance of FileSchemaTestClass from a dict +file_schema_test_class_form_dict = file_schema_test_class.from_dict(file_schema_test_class_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FirstRef.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FirstRef.md new file mode 100644 index 00000000000..b5e7ab766b4 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FirstRef.md @@ -0,0 +1,29 @@ +# FirstRef + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**category** | **str** | | [optional] +**self_ref** | [**SecondRef**](SecondRef.md) | | [optional] + +## Example + +```python +from petstore_api.models.first_ref import FirstRef + +# TODO update the JSON string below +json = "{}" +# create an instance of FirstRef from a JSON string +first_ref_instance = FirstRef.from_json(json) +# print the JSON string representation of the object +print FirstRef.to_json() + +# convert the object into a dict +first_ref_dict = first_ref_instance.to_dict() +# create an instance of FirstRef from a dict +first_ref_form_dict = first_ref.from_dict(first_ref_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Foo.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Foo.md new file mode 100644 index 00000000000..8062d08df1d --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Foo.md @@ -0,0 +1,28 @@ +# Foo + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **str** | | [optional] [default to 'bar'] + +## Example + +```python +from petstore_api.models.foo import Foo + +# TODO update the JSON string below +json = "{}" +# create an instance of Foo from a JSON string +foo_instance = Foo.from_json(json) +# print the JSON string representation of the object +print Foo.to_json() + +# convert the object into a dict +foo_dict = foo_instance.to_dict() +# create an instance of Foo from a dict +foo_form_dict = foo.from_dict(foo_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FooGetDefaultResponse.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FooGetDefaultResponse.md new file mode 100644 index 00000000000..550fbe78fa1 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FooGetDefaultResponse.md @@ -0,0 +1,28 @@ +# FooGetDefaultResponse + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | [**Foo**](Foo.md) | | [optional] + +## Example + +```python +from petstore_api.models.foo_get_default_response import FooGetDefaultResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of FooGetDefaultResponse from a JSON string +foo_get_default_response_instance = FooGetDefaultResponse.from_json(json) +# print the JSON string representation of the object +print FooGetDefaultResponse.to_json() + +# convert the object into a dict +foo_get_default_response_dict = foo_get_default_response_instance.to_dict() +# create an instance of FooGetDefaultResponse from a dict +foo_get_default_response_form_dict = foo_get_default_response.from_dict(foo_get_default_response_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FormatTest.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FormatTest.md new file mode 100644 index 00000000000..aa81e585952 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/FormatTest.md @@ -0,0 +1,44 @@ +# FormatTest + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **int** | | [optional] +**int32** | **int** | | [optional] +**int64** | **int** | | [optional] +**number** | **float** | | +**float** | **float** | | [optional] +**double** | **float** | | [optional] +**decimal** | **decimal.Decimal** | | [optional] +**string** | **str** | | [optional] +**string_with_double_quote_pattern** | **str** | | [optional] +**byte** | **bytearray** | | [optional] +**binary** | **bytearray** | | [optional] +**var_date** | **date** | | +**date_time** | **datetime** | | [optional] +**uuid** | **str** | | [optional] +**password** | **str** | | +**pattern_with_digits** | **str** | A string that is a 10 digit number. Can have leading zeros. | [optional] +**pattern_with_digits_and_delimiter** | **str** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] + +## Example + +```python +from petstore_api.models.format_test import FormatTest + +# TODO update the JSON string below +json = "{}" +# create an instance of FormatTest from a JSON string +format_test_instance = FormatTest.from_json(json) +# print the JSON string representation of the object +print FormatTest.to_json() + +# convert the object into a dict +format_test_dict = format_test_instance.to_dict() +# create an instance of FormatTest from a dict +format_test_form_dict = format_test.from_dict(format_test_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/HasOnlyReadOnly.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/HasOnlyReadOnly.md new file mode 100644 index 00000000000..99573bd28a2 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/HasOnlyReadOnly.md @@ -0,0 +1,29 @@ +# HasOnlyReadOnly + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **str** | | [optional] [readonly] +**foo** | **str** | | [optional] [readonly] + +## Example + +```python +from petstore_api.models.has_only_read_only import HasOnlyReadOnly + +# TODO update the JSON string below +json = "{}" +# create an instance of HasOnlyReadOnly from a JSON string +has_only_read_only_instance = HasOnlyReadOnly.from_json(json) +# print the JSON string representation of the object +print HasOnlyReadOnly.to_json() + +# convert the object into a dict +has_only_read_only_dict = has_only_read_only_instance.to_dict() +# create an instance of HasOnlyReadOnly from a dict +has_only_read_only_form_dict = has_only_read_only.from_dict(has_only_read_only_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/HealthCheckResult.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/HealthCheckResult.md new file mode 100644 index 00000000000..b8723e018aa --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/HealthCheckResult.md @@ -0,0 +1,29 @@ +# HealthCheckResult + +Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nullable_message** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.health_check_result import HealthCheckResult + +# TODO update the JSON string below +json = "{}" +# create an instance of HealthCheckResult from a JSON string +health_check_result_instance = HealthCheckResult.from_json(json) +# print the JSON string representation of the object +print HealthCheckResult.to_json() + +# convert the object into a dict +health_check_result_dict = health_check_result_instance.to_dict() +# create an instance of HealthCheckResult from a dict +health_check_result_form_dict = health_check_result.from_dict(health_check_result_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/InnerDictWithProperty.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/InnerDictWithProperty.md new file mode 100644 index 00000000000..45d76ad458c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/InnerDictWithProperty.md @@ -0,0 +1,28 @@ +# InnerDictWithProperty + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**a_property** | **object** | | [optional] + +## Example + +```python +from petstore_api.models.inner_dict_with_property import InnerDictWithProperty + +# TODO update the JSON string below +json = "{}" +# create an instance of InnerDictWithProperty from a JSON string +inner_dict_with_property_instance = InnerDictWithProperty.from_json(json) +# print the JSON string representation of the object +print InnerDictWithProperty.to_json() + +# convert the object into a dict +inner_dict_with_property_dict = inner_dict_with_property_instance.to_dict() +# create an instance of InnerDictWithProperty from a dict +inner_dict_with_property_form_dict = inner_dict_with_property.from_dict(inner_dict_with_property_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/IntOrString.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/IntOrString.md new file mode 100644 index 00000000000..0a441f186db --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/IntOrString.md @@ -0,0 +1,27 @@ +# IntOrString + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Example + +```python +from petstore_api.models.int_or_string import IntOrString + +# TODO update the JSON string below +json = "{}" +# create an instance of IntOrString from a JSON string +int_or_string_instance = IntOrString.from_json(json) +# print the JSON string representation of the object +print IntOrString.to_json() + +# convert the object into a dict +int_or_string_dict = int_or_string_instance.to_dict() +# create an instance of IntOrString from a dict +int_or_string_form_dict = int_or_string.from_dict(int_or_string_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/List.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/List.md new file mode 100644 index 00000000000..7643e4ea92d --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/List.md @@ -0,0 +1,28 @@ +# List + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_123_list** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.list import List + +# TODO update the JSON string below +json = "{}" +# create an instance of List from a JSON string +list_instance = List.from_json(json) +# print the JSON string representation of the object +print List.to_json() + +# convert the object into a dict +list_dict = list_instance.to_dict() +# create an instance of List from a dict +list_form_dict = list.from_dict(list_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MapOfArrayOfModel.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MapOfArrayOfModel.md new file mode 100644 index 00000000000..b97ace0f42c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MapOfArrayOfModel.md @@ -0,0 +1,28 @@ +# MapOfArrayOfModel + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shop_id_to_org_online_lip_map** | **Dict[str, List[Tag]]** | | [optional] + +## Example + +```python +from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel + +# TODO update the JSON string below +json = "{}" +# create an instance of MapOfArrayOfModel from a JSON string +map_of_array_of_model_instance = MapOfArrayOfModel.from_json(json) +# print the JSON string representation of the object +print MapOfArrayOfModel.to_json() + +# convert the object into a dict +map_of_array_of_model_dict = map_of_array_of_model_instance.to_dict() +# create an instance of MapOfArrayOfModel from a dict +map_of_array_of_model_form_dict = map_of_array_of_model.from_dict(map_of_array_of_model_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MapTest.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MapTest.md new file mode 100644 index 00000000000..ba87758a522 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MapTest.md @@ -0,0 +1,31 @@ +# MapTest + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**map_map_of_string** | **Dict[str, Dict[str, str]]** | | [optional] +**map_of_enum_string** | **Dict[str, str]** | | [optional] +**direct_map** | **Dict[str, bool]** | | [optional] +**indirect_map** | **Dict[str, bool]** | | [optional] + +## Example + +```python +from petstore_api.models.map_test import MapTest + +# TODO update the JSON string below +json = "{}" +# create an instance of MapTest from a JSON string +map_test_instance = MapTest.from_json(json) +# print the JSON string representation of the object +print MapTest.to_json() + +# convert the object into a dict +map_test_dict = map_test_instance.to_dict() +# create an instance of MapTest from a dict +map_test_form_dict = map_test.from_dict(map_test_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 00000000000..8f628d133ab --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,30 @@ +# MixedPropertiesAndAdditionalPropertiesClass + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **str** | | [optional] +**date_time** | **datetime** | | [optional] +**map** | [**Dict[str, Animal]**](Animal.md) | | [optional] + +## Example + +```python +from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass + +# TODO update the JSON string below +json = "{}" +# create an instance of MixedPropertiesAndAdditionalPropertiesClass from a JSON string +mixed_properties_and_additional_properties_class_instance = MixedPropertiesAndAdditionalPropertiesClass.from_json(json) +# print the JSON string representation of the object +print MixedPropertiesAndAdditionalPropertiesClass.to_json() + +# convert the object into a dict +mixed_properties_and_additional_properties_class_dict = mixed_properties_and_additional_properties_class_instance.to_dict() +# create an instance of MixedPropertiesAndAdditionalPropertiesClass from a dict +mixed_properties_and_additional_properties_class_form_dict = mixed_properties_and_additional_properties_class.from_dict(mixed_properties_and_additional_properties_class_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Model200Response.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Model200Response.md new file mode 100644 index 00000000000..6a20cefe99c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Model200Response.md @@ -0,0 +1,30 @@ +# Model200Response + +Model for testing model name starting with number + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | [optional] +**var_class** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.model200_response import Model200Response + +# TODO update the JSON string below +json = "{}" +# create an instance of Model200Response from a JSON string +model200_response_instance = Model200Response.from_json(json) +# print the JSON string representation of the object +print Model200Response.to_json() + +# convert the object into a dict +model200_response_dict = model200_response_instance.to_dict() +# create an instance of Model200Response from a dict +model200_response_form_dict = model200_response.from_dict(model200_response_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ModelReturn.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ModelReturn.md new file mode 100644 index 00000000000..a5b47f423c8 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ModelReturn.md @@ -0,0 +1,29 @@ +# ModelReturn + +Model for testing reserved words + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_return** | **int** | | [optional] + +## Example + +```python +from petstore_api.models.model_return import ModelReturn + +# TODO update the JSON string below +json = "{}" +# create an instance of ModelReturn from a JSON string +model_return_instance = ModelReturn.from_json(json) +# print the JSON string representation of the object +print ModelReturn.to_json() + +# convert the object into a dict +model_return_dict = model_return_instance.to_dict() +# create an instance of ModelReturn from a dict +model_return_form_dict = model_return.from_dict(model_return_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Name.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Name.md new file mode 100644 index 00000000000..4ccd0ce09aa --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Name.md @@ -0,0 +1,32 @@ +# Name + +Model for testing model name same as property name + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | +**snake_case** | **int** | | [optional] [readonly] +**var_property** | **str** | | [optional] +**var_123_number** | **int** | | [optional] [readonly] + +## Example + +```python +from petstore_api.models.name import Name + +# TODO update the JSON string below +json = "{}" +# create an instance of Name from a JSON string +name_instance = Name.from_json(json) +# print the JSON string representation of the object +print Name.to_json() + +# convert the object into a dict +name_dict = name_instance.to_dict() +# create an instance of Name from a dict +name_form_dict = name.from_dict(name_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NullableClass.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NullableClass.md new file mode 100644 index 00000000000..1658756b50e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NullableClass.md @@ -0,0 +1,40 @@ +# NullableClass + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**required_integer_prop** | **int** | | +**integer_prop** | **int** | | [optional] +**number_prop** | **float** | | [optional] +**boolean_prop** | **bool** | | [optional] +**string_prop** | **str** | | [optional] +**date_prop** | **date** | | [optional] +**datetime_prop** | **datetime** | | [optional] +**array_nullable_prop** | **List[object]** | | [optional] +**array_and_items_nullable_prop** | **List[object]** | | [optional] +**array_items_nullable** | **List[object]** | | [optional] +**object_nullable_prop** | **Dict[str, object]** | | [optional] +**object_and_items_nullable_prop** | **Dict[str, object]** | | [optional] +**object_items_nullable** | **Dict[str, object]** | | [optional] + +## Example + +```python +from petstore_api.models.nullable_class import NullableClass + +# TODO update the JSON string below +json = "{}" +# create an instance of NullableClass from a JSON string +nullable_class_instance = NullableClass.from_json(json) +# print the JSON string representation of the object +print NullableClass.to_json() + +# convert the object into a dict +nullable_class_dict = nullable_class_instance.to_dict() +# create an instance of NullableClass from a dict +nullable_class_form_dict = nullable_class.from_dict(nullable_class_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NullableProperty.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NullableProperty.md new file mode 100644 index 00000000000..fd9cbbc51aa --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NullableProperty.md @@ -0,0 +1,29 @@ +# NullableProperty + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | +**name** | **str** | | + +## Example + +```python +from petstore_api.models.nullable_property import NullableProperty + +# TODO update the JSON string below +json = "{}" +# create an instance of NullableProperty from a JSON string +nullable_property_instance = NullableProperty.from_json(json) +# print the JSON string representation of the object +print NullableProperty.to_json() + +# convert the object into a dict +nullable_property_dict = nullable_property_instance.to_dict() +# create an instance of NullableProperty from a dict +nullable_property_form_dict = nullable_property.from_dict(nullable_property_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NumberOnly.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NumberOnly.md new file mode 100644 index 00000000000..f49216ddaa4 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/NumberOnly.md @@ -0,0 +1,28 @@ +# NumberOnly + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**just_number** | **float** | | [optional] + +## Example + +```python +from petstore_api.models.number_only import NumberOnly + +# TODO update the JSON string below +json = "{}" +# create an instance of NumberOnly from a JSON string +number_only_instance = NumberOnly.from_json(json) +# print the JSON string representation of the object +print NumberOnly.to_json() + +# convert the object into a dict +number_only_dict = number_only_instance.to_dict() +# create an instance of NumberOnly from a dict +number_only_form_dict = number_only.from_dict(number_only_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ObjectToTestAdditionalProperties.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ObjectToTestAdditionalProperties.md new file mode 100644 index 00000000000..c4ba9a95850 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ObjectToTestAdditionalProperties.md @@ -0,0 +1,29 @@ +# ObjectToTestAdditionalProperties + +Minimal object + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_property** | **bool** | Property | [optional] [default to False] + +## Example + +```python +from petstore_api.models.object_to_test_additional_properties import ObjectToTestAdditionalProperties + +# TODO update the JSON string below +json = "{}" +# create an instance of ObjectToTestAdditionalProperties from a JSON string +object_to_test_additional_properties_instance = ObjectToTestAdditionalProperties.from_json(json) +# print the JSON string representation of the object +print ObjectToTestAdditionalProperties.to_json() + +# convert the object into a dict +object_to_test_additional_properties_dict = object_to_test_additional_properties_instance.to_dict() +# create an instance of ObjectToTestAdditionalProperties from a dict +object_to_test_additional_properties_form_dict = object_to_test_additional_properties.from_dict(object_to_test_additional_properties_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ObjectWithDeprecatedFields.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ObjectWithDeprecatedFields.md new file mode 100644 index 00000000000..8daa55a3916 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ObjectWithDeprecatedFields.md @@ -0,0 +1,31 @@ +# ObjectWithDeprecatedFields + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **str** | | [optional] +**id** | **float** | | [optional] +**deprecated_ref** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional] +**bars** | **List[str]** | | [optional] + +## Example + +```python +from petstore_api.models.object_with_deprecated_fields import ObjectWithDeprecatedFields + +# TODO update the JSON string below +json = "{}" +# create an instance of ObjectWithDeprecatedFields from a JSON string +object_with_deprecated_fields_instance = ObjectWithDeprecatedFields.from_json(json) +# print the JSON string representation of the object +print ObjectWithDeprecatedFields.to_json() + +# convert the object into a dict +object_with_deprecated_fields_dict = object_with_deprecated_fields_instance.to_dict() +# create an instance of ObjectWithDeprecatedFields from a dict +object_with_deprecated_fields_form_dict = object_with_deprecated_fields.from_dict(object_with_deprecated_fields_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OneOfEnumString.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OneOfEnumString.md new file mode 100644 index 00000000000..c7c28bc2944 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OneOfEnumString.md @@ -0,0 +1,28 @@ +# OneOfEnumString + +oneOf enum strings + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Example + +```python +from petstore_api.models.one_of_enum_string import OneOfEnumString + +# TODO update the JSON string below +json = "{}" +# create an instance of OneOfEnumString from a JSON string +one_of_enum_string_instance = OneOfEnumString.from_json(json) +# print the JSON string representation of the object +print OneOfEnumString.to_json() + +# convert the object into a dict +one_of_enum_string_dict = one_of_enum_string_instance.to_dict() +# create an instance of OneOfEnumString from a dict +one_of_enum_string_form_dict = one_of_enum_string.from_dict(one_of_enum_string_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Order.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Order.md new file mode 100644 index 00000000000..e71e955a11d --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Order.md @@ -0,0 +1,33 @@ +# Order + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**pet_id** | **int** | | [optional] +**quantity** | **int** | | [optional] +**ship_date** | **datetime** | | [optional] +**status** | **str** | Order Status | [optional] +**complete** | **bool** | | [optional] [default to False] + +## Example + +```python +from petstore_api.models.order import Order + +# TODO update the JSON string below +json = "{}" +# create an instance of Order from a JSON string +order_instance = Order.from_json(json) +# print the JSON string representation of the object +print Order.to_json() + +# convert the object into a dict +order_dict = order_instance.to_dict() +# create an instance of Order from a dict +order_form_dict = order.from_dict(order_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterComposite.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterComposite.md new file mode 100644 index 00000000000..504e266f9a1 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterComposite.md @@ -0,0 +1,30 @@ +# OuterComposite + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**my_number** | **float** | | [optional] +**my_string** | **str** | | [optional] +**my_boolean** | **bool** | | [optional] + +## Example + +```python +from petstore_api.models.outer_composite import OuterComposite + +# TODO update the JSON string below +json = "{}" +# create an instance of OuterComposite from a JSON string +outer_composite_instance = OuterComposite.from_json(json) +# print the JSON string representation of the object +print OuterComposite.to_json() + +# convert the object into a dict +outer_composite_dict = outer_composite_instance.to_dict() +# create an instance of OuterComposite from a dict +outer_composite_form_dict = outer_composite.from_dict(outer_composite_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnum.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnum.md new file mode 100644 index 00000000000..4cb31437c7e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnum.md @@ -0,0 +1,10 @@ +# OuterEnum + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumDefaultValue.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumDefaultValue.md new file mode 100644 index 00000000000..4a5ba6428d8 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumDefaultValue.md @@ -0,0 +1,10 @@ +# OuterEnumDefaultValue + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumInteger.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumInteger.md new file mode 100644 index 00000000000..fc84ec36585 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumInteger.md @@ -0,0 +1,10 @@ +# OuterEnumInteger + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumIntegerDefaultValue.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumIntegerDefaultValue.md new file mode 100644 index 00000000000..0de4199a840 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,10 @@ +# OuterEnumIntegerDefaultValue + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterObjectWithEnumProperty.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterObjectWithEnumProperty.md new file mode 100644 index 00000000000..c6a1cdcbc19 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterObjectWithEnumProperty.md @@ -0,0 +1,29 @@ +# OuterObjectWithEnumProperty + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**str_value** | [**OuterEnum**](OuterEnum.md) | | [optional] +**value** | [**OuterEnumInteger**](OuterEnumInteger.md) | | + +## Example + +```python +from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty + +# TODO update the JSON string below +json = "{}" +# create an instance of OuterObjectWithEnumProperty from a JSON string +outer_object_with_enum_property_instance = OuterObjectWithEnumProperty.from_json(json) +# print the JSON string representation of the object +print OuterObjectWithEnumProperty.to_json() + +# convert the object into a dict +outer_object_with_enum_property_dict = outer_object_with_enum_property_instance.to_dict() +# create an instance of OuterObjectWithEnumProperty from a dict +outer_object_with_enum_property_form_dict = outer_object_with_enum_property.from_dict(outer_object_with_enum_property_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Parent.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Parent.md new file mode 100644 index 00000000000..9a963a6b722 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Parent.md @@ -0,0 +1,28 @@ +# Parent + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**optional_dict** | [**Dict[str, InnerDictWithProperty]**](InnerDictWithProperty.md) | | [optional] + +## Example + +```python +from petstore_api.models.parent import Parent + +# TODO update the JSON string below +json = "{}" +# create an instance of Parent from a JSON string +parent_instance = Parent.from_json(json) +# print the JSON string representation of the object +print Parent.to_json() + +# convert the object into a dict +parent_dict = parent_instance.to_dict() +# create an instance of Parent from a dict +parent_form_dict = parent.from_dict(parent_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ParentWithOptionalDict.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ParentWithOptionalDict.md new file mode 100644 index 00000000000..04bf9494201 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ParentWithOptionalDict.md @@ -0,0 +1,28 @@ +# ParentWithOptionalDict + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**optional_dict** | [**Dict[str, InnerDictWithProperty]**](InnerDictWithProperty.md) | | [optional] + +## Example + +```python +from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict + +# TODO update the JSON string below +json = "{}" +# create an instance of ParentWithOptionalDict from a JSON string +parent_with_optional_dict_instance = ParentWithOptionalDict.from_json(json) +# print the JSON string representation of the object +print ParentWithOptionalDict.to_json() + +# convert the object into a dict +parent_with_optional_dict_dict = parent_with_optional_dict_instance.to_dict() +# create an instance of ParentWithOptionalDict from a dict +parent_with_optional_dict_form_dict = parent_with_optional_dict.from_dict(parent_with_optional_dict_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Pet.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Pet.md new file mode 100644 index 00000000000..05a466f880a --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Pet.md @@ -0,0 +1,33 @@ +# Pet + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **str** | | +**photo_urls** | **List[str]** | | +**tags** | [**List[Tag]**](Tag.md) | | [optional] +**status** | **str** | pet status in the store | [optional] + +## Example + +```python +from petstore_api.models.pet import Pet + +# TODO update the JSON string below +json = "{}" +# create an instance of Pet from a JSON string +pet_instance = Pet.from_json(json) +# print the JSON string representation of the object +print Pet.to_json() + +# convert the object into a dict +pet_dict = pet_instance.to_dict() +# create an instance of Pet from a dict +pet_form_dict = pet.from_dict(pet_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/PetApi.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/PetApi.md new file mode 100644 index 00000000000..e6817874690 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/PetApi.md @@ -0,0 +1,953 @@ +# petstore_api.PetApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_pet**](PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store +[**delete_pet**](PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet +[**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status +[**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags +[**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +[**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet +[**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image +[**upload_file_with_required_file**](PetApi.md#upload_file_with_required_file) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) + + +# **add_pet** +> add_pet(pet) + +Add a new pet to the store + + + +### Example + +* OAuth Authentication (petstore_auth): +```python +import time +import os +import petstore_api +from petstore_api.models.pet import Pet +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Configure HTTP message signature: http_signature_test +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See petstore_api.signing for a list of all supported parameters. +from petstore_api import signing +import datetime + +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + signing_info = petstore_api.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, + signed_headers = [ + petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store + + try: + # Add a new pet to the store + await api_instance.add_pet(pet) + except Exception as e: + print("Exception when calling PetApi->add_pet: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | +**405** | Invalid input | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **delete_pet** +> delete_pet(pet_id, api_key=api_key) + +Deletes a pet + + + +### Example + +* OAuth Authentication (petstore_auth): +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + pet_id = 56 # int | Pet id to delete + api_key = 'api_key_example' # str | (optional) + + try: + # Deletes a pet + await api_instance.delete_pet(pet_id, api_key=api_key) + except Exception as e: + print("Exception when calling PetApi->delete_pet: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| Pet id to delete | + **api_key** | **str**| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | +**400** | Invalid pet value | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **find_pets_by_status** +> List[Pet] find_pets_by_status(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example + +* OAuth Authentication (petstore_auth): +```python +import time +import os +import petstore_api +from petstore_api.models.pet import Pet +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Configure HTTP message signature: http_signature_test +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See petstore_api.signing for a list of all supported parameters. +from petstore_api import signing +import datetime + +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + signing_info = petstore_api.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, + signed_headers = [ + petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + status = ['status_example'] # List[str] | Status values that need to be considered for filter + + try: + # Finds Pets by status + api_response = await api_instance.find_pets_by_status(status) + print("The response of PetApi->find_pets_by_status:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PetApi->find_pets_by_status: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**List[str]**](str.md)| Status values that need to be considered for filter | + +### Return type + +[**List[Pet]**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | +**400** | Invalid status value | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **find_pets_by_tags** +> List[Pet] find_pets_by_tags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example + +* OAuth Authentication (petstore_auth): +```python +import time +import os +import petstore_api +from petstore_api.models.pet import Pet +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Configure HTTP message signature: http_signature_test +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See petstore_api.signing for a list of all supported parameters. +from petstore_api import signing +import datetime + +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + signing_info = petstore_api.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, + signed_headers = [ + petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + tags = ['tags_example'] # List[str] | Tags to filter by + + try: + # Finds Pets by tags + api_response = await api_instance.find_pets_by_tags(tags) + print("The response of PetApi->find_pets_by_tags:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**List[str]**](str.md)| Tags to filter by | + +### Return type + +[**List[Pet]**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | +**400** | Invalid tag value | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_pet_by_id** +> Pet get_pet_by_id(pet_id) + +Find pet by ID + +Returns a single pet + +### Example + +* Api Key Authentication (api_key): +```python +import time +import os +import petstore_api +from petstore_api.models.pet import Pet +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: api_key +configuration.api_key['api_key'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['api_key'] = 'Bearer' + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + pet_id = 56 # int | ID of pet to return + + try: + # Find pet by ID + api_response = await api_instance.get_pet_by_id(pet_id) + print("The response of PetApi->get_pet_by_id:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PetApi->get_pet_by_id: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet to return | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | +**400** | Invalid ID supplied | - | +**404** | Pet not found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **update_pet** +> update_pet(pet) + +Update an existing pet + + + +### Example + +* OAuth Authentication (petstore_auth): +```python +import time +import os +import petstore_api +from petstore_api.models.pet import Pet +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Configure HTTP message signature: http_signature_test +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See petstore_api.signing for a list of all supported parameters. +from petstore_api import signing +import datetime + +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + signing_info = petstore_api.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, + signed_headers = [ + petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store + + try: + # Update an existing pet + await api_instance.update_pet(pet) + except Exception as e: + print("Exception when calling PetApi->update_pet: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | +**400** | Invalid ID supplied | - | +**404** | Pet not found | - | +**405** | Validation exception | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **update_pet_with_form** +> update_pet_with_form(pet_id, name=name, status=status) + +Updates a pet in the store with form data + + + +### Example + +* OAuth Authentication (petstore_auth): +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + pet_id = 56 # int | ID of pet that needs to be updated + name = 'name_example' # str | Updated name of the pet (optional) + status = 'status_example' # str | Updated status of the pet (optional) + + try: + # Updates a pet in the store with form data + await api_instance.update_pet_with_form(pet_id, name=name, status=status) + except Exception as e: + print("Exception when calling PetApi->update_pet_with_form: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet that needs to be updated | + **name** | **str**| Updated name of the pet | [optional] + **status** | **str**| Updated status of the pet | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | +**405** | Invalid input | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **upload_file** +> ApiResponse upload_file(pet_id, additional_metadata=additional_metadata, file=file) + +uploads an image + + + +### Example + +* OAuth Authentication (petstore_auth): +```python +import time +import os +import petstore_api +from petstore_api.models.api_response import ApiResponse +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + pet_id = 56 # int | ID of pet to update + additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional) + file = None # bytearray | file to upload (optional) + + try: + # uploads an image + api_response = await api_instance.upload_file(pet_id, additional_metadata=additional_metadata, file=file) + print("The response of PetApi->upload_file:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PetApi->upload_file: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet to update | + **additional_metadata** | **str**| Additional data to pass to server | [optional] + **file** | **bytearray**| file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **upload_file_with_required_file** +> ApiResponse upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata) + +uploads an image (required) + + + +### Example + +* OAuth Authentication (petstore_auth): +```python +import time +import os +import petstore_api +from petstore_api.models.api_response import ApiResponse +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + pet_id = 56 # int | ID of pet to update + required_file = None # bytearray | file to upload + additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional) + + try: + # uploads an image (required) + api_response = await api_instance.upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata) + print("The response of PetApi->upload_file_with_required_file:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet to update | + **required_file** | **bytearray**| file to upload | + **additional_metadata** | **str**| Additional data to pass to server | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Pig.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Pig.md new file mode 100644 index 00000000000..398d6c6c6e3 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Pig.md @@ -0,0 +1,30 @@ +# Pig + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_name** | **str** | | +**color** | **str** | | +**size** | **int** | | + +## Example + +```python +from petstore_api.models.pig import Pig + +# TODO update the JSON string below +json = "{}" +# create an instance of Pig from a JSON string +pig_instance = Pig.from_json(json) +# print the JSON string representation of the object +print Pig.to_json() + +# convert the object into a dict +pig_dict = pig_instance.to_dict() +# create an instance of Pig from a dict +pig_form_dict = pig.from_dict(pig_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/PropertyNameCollision.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/PropertyNameCollision.md new file mode 100644 index 00000000000..2cc1898be69 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/PropertyNameCollision.md @@ -0,0 +1,30 @@ +# PropertyNameCollision + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | | [optional] +**type** | **str** | | [optional] +**type_** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.property_name_collision import PropertyNameCollision + +# TODO update the JSON string below +json = "{}" +# create an instance of PropertyNameCollision from a JSON string +property_name_collision_instance = PropertyNameCollision.from_json(json) +# print the JSON string representation of the object +print PropertyNameCollision.to_json() + +# convert the object into a dict +property_name_collision_dict = property_name_collision_instance.to_dict() +# create an instance of PropertyNameCollision from a dict +property_name_collision_form_dict = property_name_collision.from_dict(property_name_collision_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ReadOnlyFirst.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ReadOnlyFirst.md new file mode 100644 index 00000000000..22b5acca70c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ReadOnlyFirst.md @@ -0,0 +1,29 @@ +# ReadOnlyFirst + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **str** | | [optional] [readonly] +**baz** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.read_only_first import ReadOnlyFirst + +# TODO update the JSON string below +json = "{}" +# create an instance of ReadOnlyFirst from a JSON string +read_only_first_instance = ReadOnlyFirst.from_json(json) +# print the JSON string representation of the object +print ReadOnlyFirst.to_json() + +# convert the object into a dict +read_only_first_dict = read_only_first_instance.to_dict() +# create an instance of ReadOnlyFirst from a dict +read_only_first_form_dict = read_only_first.from_dict(read_only_first_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SecondRef.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SecondRef.md new file mode 100644 index 00000000000..e6fb1e2d4f7 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SecondRef.md @@ -0,0 +1,29 @@ +# SecondRef + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**category** | **str** | | [optional] +**circular_ref** | [**CircularReferenceModel**](CircularReferenceModel.md) | | [optional] + +## Example + +```python +from petstore_api.models.second_ref import SecondRef + +# TODO update the JSON string below +json = "{}" +# create an instance of SecondRef from a JSON string +second_ref_instance = SecondRef.from_json(json) +# print the JSON string representation of the object +print SecondRef.to_json() + +# convert the object into a dict +second_ref_dict = second_ref_instance.to_dict() +# create an instance of SecondRef from a dict +second_ref_form_dict = second_ref.from_dict(second_ref_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SelfReferenceModel.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SelfReferenceModel.md new file mode 100644 index 00000000000..dbf9589d576 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SelfReferenceModel.md @@ -0,0 +1,29 @@ +# SelfReferenceModel + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | **int** | | [optional] +**nested** | [**DummyModel**](DummyModel.md) | | [optional] + +## Example + +```python +from petstore_api.models.self_reference_model import SelfReferenceModel + +# TODO update the JSON string below +json = "{}" +# create an instance of SelfReferenceModel from a JSON string +self_reference_model_instance = SelfReferenceModel.from_json(json) +# print the JSON string representation of the object +print SelfReferenceModel.to_json() + +# convert the object into a dict +self_reference_model_dict = self_reference_model_instance.to_dict() +# create an instance of SelfReferenceModel from a dict +self_reference_model_form_dict = self_reference_model.from_dict(self_reference_model_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SingleRefType.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SingleRefType.md new file mode 100644 index 00000000000..4178ac3b505 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SingleRefType.md @@ -0,0 +1,10 @@ +# SingleRefType + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialCharacterEnum.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialCharacterEnum.md new file mode 100644 index 00000000000..801c3b5c845 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialCharacterEnum.md @@ -0,0 +1,10 @@ +# SpecialCharacterEnum + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialModelName.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialModelName.md new file mode 100644 index 00000000000..3d27640abb0 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialModelName.md @@ -0,0 +1,28 @@ +# SpecialModelName + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**special_property_name** | **int** | | [optional] + +## Example + +```python +from petstore_api.models.special_model_name import SpecialModelName + +# TODO update the JSON string below +json = "{}" +# create an instance of SpecialModelName from a JSON string +special_model_name_instance = SpecialModelName.from_json(json) +# print the JSON string representation of the object +print SpecialModelName.to_json() + +# convert the object into a dict +special_model_name_dict = special_model_name_instance.to_dict() +# create an instance of SpecialModelName from a dict +special_model_name_form_dict = special_model_name.from_dict(special_model_name_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialName.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialName.md new file mode 100644 index 00000000000..0b412952597 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/SpecialName.md @@ -0,0 +1,30 @@ +# SpecialName + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_property** | **int** | | [optional] +**var_async** | [**Category**](Category.md) | | [optional] +**var_schema** | **str** | pet status in the store | [optional] + +## Example + +```python +from petstore_api.models.special_name import SpecialName + +# TODO update the JSON string below +json = "{}" +# create an instance of SpecialName from a JSON string +special_name_instance = SpecialName.from_json(json) +# print the JSON string representation of the object +print SpecialName.to_json() + +# convert the object into a dict +special_name_dict = special_name_instance.to_dict() +# create an instance of SpecialName from a dict +special_name_form_dict = special_name.from_dict(special_name_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/StoreApi.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/StoreApi.md new file mode 100644 index 00000000000..9d7a7b78170 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/StoreApi.md @@ -0,0 +1,287 @@ +# petstore_api.StoreApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**delete_order**](StoreApi.md#delete_order) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +[**get_inventory**](StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status +[**get_order_by_id**](StoreApi.md#get_order_by_id) | **GET** /store/order/{order_id} | Find purchase order by ID +[**place_order**](StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet + + +# **delete_order** +> delete_order(order_id) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.StoreApi(api_client) + order_id = 'order_id_example' # str | ID of the order that needs to be deleted + + try: + # Delete purchase order by ID + await api_instance.delete_order(order_id) + except Exception as e: + print("Exception when calling StoreApi->delete_order: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order_id** | **str**| ID of the order that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**400** | Invalid ID supplied | - | +**404** | Order not found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_inventory** +> Dict[str, int] get_inventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example + +* Api Key Authentication (api_key): +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: api_key +configuration.api_key['api_key'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['api_key'] = 'Bearer' + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.StoreApi(api_client) + + try: + # Returns pet inventories by status + api_response = await api_instance.get_inventory() + print("The response of StoreApi->get_inventory:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling StoreApi->get_inventory: %s\n" % e) +``` + + + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**Dict[str, int]** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_order_by_id** +> Order get_order_by_id(order_id) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.order import Order +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.StoreApi(api_client) + order_id = 56 # int | ID of pet that needs to be fetched + + try: + # Find purchase order by ID + api_response = await api_instance.get_order_by_id(order_id) + print("The response of StoreApi->get_order_by_id:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling StoreApi->get_order_by_id: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order_id** | **int**| ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | +**400** | Invalid ID supplied | - | +**404** | Order not found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **place_order** +> Order place_order(order) + +Place an order for a pet + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.order import Order +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.StoreApi(api_client) + order = petstore_api.Order() # Order | order placed for purchasing the pet + + try: + # Place an order for a pet + api_response = await api_instance.place_order(order) + print("The response of StoreApi->place_order:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling StoreApi->place_order: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order** | [**Order**](Order.md)| order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | +**400** | Invalid Order | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Tag.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Tag.md new file mode 100644 index 00000000000..e680c68bedd --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Tag.md @@ -0,0 +1,29 @@ +# Tag + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.tag import Tag + +# TODO update the JSON string below +json = "{}" +# create an instance of Tag from a JSON string +tag_instance = Tag.from_json(json) +# print the JSON string representation of the object +print Tag.to_json() + +# convert the object into a dict +tag_dict = tag_instance.to_dict() +# create an instance of Tag from a dict +tag_form_dict = tag.from_dict(tag_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/TestInlineFreeformAdditionalPropertiesRequest.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/TestInlineFreeformAdditionalPropertiesRequest.md new file mode 100644 index 00000000000..7cf86c5244e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/TestInlineFreeformAdditionalPropertiesRequest.md @@ -0,0 +1,28 @@ +# TestInlineFreeformAdditionalPropertiesRequest + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**some_property** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of TestInlineFreeformAdditionalPropertiesRequest from a JSON string +test_inline_freeform_additional_properties_request_instance = TestInlineFreeformAdditionalPropertiesRequest.from_json(json) +# print the JSON string representation of the object +print TestInlineFreeformAdditionalPropertiesRequest.to_json() + +# convert the object into a dict +test_inline_freeform_additional_properties_request_dict = test_inline_freeform_additional_properties_request_instance.to_dict() +# create an instance of TestInlineFreeformAdditionalPropertiesRequest from a dict +test_inline_freeform_additional_properties_request_form_dict = test_inline_freeform_additional_properties_request.from_dict(test_inline_freeform_additional_properties_request_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Tiger.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Tiger.md new file mode 100644 index 00000000000..6ce50a31f5a --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Tiger.md @@ -0,0 +1,28 @@ +# Tiger + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**skill** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.tiger import Tiger + +# TODO update the JSON string below +json = "{}" +# create an instance of Tiger from a JSON string +tiger_instance = Tiger.from_json(json) +# print the JSON string representation of the object +print Tiger.to_json() + +# convert the object into a dict +tiger_dict = tiger_instance.to_dict() +# create an instance of Tiger from a dict +tiger_form_dict = tiger.from_dict(tiger_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/User.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/User.md new file mode 100644 index 00000000000..6d7c357ea86 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/User.md @@ -0,0 +1,35 @@ +# User + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**username** | **str** | | [optional] +**first_name** | **str** | | [optional] +**last_name** | **str** | | [optional] +**email** | **str** | | [optional] +**password** | **str** | | [optional] +**phone** | **str** | | [optional] +**user_status** | **int** | User Status | [optional] + +## Example + +```python +from petstore_api.models.user import User + +# TODO update the JSON string below +json = "{}" +# create an instance of User from a JSON string +user_instance = User.from_json(json) +# print the JSON string representation of the object +print User.to_json() + +# convert the object into a dict +user_dict = user_instance.to_dict() +# create an instance of User from a dict +user_form_dict = user.from_dict(user_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/UserApi.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/UserApi.md new file mode 100644 index 00000000000..0bd69e33d90 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/UserApi.md @@ -0,0 +1,542 @@ +# petstore_api.UserApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_user**](UserApi.md#create_user) | **POST** /user | Create user +[**create_users_with_array_input**](UserApi.md#create_users_with_array_input) | **POST** /user/createWithArray | Creates list of users with given input array +[**create_users_with_list_input**](UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array +[**delete_user**](UserApi.md#delete_user) | **DELETE** /user/{username} | Delete user +[**get_user_by_name**](UserApi.md#get_user_by_name) | **GET** /user/{username} | Get user by user name +[**login_user**](UserApi.md#login_user) | **GET** /user/login | Logs user into the system +[**logout_user**](UserApi.md#logout_user) | **GET** /user/logout | Logs out current logged in user session +[**update_user**](UserApi.md#update_user) | **PUT** /user/{username} | Updated user + + +# **create_user** +> create_user(user) + +Create user + +This can only be done by the logged in user. + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.user import User +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.UserApi(api_client) + user = petstore_api.User() # User | Created user object + + try: + # Create user + await api_instance.create_user(user) + except Exception as e: + print("Exception when calling UserApi->create_user: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**User**](User.md)| Created user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**0** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **create_users_with_array_input** +> create_users_with_array_input(user) + +Creates list of users with given input array + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.user import User +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.UserApi(api_client) + user = [petstore_api.User()] # List[User] | List of user object + + try: + # Creates list of users with given input array + await api_instance.create_users_with_array_input(user) + except Exception as e: + print("Exception when calling UserApi->create_users_with_array_input: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List[User]**](User.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**0** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **create_users_with_list_input** +> create_users_with_list_input(user) + +Creates list of users with given input array + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.user import User +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.UserApi(api_client) + user = [petstore_api.User()] # List[User] | List of user object + + try: + # Creates list of users with given input array + await api_instance.create_users_with_list_input(user) + except Exception as e: + print("Exception when calling UserApi->create_users_with_list_input: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List[User]**](User.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**0** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **delete_user** +> delete_user(username) + +Delete user + +This can only be done by the logged in user. + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.UserApi(api_client) + username = 'username_example' # str | The name that needs to be deleted + + try: + # Delete user + await api_instance.delete_user(username) + except Exception as e: + print("Exception when calling UserApi->delete_user: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **str**| The name that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**400** | Invalid username supplied | - | +**404** | User not found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_user_by_name** +> User get_user_by_name(username) + +Get user by user name + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.user import User +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.UserApi(api_client) + username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing. + + try: + # Get user by user name + api_response = await api_instance.get_user_by_name(username) + print("The response of UserApi->get_user_by_name:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling UserApi->get_user_by_name: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **str**| The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | +**400** | Invalid username supplied | - | +**404** | User not found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **login_user** +> str login_user(username, password) + +Logs user into the system + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.UserApi(api_client) + username = 'username_example' # str | The user name for login + password = 'password_example' # str | The password for login in clear text + + try: + # Logs user into the system + api_response = await api_instance.login_user(username, password) + print("The response of UserApi->login_user:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling UserApi->login_user: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **str**| The user name for login | + **password** | **str**| The password for login in clear text | + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +**400** | Invalid username/password supplied | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **logout_user** +> logout_user() + +Logs out current logged in user session + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.UserApi(api_client) + + try: + # Logs out current logged in user session + await api_instance.logout_user() + except Exception as e: + print("Exception when calling UserApi->logout_user: %s\n" % e) +``` + + + +### Parameters +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**0** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **update_user** +> update_user(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.user import User +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +async with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.UserApi(api_client) + username = 'username_example' # str | name that need to be deleted + user = petstore_api.User() # User | Updated user object + + try: + # Updated user + await api_instance.update_user(username, user) + except Exception as e: + print("Exception when calling UserApi->update_user: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **str**| name that need to be deleted | + **user** | [**User**](User.md)| Updated user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**400** | Invalid user supplied | - | +**404** | User not found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/WithNestedOneOf.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/WithNestedOneOf.md new file mode 100644 index 00000000000..247afcab99d --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/WithNestedOneOf.md @@ -0,0 +1,30 @@ +# WithNestedOneOf + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | **int** | | [optional] +**nested_pig** | [**Pig**](Pig.md) | | [optional] +**nested_oneof_enum_string** | [**OneOfEnumString**](OneOfEnumString.md) | | [optional] + +## Example + +```python +from petstore_api.models.with_nested_one_of import WithNestedOneOf + +# TODO update the JSON string below +json = "{}" +# create an instance of WithNestedOneOf from a JSON string +with_nested_one_of_instance = WithNestedOneOf.from_json(json) +# print the JSON string representation of the object +print WithNestedOneOf.to_json() + +# convert the object into a dict +with_nested_one_of_dict = with_nested_one_of_instance.to_dict() +# create an instance of WithNestedOneOf from a dict +with_nested_one_of_form_dict = with_nested_one_of.from_dict(with_nested_one_of_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/git_push.sh b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/git_push.sh new file mode 100644 index 00000000000..f53a75d4fab --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/__init__.py new file mode 100644 index 00000000000..2023e72fb35 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/__init__.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +# flake8: noqa + +""" + 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 + + +__version__ = "1.0.0" + +# import apis into sdk package +from petstore_api.api.another_fake_api import AnotherFakeApi +from petstore_api.api.default_api import DefaultApi +from petstore_api.api.fake_api import FakeApi +from petstore_api.api.fake_classname_tags123_api import FakeClassnameTags123Api +from petstore_api.api.pet_api import PetApi +from petstore_api.api.store_api import StoreApi +from petstore_api.api.user_api import UserApi + +# import ApiClient +from petstore_api.api_response import ApiResponse +from petstore_api.api_client import ApiClient +from petstore_api.configuration import Configuration +from petstore_api.exceptions import OpenApiException +from petstore_api.exceptions import ApiTypeError +from petstore_api.exceptions import ApiValueError +from petstore_api.exceptions import ApiKeyError +from petstore_api.exceptions import ApiAttributeError +from petstore_api.exceptions import ApiException +from petstore_api.signing import HttpSigningConfiguration + +# import models into sdk package +from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType +from petstore_api.models.additional_properties_class import AdditionalPropertiesClass +from petstore_api.models.additional_properties_object import AdditionalPropertiesObject +from petstore_api.models.additional_properties_with_description_only import AdditionalPropertiesWithDescriptionOnly +from petstore_api.models.all_of_with_single_ref import AllOfWithSingleRef +from petstore_api.models.animal import Animal +from petstore_api.models.any_of_color import AnyOfColor +from petstore_api.models.any_of_pig import AnyOfPig +from petstore_api.models.api_response import ApiResponse +from petstore_api.models.array_of_array_of_model import ArrayOfArrayOfModel +from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly +from petstore_api.models.array_of_number_only import ArrayOfNumberOnly +from petstore_api.models.array_test import ArrayTest +from petstore_api.models.basque_pig import BasquePig +from petstore_api.models.capitalization import Capitalization +from petstore_api.models.cat import Cat +from petstore_api.models.category import Category +from petstore_api.models.circular_reference_model import CircularReferenceModel +from petstore_api.models.class_model import ClassModel +from petstore_api.models.client import Client +from petstore_api.models.color import Color +from petstore_api.models.creature import Creature +from petstore_api.models.creature_info import CreatureInfo +from petstore_api.models.danish_pig import DanishPig +from petstore_api.models.deprecated_object import DeprecatedObject +from petstore_api.models.dog import Dog +from petstore_api.models.dummy_model import DummyModel +from petstore_api.models.enum_arrays import EnumArrays +from petstore_api.models.enum_class import EnumClass +from petstore_api.models.enum_string1 import EnumString1 +from petstore_api.models.enum_string2 import EnumString2 +from petstore_api.models.enum_test import EnumTest +from petstore_api.models.file import File +from petstore_api.models.file_schema_test_class import FileSchemaTestClass +from petstore_api.models.first_ref import FirstRef +from petstore_api.models.foo import Foo +from petstore_api.models.foo_get_default_response import FooGetDefaultResponse +from petstore_api.models.format_test import FormatTest +from petstore_api.models.has_only_read_only import HasOnlyReadOnly +from petstore_api.models.health_check_result import HealthCheckResult +from petstore_api.models.inner_dict_with_property import InnerDictWithProperty +from petstore_api.models.int_or_string import IntOrString +from petstore_api.models.list import List +from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel +from petstore_api.models.map_test import MapTest +from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass +from petstore_api.models.model200_response import Model200Response +from petstore_api.models.model_return import ModelReturn +from petstore_api.models.name import Name +from petstore_api.models.nullable_class import NullableClass +from petstore_api.models.nullable_property import NullableProperty +from petstore_api.models.number_only import NumberOnly +from petstore_api.models.object_to_test_additional_properties import ObjectToTestAdditionalProperties +from petstore_api.models.object_with_deprecated_fields import ObjectWithDeprecatedFields +from petstore_api.models.one_of_enum_string import OneOfEnumString +from petstore_api.models.order import Order +from petstore_api.models.outer_composite import OuterComposite +from petstore_api.models.outer_enum import OuterEnum +from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue +from petstore_api.models.outer_enum_integer import OuterEnumInteger +from petstore_api.models.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue +from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty +from petstore_api.models.parent import Parent +from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict +from petstore_api.models.pet import Pet +from petstore_api.models.pig import Pig +from petstore_api.models.property_name_collision import PropertyNameCollision +from petstore_api.models.read_only_first import ReadOnlyFirst +from petstore_api.models.second_ref import SecondRef +from petstore_api.models.self_reference_model import SelfReferenceModel +from petstore_api.models.single_ref_type import SingleRefType +from petstore_api.models.special_character_enum import SpecialCharacterEnum +from petstore_api.models.special_model_name import SpecialModelName +from petstore_api.models.special_name import SpecialName +from petstore_api.models.tag import Tag +from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest +from petstore_api.models.tiger import Tiger +from petstore_api.models.user import User +from petstore_api.models.with_nested_one_of import WithNestedOneOf diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/__init__.py new file mode 100644 index 00000000000..7a2616975a2 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/__init__.py @@ -0,0 +1,11 @@ +# flake8: noqa + +# import apis into api package +from petstore_api.api.another_fake_api import AnotherFakeApi +from petstore_api.api.default_api import DefaultApi +from petstore_api.api.fake_api import FakeApi +from petstore_api.api.fake_classname_tags123_api import FakeClassnameTags123Api +from petstore_api.api.pet_api import PetApi +from petstore_api.api.store_api import StoreApi +from petstore_api.api.user_api import UserApi + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/another_fake_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/another_fake_api.py new file mode 100644 index 00000000000..1fa3f57bcb2 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/another_fake_api.py @@ -0,0 +1,176 @@ +# 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 re # noqa: F401 +import io +import warnings + +from pydantic import validate_arguments, ValidationError +from typing import overload, Optional, Union, Awaitable + +from typing_extensions import Annotated +from pydantic import Field + +from petstore_api.models.client import Client + +from petstore_api.api_client import ApiClient +from petstore_api.api_response import ApiResponse +from petstore_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class AnotherFakeApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_arguments + async def call_123_test_special_tags(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> Client: # noqa: E501 + """To test special tags # noqa: E501 + + To test special tags and operation ID starting with number # noqa: E501 + + :param client: client model (required) + :type client: Client + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: Client + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the call_123_test_special_tags_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501 + + @validate_arguments + async def call_123_test_special_tags_with_http_info(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> ApiResponse: # noqa: E501 + """To test special tags # noqa: E501 + + To test special tags and operation ID starting with number # noqa: E501 + + :param client: client model (required) + :type client: Client + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(Client, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'client' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method call_123_test_special_tags" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['client'] is not None: + _body_params = _params['client'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "Client", + } + + return await self.api_client.call_api( + '/another-fake/dummy', 'PATCH', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/default_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/default_api.py new file mode 100644 index 00000000000..d2812fd326f --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/default_api.py @@ -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 + + +import re # noqa: F401 +import io +import warnings + +from pydantic import validate_arguments, ValidationError +from typing import overload, Optional, Union, Awaitable + +from petstore_api.models.foo_get_default_response import FooGetDefaultResponse + +from petstore_api.api_client import ApiClient +from petstore_api.api_response import ApiResponse +from petstore_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class DefaultApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_arguments + async def foo_get(self, **kwargs) -> FooGetDefaultResponse: # noqa: E501 + """foo_get # noqa: E501 + + + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: FooGetDefaultResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the foo_get_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.foo_get_with_http_info(**kwargs) # noqa: E501 + + @validate_arguments + async def foo_get_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 + """foo_get # noqa: E501 + + + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(FooGetDefaultResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method foo_get" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + } + + return await self.api_client.call_api( + '/foo', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_api.py new file mode 100644 index 00000000000..975e70cad80 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_api.py @@ -0,0 +1,3028 @@ +# 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 re # noqa: F401 +import io +import warnings + +from pydantic import validate_arguments, ValidationError +from typing import overload, Optional, Union, Awaitable + +from typing_extensions import Annotated +from datetime import date, datetime + +from pydantic import Field, StrictBool, StrictBytes, StrictInt, StrictStr, conbytes, confloat, conint, conlist, constr, validator + +from typing import Any, Dict, List, Optional, Union + +from petstore_api.models.client import Client +from petstore_api.models.enum_class import EnumClass +from petstore_api.models.file_schema_test_class import FileSchemaTestClass +from petstore_api.models.health_check_result import HealthCheckResult +from petstore_api.models.outer_composite import OuterComposite +from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty +from petstore_api.models.pet import Pet +from petstore_api.models.tag import Tag +from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest +from petstore_api.models.user import User + +from petstore_api.api_client import ApiClient +from petstore_api.api_response import ApiResponse +from petstore_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class FakeApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_arguments + async def fake_any_type_request_body(self, body : Optional[Dict[str, Any]] = None, **kwargs) -> None: # noqa: E501 + """test any type request body # noqa: E501 + + + :param body: + :type body: object + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the fake_any_type_request_body_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.fake_any_type_request_body_with_http_info(body, **kwargs) # noqa: E501 + + @validate_arguments + async def fake_any_type_request_body_with_http_info(self, body : Optional[Dict[str, Any]] = None, **kwargs) -> ApiResponse: # noqa: E501 + """test any type request body # noqa: E501 + + + :param body: + :type body: object + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'body' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_any_type_request_body" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['body'] is not None: + _body_params = _params['body'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/fake/any_type_body', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def fake_enum_ref_query_parameter(self, enum_ref : Annotated[Optional[EnumClass], Field(description="enum reference")] = None, **kwargs) -> None: # noqa: E501 + """test enum reference query parameter # noqa: E501 + + + :param enum_ref: enum reference + :type enum_ref: EnumClass + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the fake_enum_ref_query_parameter_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.fake_enum_ref_query_parameter_with_http_info(enum_ref, **kwargs) # noqa: E501 + + @validate_arguments + async def fake_enum_ref_query_parameter_with_http_info(self, enum_ref : Annotated[Optional[EnumClass], Field(description="enum reference")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """test enum reference query parameter # noqa: E501 + + + :param enum_ref: enum reference + :type enum_ref: EnumClass + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'enum_ref' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_enum_ref_query_parameter" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('enum_ref') is not None: # noqa: E501 + _query_params.append(('enum_ref', _params['enum_ref'].value)) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/fake/enum_ref_query_parameter', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def fake_health_get(self, **kwargs) -> HealthCheckResult: # noqa: E501 + """Health check endpoint # noqa: E501 + + + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: HealthCheckResult + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the fake_health_get_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.fake_health_get_with_http_info(**kwargs) # noqa: E501 + + @validate_arguments + async def fake_health_get_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 + """Health check endpoint # noqa: E501 + + + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(HealthCheckResult, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_health_get" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "HealthCheckResult", + } + + return await self.api_client.call_api( + '/fake/health', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def fake_http_signature_test(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], query_1 : Annotated[Optional[StrictStr], Field(description="query parameter")] = None, header_1 : Annotated[Optional[StrictStr], Field(description="header parameter")] = None, **kwargs) -> None: # noqa: E501 + """test http signature authentication # noqa: E501 + + + :param pet: Pet object that needs to be added to the store (required) + :type pet: Pet + :param query_1: query parameter + :type query_1: str + :param header_1: header parameter + :type header_1: str + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the fake_http_signature_test_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.fake_http_signature_test_with_http_info(pet, query_1, header_1, **kwargs) # noqa: E501 + + @validate_arguments + async def fake_http_signature_test_with_http_info(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], query_1 : Annotated[Optional[StrictStr], Field(description="query parameter")] = None, header_1 : Annotated[Optional[StrictStr], Field(description="header parameter")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """test http signature authentication # noqa: E501 + + + :param pet: Pet object that needs to be added to the store (required) + :type pet: Pet + :param query_1: query parameter + :type query_1: str + :param header_1: header parameter + :type header_1: str + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'pet', + 'query_1', + 'header_1' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_http_signature_test" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('query_1') is not None: # noqa: E501 + _query_params.append(('query_1', _params['query_1'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if _params['header_1'] is not None: + _header_params['header_1'] = _params['header_1'] + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['pet'] is not None: + _body_params = _params['pet'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json', 'application/xml'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['http_signature_test'] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/fake/http-signature-test', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def fake_outer_boolean_serialize(self, body : Annotated[Optional[StrictBool], Field(description="Input boolean as post body")] = None, **kwargs) -> bool: # noqa: E501 + """fake_outer_boolean_serialize # noqa: E501 + + Test serialization of outer boolean types # noqa: E501 + + :param body: Input boolean as post body + :type body: bool + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: bool + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the fake_outer_boolean_serialize_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.fake_outer_boolean_serialize_with_http_info(body, **kwargs) # noqa: E501 + + @validate_arguments + async def fake_outer_boolean_serialize_with_http_info(self, body : Annotated[Optional[StrictBool], Field(description="Input boolean as post body")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """fake_outer_boolean_serialize # noqa: E501 + + Test serialization of outer boolean types # noqa: E501 + + :param body: Input boolean as post body + :type body: bool + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(bool, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'body' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_outer_boolean_serialize" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['body'] is not None: + _body_params = _params['body'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "bool", + } + + return await self.api_client.call_api( + '/fake/outer/boolean', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def fake_outer_composite_serialize(self, outer_composite : Annotated[Optional[OuterComposite], Field(description="Input composite as post body")] = None, **kwargs) -> OuterComposite: # noqa: E501 + """fake_outer_composite_serialize # noqa: E501 + + Test serialization of object with outer number type # noqa: E501 + + :param outer_composite: Input composite as post body + :type outer_composite: OuterComposite + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: OuterComposite + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the fake_outer_composite_serialize_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.fake_outer_composite_serialize_with_http_info(outer_composite, **kwargs) # noqa: E501 + + @validate_arguments + async def fake_outer_composite_serialize_with_http_info(self, outer_composite : Annotated[Optional[OuterComposite], Field(description="Input composite as post body")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """fake_outer_composite_serialize # noqa: E501 + + Test serialization of object with outer number type # noqa: E501 + + :param outer_composite: Input composite as post body + :type outer_composite: OuterComposite + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(OuterComposite, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'outer_composite' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_outer_composite_serialize" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['outer_composite'] is not None: + _body_params = _params['outer_composite'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "OuterComposite", + } + + return await self.api_client.call_api( + '/fake/outer/composite', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def fake_outer_number_serialize(self, body : Annotated[Optional[float], Field(description="Input number as post body")] = None, **kwargs) -> float: # noqa: E501 + """fake_outer_number_serialize # noqa: E501 + + Test serialization of outer number types # noqa: E501 + + :param body: Input number as post body + :type body: float + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: float + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the fake_outer_number_serialize_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.fake_outer_number_serialize_with_http_info(body, **kwargs) # noqa: E501 + + @validate_arguments + async def fake_outer_number_serialize_with_http_info(self, body : Annotated[Optional[float], Field(description="Input number as post body")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """fake_outer_number_serialize # noqa: E501 + + Test serialization of outer number types # noqa: E501 + + :param body: Input number as post body + :type body: float + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(float, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'body' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_outer_number_serialize" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['body'] is not None: + _body_params = _params['body'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "float", + } + + return await self.api_client.call_api( + '/fake/outer/number', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def fake_outer_string_serialize(self, body : Annotated[Optional[StrictStr], Field(description="Input string as post body")] = None, **kwargs) -> str: # noqa: E501 + """fake_outer_string_serialize # noqa: E501 + + Test serialization of outer string types # noqa: E501 + + :param body: Input string as post body + :type body: str + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the fake_outer_string_serialize_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.fake_outer_string_serialize_with_http_info(body, **kwargs) # noqa: E501 + + @validate_arguments + async def fake_outer_string_serialize_with_http_info(self, body : Annotated[Optional[StrictStr], Field(description="Input string as post body")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """fake_outer_string_serialize # noqa: E501 + + Test serialization of outer string types # noqa: E501 + + :param body: Input string as post body + :type body: str + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'body' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_outer_string_serialize" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['body'] is not None: + _body_params = _params['body'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "str", + } + + return await self.api_client.call_api( + '/fake/outer/string', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def fake_property_enum_integer_serialize(self, outer_object_with_enum_property : Annotated[OuterObjectWithEnumProperty, Field(..., description="Input enum (int) as post body")], **kwargs) -> OuterObjectWithEnumProperty: # noqa: E501 + """fake_property_enum_integer_serialize # noqa: E501 + + Test serialization of enum (int) properties with examples # noqa: E501 + + :param outer_object_with_enum_property: Input enum (int) as post body (required) + :type outer_object_with_enum_property: OuterObjectWithEnumProperty + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: OuterObjectWithEnumProperty + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the fake_property_enum_integer_serialize_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_property, **kwargs) # noqa: E501 + + @validate_arguments + async def fake_property_enum_integer_serialize_with_http_info(self, outer_object_with_enum_property : Annotated[OuterObjectWithEnumProperty, Field(..., description="Input enum (int) as post body")], **kwargs) -> ApiResponse: # noqa: E501 + """fake_property_enum_integer_serialize # noqa: E501 + + Test serialization of enum (int) properties with examples # noqa: E501 + + :param outer_object_with_enum_property: Input enum (int) as post body (required) + :type outer_object_with_enum_property: OuterObjectWithEnumProperty + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(OuterObjectWithEnumProperty, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'outer_object_with_enum_property' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_property_enum_integer_serialize" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['outer_object_with_enum_property'] is not None: + _body_params = _params['outer_object_with_enum_property'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "OuterObjectWithEnumProperty", + } + + return await self.api_client.call_api( + '/fake/property/enum-int', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def fake_return_list_of_objects(self, **kwargs) -> List[List[Tag]]: # noqa: E501 + """test returning list of objects # noqa: E501 + + + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: List[List[Tag]] + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the fake_return_list_of_objects_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.fake_return_list_of_objects_with_http_info(**kwargs) # noqa: E501 + + @validate_arguments + async def fake_return_list_of_objects_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 + """test returning list of objects # noqa: E501 + + + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(List[List[Tag]], status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_return_list_of_objects" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "List[List[Tag]]", + } + + return await self.api_client.call_api( + '/fake/return_list_of_object', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def fake_uuid_example(self, uuid_example : Annotated[StrictStr, Field(..., description="uuid example")], **kwargs) -> None: # noqa: E501 + """test uuid example # noqa: E501 + + + :param uuid_example: uuid example (required) + :type uuid_example: str + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the fake_uuid_example_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.fake_uuid_example_with_http_info(uuid_example, **kwargs) # noqa: E501 + + @validate_arguments + async def fake_uuid_example_with_http_info(self, uuid_example : Annotated[StrictStr, Field(..., description="uuid example")], **kwargs) -> ApiResponse: # noqa: E501 + """test uuid example # noqa: E501 + + + :param uuid_example: uuid example (required) + :type uuid_example: str + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'uuid_example' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_uuid_example" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('uuid_example') is not None: # noqa: E501 + _query_params.append(('uuid_example', _params['uuid_example'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/fake/uuid_example', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def test_body_with_binary(self, body : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(..., description="image to upload")], **kwargs) -> None: # noqa: E501 + """test_body_with_binary # noqa: E501 + + For this test, the body has to be a binary file. # noqa: E501 + + :param body: image to upload (required) + :type body: bytearray + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_body_with_binary_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.test_body_with_binary_with_http_info(body, **kwargs) # noqa: E501 + + @validate_arguments + async def test_body_with_binary_with_http_info(self, body : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(..., description="image to upload")], **kwargs) -> ApiResponse: # noqa: E501 + """test_body_with_binary # noqa: E501 + + For this test, the body has to be a binary file. # noqa: E501 + + :param body: image to upload (required) + :type body: bytearray + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'body' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_body_with_binary" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['body'] is not None: + _body_params = _params['body'] + # convert to byte array if the input is a file name (str) + if isinstance(_body_params, str): + with io.open(_body_params, "rb") as _fp: + _body_params_from_file = _fp.read() + _body_params = _body_params_from_file + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['image/png'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/fake/body-with-binary', 'PUT', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def test_body_with_file_schema(self, file_schema_test_class : FileSchemaTestClass, **kwargs) -> None: # noqa: E501 + """test_body_with_file_schema # noqa: E501 + + For this test, the body for this request must reference a schema named `File`. # noqa: E501 + + :param file_schema_test_class: (required) + :type file_schema_test_class: FileSchemaTestClass + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_body_with_file_schema_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.test_body_with_file_schema_with_http_info(file_schema_test_class, **kwargs) # noqa: E501 + + @validate_arguments + async def test_body_with_file_schema_with_http_info(self, file_schema_test_class : FileSchemaTestClass, **kwargs) -> ApiResponse: # noqa: E501 + """test_body_with_file_schema # noqa: E501 + + For this test, the body for this request must reference a schema named `File`. # noqa: E501 + + :param file_schema_test_class: (required) + :type file_schema_test_class: FileSchemaTestClass + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'file_schema_test_class' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_body_with_file_schema" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['file_schema_test_class'] is not None: + _body_params = _params['file_schema_test_class'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/fake/body-with-file-schema', 'PUT', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def test_body_with_query_params(self, query : StrictStr, user : User, **kwargs) -> None: # noqa: E501 + """test_body_with_query_params # noqa: E501 + + + :param query: (required) + :type query: str + :param user: (required) + :type user: User + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_body_with_query_params_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.test_body_with_query_params_with_http_info(query, user, **kwargs) # noqa: E501 + + @validate_arguments + async def test_body_with_query_params_with_http_info(self, query : StrictStr, user : User, **kwargs) -> ApiResponse: # noqa: E501 + """test_body_with_query_params # noqa: E501 + + + :param query: (required) + :type query: str + :param user: (required) + :type user: User + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'query', + 'user' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_body_with_query_params" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('query') is not None: # noqa: E501 + _query_params.append(('query', _params['query'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['user'] is not None: + _body_params = _params['user'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/fake/body-with-query-params', 'PUT', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def test_client_model(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> Client: # noqa: E501 + """To test \"client\" model # noqa: E501 + + To test \"client\" model # noqa: E501 + + :param client: client model (required) + :type client: Client + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: Client + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_client_model_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.test_client_model_with_http_info(client, **kwargs) # noqa: E501 + + @validate_arguments + async def test_client_model_with_http_info(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> ApiResponse: # noqa: E501 + """To test \"client\" model # noqa: E501 + + To test \"client\" model # noqa: E501 + + :param client: client model (required) + :type client: Client + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(Client, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'client' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_client_model" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['client'] is not None: + _body_params = _params['client'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "Client", + } + + return await self.api_client.call_api( + '/fake', 'PATCH', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def test_date_time_query_parameter(self, date_time_query : datetime, str_query : StrictStr, **kwargs) -> None: # noqa: E501 + """test_date_time_query_parameter # noqa: E501 + + + :param date_time_query: (required) + :type date_time_query: datetime + :param str_query: (required) + :type str_query: str + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_date_time_query_parameter_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.test_date_time_query_parameter_with_http_info(date_time_query, str_query, **kwargs) # noqa: E501 + + @validate_arguments + async def test_date_time_query_parameter_with_http_info(self, date_time_query : datetime, str_query : StrictStr, **kwargs) -> ApiResponse: # noqa: E501 + """test_date_time_query_parameter # noqa: E501 + + + :param date_time_query: (required) + :type date_time_query: datetime + :param str_query: (required) + :type str_query: str + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'date_time_query', + 'str_query' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_date_time_query_parameter" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('date_time_query') is not None: # noqa: E501 + if isinstance(_params['date_time_query'], datetime): + _query_params.append(('date_time_query', _params['date_time_query'].strftime(self.api_client.configuration.datetime_format))) + else: + _query_params.append(('date_time_query', _params['date_time_query'])) + + if _params.get('str_query') is not None: # noqa: E501 + _query_params.append(('str_query', _params['str_query'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/fake/date-time-query-params', 'PUT', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def test_endpoint_parameters(self, number : Annotated[confloat(le=543.2, ge=32.1), Field(..., description="None")], double : Annotated[confloat(le=123.4, ge=67.8), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(le=987.6)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[conbytes(strict=True, max_length=64), constr(strict=True, max_length=64)]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> None: # noqa: E501 + """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 + + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 + + :param number: None (required) + :type number: float + :param double: None (required) + :type double: float + :param pattern_without_delimiter: None (required) + :type pattern_without_delimiter: str + :param byte: None (required) + :type byte: bytearray + :param integer: None + :type integer: int + :param int32: None + :type int32: int + :param int64: None + :type int64: int + :param float: None + :type float: float + :param string: None + :type string: str + :param binary: None + :type binary: bytearray + :param byte_with_max_length: None + :type byte_with_max_length: bytearray + :param var_date: None + :type var_date: date + :param date_time: None + :type date_time: datetime + :param password: None + :type password: str + :param param_callback: None + :type param_callback: str + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_endpoint_parameters_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, integer, int32, int64, float, string, binary, byte_with_max_length, var_date, date_time, password, param_callback, **kwargs) # noqa: E501 + + @validate_arguments + async def test_endpoint_parameters_with_http_info(self, number : Annotated[confloat(le=543.2, ge=32.1), Field(..., description="None")], double : Annotated[confloat(le=123.4, ge=67.8), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(le=987.6)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[conbytes(strict=True, max_length=64), constr(strict=True, max_length=64)]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 + + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 + + :param number: None (required) + :type number: float + :param double: None (required) + :type double: float + :param pattern_without_delimiter: None (required) + :type pattern_without_delimiter: str + :param byte: None (required) + :type byte: bytearray + :param integer: None + :type integer: int + :param int32: None + :type int32: int + :param int64: None + :type int64: int + :param float: None + :type float: float + :param string: None + :type string: str + :param binary: None + :type binary: bytearray + :param byte_with_max_length: None + :type byte_with_max_length: bytearray + :param var_date: None + :type var_date: date + :param date_time: None + :type date_time: datetime + :param password: None + :type password: str + :param param_callback: None + :type param_callback: str + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'number', + 'double', + 'pattern_without_delimiter', + 'byte', + 'integer', + 'int32', + 'int64', + 'float', + 'string', + 'binary', + 'byte_with_max_length', + 'var_date', + 'date_time', + 'password', + 'param_callback' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_endpoint_parameters" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + if _params['integer'] is not None: + _form_params.append(('integer', _params['integer'])) + + if _params['int32'] is not None: + _form_params.append(('int32', _params['int32'])) + + if _params['int64'] is not None: + _form_params.append(('int64', _params['int64'])) + + if _params['number'] is not None: + _form_params.append(('number', _params['number'])) + + if _params['float'] is not None: + _form_params.append(('float', _params['float'])) + + if _params['double'] is not None: + _form_params.append(('double', _params['double'])) + + if _params['string'] is not None: + _form_params.append(('string', _params['string'])) + + if _params['pattern_without_delimiter'] is not None: + _form_params.append(('pattern_without_delimiter', _params['pattern_without_delimiter'])) + + if _params['byte'] is not None: + _form_params.append(('byte', _params['byte'])) + + if _params['binary'] is not None: + _files['binary'] = _params['binary'] + + if _params['byte_with_max_length'] is not None: + _form_params.append(('byte_with_max_length', _params['byte_with_max_length'])) + + if _params['var_date'] is not None: + _form_params.append(('date', _params['var_date'])) + + if _params['date_time'] is not None: + _form_params.append(('dateTime', _params['date_time'])) + + if _params['password'] is not None: + _form_params.append(('password', _params['password'])) + + if _params['param_callback'] is not None: + _form_params.append(('callback', _params['param_callback'])) + + # process the body parameter + _body_params = None + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/x-www-form-urlencoded'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['http_basic_test'] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/fake', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def test_group_parameters(self, required_string_group : Annotated[StrictInt, Field(..., description="Required String in group parameters")], required_boolean_group : Annotated[StrictBool, Field(..., description="Required Boolean in group parameters")], required_int64_group : Annotated[StrictInt, Field(..., description="Required Integer in group parameters")], string_group : Annotated[Optional[StrictInt], Field(description="String in group parameters")] = None, boolean_group : Annotated[Optional[StrictBool], Field(description="Boolean in group parameters")] = None, int64_group : Annotated[Optional[StrictInt], Field(description="Integer in group parameters")] = None, **kwargs) -> None: # noqa: E501 + """Fake endpoint to test group parameters (optional) # noqa: E501 + + Fake endpoint to test group parameters (optional) # noqa: E501 + + :param required_string_group: Required String in group parameters (required) + :type required_string_group: int + :param required_boolean_group: Required Boolean in group parameters (required) + :type required_boolean_group: bool + :param required_int64_group: Required Integer in group parameters (required) + :type required_int64_group: int + :param string_group: String in group parameters + :type string_group: int + :param boolean_group: Boolean in group parameters + :type boolean_group: bool + :param int64_group: Integer in group parameters + :type int64_group: int + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_group_parameters_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.test_group_parameters_with_http_info(required_string_group, required_boolean_group, required_int64_group, string_group, boolean_group, int64_group, **kwargs) # noqa: E501 + + @validate_arguments + async def test_group_parameters_with_http_info(self, required_string_group : Annotated[StrictInt, Field(..., description="Required String in group parameters")], required_boolean_group : Annotated[StrictBool, Field(..., description="Required Boolean in group parameters")], required_int64_group : Annotated[StrictInt, Field(..., description="Required Integer in group parameters")], string_group : Annotated[Optional[StrictInt], Field(description="String in group parameters")] = None, boolean_group : Annotated[Optional[StrictBool], Field(description="Boolean in group parameters")] = None, int64_group : Annotated[Optional[StrictInt], Field(description="Integer in group parameters")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Fake endpoint to test group parameters (optional) # noqa: E501 + + Fake endpoint to test group parameters (optional) # noqa: E501 + + :param required_string_group: Required String in group parameters (required) + :type required_string_group: int + :param required_boolean_group: Required Boolean in group parameters (required) + :type required_boolean_group: bool + :param required_int64_group: Required Integer in group parameters (required) + :type required_int64_group: int + :param string_group: String in group parameters + :type string_group: int + :param boolean_group: Boolean in group parameters + :type boolean_group: bool + :param int64_group: Integer in group parameters + :type int64_group: int + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'required_string_group', + 'required_boolean_group', + 'required_int64_group', + 'string_group', + 'boolean_group', + 'int64_group' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_group_parameters" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('required_string_group') is not None: # noqa: E501 + _query_params.append(('required_string_group', _params['required_string_group'])) + + if _params.get('required_int64_group') is not None: # noqa: E501 + _query_params.append(('required_int64_group', _params['required_int64_group'])) + + if _params.get('string_group') is not None: # noqa: E501 + _query_params.append(('string_group', _params['string_group'])) + + if _params.get('int64_group') is not None: # noqa: E501 + _query_params.append(('int64_group', _params['int64_group'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if _params['required_boolean_group'] is not None: + _header_params['required_boolean_group'] = _params['required_boolean_group'] + + if _params['boolean_group'] is not None: + _header_params['boolean_group'] = _params['boolean_group'] + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # authentication setting + _auth_settings = ['bearer_test'] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/fake', 'DELETE', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def test_inline_additional_properties(self, request_body : Annotated[Dict[str, StrictStr], Field(..., description="request body")], **kwargs) -> None: # noqa: E501 + """test inline additionalProperties # noqa: E501 + + # noqa: E501 + + :param request_body: request body (required) + :type request_body: Dict[str, str] + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_inline_additional_properties_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.test_inline_additional_properties_with_http_info(request_body, **kwargs) # noqa: E501 + + @validate_arguments + async def test_inline_additional_properties_with_http_info(self, request_body : Annotated[Dict[str, StrictStr], Field(..., description="request body")], **kwargs) -> ApiResponse: # noqa: E501 + """test inline additionalProperties # noqa: E501 + + # noqa: E501 + + :param request_body: request body (required) + :type request_body: Dict[str, str] + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'request_body' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_inline_additional_properties" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['request_body'] is not None: + _body_params = _params['request_body'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/fake/inline-additionalProperties', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def test_inline_freeform_additional_properties(self, test_inline_freeform_additional_properties_request : Annotated[TestInlineFreeformAdditionalPropertiesRequest, Field(..., description="request body")], **kwargs) -> None: # noqa: E501 + """test inline free-form additionalProperties # noqa: E501 + + # noqa: E501 + + :param test_inline_freeform_additional_properties_request: request body (required) + :type test_inline_freeform_additional_properties_request: TestInlineFreeformAdditionalPropertiesRequest + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_inline_freeform_additional_properties_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.test_inline_freeform_additional_properties_with_http_info(test_inline_freeform_additional_properties_request, **kwargs) # noqa: E501 + + @validate_arguments + async def test_inline_freeform_additional_properties_with_http_info(self, test_inline_freeform_additional_properties_request : Annotated[TestInlineFreeformAdditionalPropertiesRequest, Field(..., description="request body")], **kwargs) -> ApiResponse: # noqa: E501 + """test inline free-form additionalProperties # noqa: E501 + + # noqa: E501 + + :param test_inline_freeform_additional_properties_request: request body (required) + :type test_inline_freeform_additional_properties_request: TestInlineFreeformAdditionalPropertiesRequest + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'test_inline_freeform_additional_properties_request' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_inline_freeform_additional_properties" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['test_inline_freeform_additional_properties_request'] is not None: + _body_params = _params['test_inline_freeform_additional_properties_request'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/fake/inline-freeform-additionalProperties', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def test_json_form_data(self, param : Annotated[StrictStr, Field(..., description="field1")], param2 : Annotated[StrictStr, Field(..., description="field2")], **kwargs) -> None: # noqa: E501 + """test json serialization of form data # noqa: E501 + + # noqa: E501 + + :param param: field1 (required) + :type param: str + :param param2: field2 (required) + :type param2: str + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_json_form_data_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.test_json_form_data_with_http_info(param, param2, **kwargs) # noqa: E501 + + @validate_arguments + async def test_json_form_data_with_http_info(self, param : Annotated[StrictStr, Field(..., description="field1")], param2 : Annotated[StrictStr, Field(..., description="field2")], **kwargs) -> ApiResponse: # noqa: E501 + """test json serialization of form data # noqa: E501 + + # noqa: E501 + + :param param: field1 (required) + :type param: str + :param param2: field2 (required) + :type param2: str + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'param', + 'param2' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_json_form_data" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + if _params['param'] is not None: + _form_params.append(('param', _params['param'])) + + if _params['param2'] is not None: + _form_params.append(('param2', _params['param2'])) + + # process the body parameter + _body_params = None + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/x-www-form-urlencoded'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/fake/jsonFormData', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def test_query_parameter_collection_format(self, pipe : conlist(StrictStr), ioutil : conlist(StrictStr), http : conlist(StrictStr), url : conlist(StrictStr), context : conlist(StrictStr), allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs) -> None: # noqa: E501 + """test_query_parameter_collection_format # noqa: E501 + + To test the collection format in query parameters # noqa: E501 + + :param pipe: (required) + :type pipe: List[str] + :param ioutil: (required) + :type ioutil: List[str] + :param http: (required) + :type http: List[str] + :param url: (required) + :type url: List[str] + :param context: (required) + :type context: List[str] + :param allow_empty: (required) + :type allow_empty: str + :param language: + :type language: Dict[str, str] + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_query_parameter_collection_format_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.test_query_parameter_collection_format_with_http_info(pipe, ioutil, http, url, context, allow_empty, language, **kwargs) # noqa: E501 + + @validate_arguments + async def test_query_parameter_collection_format_with_http_info(self, pipe : conlist(StrictStr), ioutil : conlist(StrictStr), http : conlist(StrictStr), url : conlist(StrictStr), context : conlist(StrictStr), allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs) -> ApiResponse: # noqa: E501 + """test_query_parameter_collection_format # noqa: E501 + + To test the collection format in query parameters # noqa: E501 + + :param pipe: (required) + :type pipe: List[str] + :param ioutil: (required) + :type ioutil: List[str] + :param http: (required) + :type http: List[str] + :param url: (required) + :type url: List[str] + :param context: (required) + :type context: List[str] + :param allow_empty: (required) + :type allow_empty: str + :param language: + :type language: Dict[str, str] + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'pipe', + 'ioutil', + 'http', + 'url', + 'context', + 'allow_empty', + 'language' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_query_parameter_collection_format" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('pipe') is not None: # noqa: E501 + _query_params.append(('pipe', _params['pipe'])) + _collection_formats['pipe'] = 'pipes' + + if _params.get('ioutil') is not None: # noqa: E501 + _query_params.append(('ioutil', _params['ioutil'])) + _collection_formats['ioutil'] = 'csv' + + if _params.get('http') is not None: # noqa: E501 + _query_params.append(('http', _params['http'])) + _collection_formats['http'] = 'ssv' + + if _params.get('url') is not None: # noqa: E501 + _query_params.append(('url', _params['url'])) + _collection_formats['url'] = 'csv' + + if _params.get('context') is not None: # noqa: E501 + _query_params.append(('context', _params['context'])) + _collection_formats['context'] = 'multi' + + if _params.get('language') is not None: # noqa: E501 + _query_params.append(('language', _params['language'])) + + if _params.get('allow_empty') is not None: # noqa: E501 + _query_params.append(('allowEmpty', _params['allow_empty'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/fake/test-query-parameters', 'PUT', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_classname_tags123_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_classname_tags123_api.py new file mode 100644 index 00000000000..6a63f0aed76 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/fake_classname_tags123_api.py @@ -0,0 +1,176 @@ +# 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 re # noqa: F401 +import io +import warnings + +from pydantic import validate_arguments, ValidationError +from typing import overload, Optional, Union, Awaitable + +from typing_extensions import Annotated +from pydantic import Field + +from petstore_api.models.client import Client + +from petstore_api.api_client import ApiClient +from petstore_api.api_response import ApiResponse +from petstore_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class FakeClassnameTags123Api: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_arguments + async def test_classname(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> Client: # noqa: E501 + """To test class name in snake case # noqa: E501 + + To test class name in snake case # noqa: E501 + + :param client: client model (required) + :type client: Client + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: Client + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_classname_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.test_classname_with_http_info(client, **kwargs) # noqa: E501 + + @validate_arguments + async def test_classname_with_http_info(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> ApiResponse: # noqa: E501 + """To test class name in snake case # noqa: E501 + + To test class name in snake case # noqa: E501 + + :param client: client model (required) + :type client: Client + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(Client, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'client' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_classname" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['client'] is not None: + _body_params = _params['client'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['api_key_query'] # noqa: E501 + + _response_types_map = { + '200': "Client", + } + + return await self.api_client.call_api( + '/fake_classname_test', 'PATCH', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/pet_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/pet_api.py new file mode 100644 index 00000000000..cb4e3ee8896 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/pet_api.py @@ -0,0 +1,1239 @@ +# 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 re # noqa: F401 +import io +import warnings + +from pydantic import validate_arguments, ValidationError +from typing import overload, Optional, Union, Awaitable + +from typing_extensions import Annotated +from pydantic import Field, StrictBytes, StrictInt, StrictStr, conlist, validator + +from typing import List, Optional, Union + +from petstore_api.models.api_response import ApiResponse +from petstore_api.models.pet import Pet + +from petstore_api.api_client import ApiClient +from petstore_api.api_response import ApiResponse +from petstore_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class PetApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_arguments + async def add_pet(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], **kwargs) -> None: # noqa: E501 + """Add a new pet to the store # noqa: E501 + + # noqa: E501 + + :param pet: Pet object that needs to be added to the store (required) + :type pet: Pet + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the add_pet_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.add_pet_with_http_info(pet, **kwargs) # noqa: E501 + + @validate_arguments + async def add_pet_with_http_info(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], **kwargs) -> ApiResponse: # noqa: E501 + """Add a new pet to the store # noqa: E501 + + # noqa: E501 + + :param pet: Pet object that needs to be added to the store (required) + :type pet: Pet + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'pet' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method add_pet" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['pet'] is not None: + _body_params = _params['pet'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json', 'application/xml'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['petstore_auth', 'http_signature_test'] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/pet', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def delete_pet(self, pet_id : Annotated[StrictInt, Field(..., description="Pet id to delete")], api_key : Optional[StrictStr] = None, **kwargs) -> None: # noqa: E501 + """Deletes a pet # noqa: E501 + + # noqa: E501 + + :param pet_id: Pet id to delete (required) + :type pet_id: int + :param api_key: + :type api_key: str + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the delete_pet_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.delete_pet_with_http_info(pet_id, api_key, **kwargs) # noqa: E501 + + @validate_arguments + async def delete_pet_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="Pet id to delete")], api_key : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Deletes a pet # noqa: E501 + + # noqa: E501 + + :param pet_id: Pet id to delete (required) + :type pet_id: int + :param api_key: + :type api_key: str + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'pet_id', + 'api_key' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_pet" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['pet_id'] is not None: + _path_params['petId'] = _params['pet_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if _params['api_key'] is not None: + _header_params['api_key'] = _params['api_key'] + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # authentication setting + _auth_settings = ['petstore_auth'] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/pet/{petId}', 'DELETE', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def find_pets_by_status(self, status : Annotated[conlist(StrictStr), Field(..., description="Status values that need to be considered for filter")], **kwargs) -> List[Pet]: # noqa: E501 + """Finds Pets by status # noqa: E501 + + Multiple status values can be provided with comma separated strings # noqa: E501 + + :param status: Status values that need to be considered for filter (required) + :type status: List[str] + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: List[Pet] + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the find_pets_by_status_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.find_pets_by_status_with_http_info(status, **kwargs) # noqa: E501 + + @validate_arguments + async def find_pets_by_status_with_http_info(self, status : Annotated[conlist(StrictStr), Field(..., description="Status values that need to be considered for filter")], **kwargs) -> ApiResponse: # noqa: E501 + """Finds Pets by status # noqa: E501 + + Multiple status values can be provided with comma separated strings # noqa: E501 + + :param status: Status values that need to be considered for filter (required) + :type status: List[str] + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(List[Pet], status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'status' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method find_pets_by_status" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('status') is not None: # noqa: E501 + _query_params.append(('status', _params['status'])) + _collection_formats['status'] = 'csv' + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/xml', 'application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['petstore_auth', 'http_signature_test'] # noqa: E501 + + _response_types_map = { + '200': "List[Pet]", + '400': None, + } + + return await self.api_client.call_api( + '/pet/findByStatus', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def find_pets_by_tags(self, tags : Annotated[conlist(StrictStr, unique_items=True), Field(..., description="Tags to filter by")], **kwargs) -> List[Pet]: # noqa: E501 + """(Deprecated) Finds Pets by tags # noqa: E501 + + Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501 + + :param tags: Tags to filter by (required) + :type tags: List[str] + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: List[Pet] + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the find_pets_by_tags_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.find_pets_by_tags_with_http_info(tags, **kwargs) # noqa: E501 + + @validate_arguments + async def find_pets_by_tags_with_http_info(self, tags : Annotated[conlist(StrictStr, unique_items=True), Field(..., description="Tags to filter by")], **kwargs) -> ApiResponse: # noqa: E501 + """(Deprecated) Finds Pets by tags # noqa: E501 + + Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501 + + :param tags: Tags to filter by (required) + :type tags: List[str] + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(List[Pet], status_code(int), headers(HTTPHeaderDict)) + """ + + warnings.warn("GET /pet/findByTags is deprecated.", DeprecationWarning) + + _params = locals() + + _all_params = [ + 'tags' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method find_pets_by_tags" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('tags') is not None: # noqa: E501 + _query_params.append(('tags', _params['tags'])) + _collection_formats['tags'] = 'csv' + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/xml', 'application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['petstore_auth', 'http_signature_test'] # noqa: E501 + + _response_types_map = { + '200': "List[Pet]", + '400': None, + } + + return await self.api_client.call_api( + '/pet/findByTags', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def get_pet_by_id(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to return")], **kwargs) -> Pet: # noqa: E501 + """Find pet by ID # noqa: E501 + + Returns a single pet # noqa: E501 + + :param pet_id: ID of pet to return (required) + :type pet_id: int + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: Pet + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the get_pet_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.get_pet_by_id_with_http_info(pet_id, **kwargs) # noqa: E501 + + @validate_arguments + async def get_pet_by_id_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to return")], **kwargs) -> ApiResponse: # noqa: E501 + """Find pet by ID # noqa: E501 + + Returns a single pet # noqa: E501 + + :param pet_id: ID of pet to return (required) + :type pet_id: int + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(Pet, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'pet_id' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method get_pet_by_id" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['pet_id'] is not None: + _path_params['petId'] = _params['pet_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/xml', 'application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['api_key'] # noqa: E501 + + _response_types_map = { + '200': "Pet", + '400': None, + '404': None, + } + + return await self.api_client.call_api( + '/pet/{petId}', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def update_pet(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], **kwargs) -> None: # noqa: E501 + """Update an existing pet # noqa: E501 + + # noqa: E501 + + :param pet: Pet object that needs to be added to the store (required) + :type pet: Pet + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the update_pet_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.update_pet_with_http_info(pet, **kwargs) # noqa: E501 + + @validate_arguments + async def update_pet_with_http_info(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], **kwargs) -> ApiResponse: # noqa: E501 + """Update an existing pet # noqa: E501 + + # noqa: E501 + + :param pet: Pet object that needs to be added to the store (required) + :type pet: Pet + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'pet' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method update_pet" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['pet'] is not None: + _body_params = _params['pet'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json', 'application/xml'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['petstore_auth', 'http_signature_test'] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/pet', 'PUT', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def update_pet_with_form(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet that needs to be updated")], name : Annotated[Optional[StrictStr], Field(description="Updated name of the pet")] = None, status : Annotated[Optional[StrictStr], Field(description="Updated status of the pet")] = None, **kwargs) -> None: # noqa: E501 + """Updates a pet in the store with form data # noqa: E501 + + # noqa: E501 + + :param pet_id: ID of pet that needs to be updated (required) + :type pet_id: int + :param name: Updated name of the pet + :type name: str + :param status: Updated status of the pet + :type status: str + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the update_pet_with_form_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.update_pet_with_form_with_http_info(pet_id, name, status, **kwargs) # noqa: E501 + + @validate_arguments + async def update_pet_with_form_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet that needs to be updated")], name : Annotated[Optional[StrictStr], Field(description="Updated name of the pet")] = None, status : Annotated[Optional[StrictStr], Field(description="Updated status of the pet")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Updates a pet in the store with form data # noqa: E501 + + # noqa: E501 + + :param pet_id: ID of pet that needs to be updated (required) + :type pet_id: int + :param name: Updated name of the pet + :type name: str + :param status: Updated status of the pet + :type status: str + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'pet_id', + 'name', + 'status' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method update_pet_with_form" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['pet_id'] is not None: + _path_params['petId'] = _params['pet_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + if _params['name'] is not None: + _form_params.append(('name', _params['name'])) + + if _params['status'] is not None: + _form_params.append(('status', _params['status'])) + + # process the body parameter + _body_params = None + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/x-www-form-urlencoded'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['petstore_auth'] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/pet/{petId}', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def upload_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="file to upload")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """uploads an image # noqa: E501 + + # noqa: E501 + + :param pet_id: ID of pet to update (required) + :type pet_id: int + :param additional_metadata: Additional data to pass to server + :type additional_metadata: str + :param file: file to upload + :type file: bytearray + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: ApiResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the upload_file_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.upload_file_with_http_info(pet_id, additional_metadata, file, **kwargs) # noqa: E501 + + @validate_arguments + async def upload_file_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="file to upload")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """uploads an image # noqa: E501 + + # noqa: E501 + + :param pet_id: ID of pet to update (required) + :type pet_id: int + :param additional_metadata: Additional data to pass to server + :type additional_metadata: str + :param file: file to upload + :type file: bytearray + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(ApiResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'pet_id', + 'additional_metadata', + 'file' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method upload_file" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['pet_id'] is not None: + _path_params['petId'] = _params['pet_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + if _params['additional_metadata'] is not None: + _form_params.append(('additionalMetadata', _params['additional_metadata'])) + + if _params['file'] is not None: + _files['file'] = _params['file'] + + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['multipart/form-data'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['petstore_auth'] # noqa: E501 + + _response_types_map = { + '200': "ApiResponse", + } + + return await self.api_client.call_api( + '/pet/{petId}/uploadImage', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def upload_file_with_required_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], required_file : Annotated[Union[StrictBytes, StrictStr], Field(..., description="file to upload")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """uploads an image (required) # noqa: E501 + + # noqa: E501 + + :param pet_id: ID of pet to update (required) + :type pet_id: int + :param required_file: file to upload (required) + :type required_file: bytearray + :param additional_metadata: Additional data to pass to server + :type additional_metadata: str + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: ApiResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the upload_file_with_required_file_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.upload_file_with_required_file_with_http_info(pet_id, required_file, additional_metadata, **kwargs) # noqa: E501 + + @validate_arguments + async def upload_file_with_required_file_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], required_file : Annotated[Union[StrictBytes, StrictStr], Field(..., description="file to upload")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """uploads an image (required) # noqa: E501 + + # noqa: E501 + + :param pet_id: ID of pet to update (required) + :type pet_id: int + :param required_file: file to upload (required) + :type required_file: bytearray + :param additional_metadata: Additional data to pass to server + :type additional_metadata: str + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(ApiResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'pet_id', + 'required_file', + 'additional_metadata' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method upload_file_with_required_file" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['pet_id'] is not None: + _path_params['petId'] = _params['pet_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + if _params['additional_metadata'] is not None: + _form_params.append(('additionalMetadata', _params['additional_metadata'])) + + if _params['required_file'] is not None: + _files['requiredFile'] = _params['required_file'] + + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['multipart/form-data'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['petstore_auth'] # noqa: E501 + + _response_types_map = { + '200': "ApiResponse", + } + + return await self.api_client.call_api( + '/fake/{petId}/uploadImageWithRequiredFile', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/store_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/store_api.py new file mode 100644 index 00000000000..a904a1f2c57 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/store_api.py @@ -0,0 +1,539 @@ +# 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 re # noqa: F401 +import io +import warnings + +from pydantic import validate_arguments, ValidationError +from typing import overload, Optional, Union, Awaitable + +from typing_extensions import Annotated +from pydantic import Field, StrictStr, conint + +from typing import Dict + +from petstore_api.models.order import Order + +from petstore_api.api_client import ApiClient +from petstore_api.api_response import ApiResponse +from petstore_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class StoreApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_arguments + async def delete_order(self, order_id : Annotated[StrictStr, Field(..., description="ID of the order that needs to be deleted")], **kwargs) -> None: # noqa: E501 + """Delete purchase order by ID # noqa: E501 + + For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors # noqa: E501 + + :param order_id: ID of the order that needs to be deleted (required) + :type order_id: str + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the delete_order_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.delete_order_with_http_info(order_id, **kwargs) # noqa: E501 + + @validate_arguments + async def delete_order_with_http_info(self, order_id : Annotated[StrictStr, Field(..., description="ID of the order that needs to be deleted")], **kwargs) -> ApiResponse: # noqa: E501 + """Delete purchase order by ID # noqa: E501 + + For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors # noqa: E501 + + :param order_id: ID of the order that needs to be deleted (required) + :type order_id: str + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'order_id' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_order" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['order_id'] is not None: + _path_params['order_id'] = _params['order_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/store/order/{order_id}', 'DELETE', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def get_inventory(self, **kwargs) -> Dict[str, int]: # noqa: E501 + """Returns pet inventories by status # noqa: E501 + + Returns a map of status codes to quantities # noqa: E501 + + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: Dict[str, int] + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the get_inventory_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.get_inventory_with_http_info(**kwargs) # noqa: E501 + + @validate_arguments + async def get_inventory_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 + """Returns pet inventories by status # noqa: E501 + + Returns a map of status codes to quantities # noqa: E501 + + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(Dict[str, int], status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method get_inventory" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['api_key'] # noqa: E501 + + _response_types_map = { + '200': "Dict[str, int]", + } + + return await self.api_client.call_api( + '/store/inventory', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def get_order_by_id(self, order_id : Annotated[conint(strict=True, le=5, ge=1), Field(..., description="ID of pet that needs to be fetched")], **kwargs) -> Order: # noqa: E501 + """Find purchase order by ID # noqa: E501 + + For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions # noqa: E501 + + :param order_id: ID of pet that needs to be fetched (required) + :type order_id: int + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: Order + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the get_order_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.get_order_by_id_with_http_info(order_id, **kwargs) # noqa: E501 + + @validate_arguments + async def get_order_by_id_with_http_info(self, order_id : Annotated[conint(strict=True, le=5, ge=1), Field(..., description="ID of pet that needs to be fetched")], **kwargs) -> ApiResponse: # noqa: E501 + """Find purchase order by ID # noqa: E501 + + For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions # noqa: E501 + + :param order_id: ID of pet that needs to be fetched (required) + :type order_id: int + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(Order, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'order_id' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method get_order_by_id" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['order_id'] is not None: + _path_params['order_id'] = _params['order_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/xml', 'application/json']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "Order", + '400': None, + '404': None, + } + + return await self.api_client.call_api( + '/store/order/{order_id}', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def place_order(self, order : Annotated[Order, Field(..., description="order placed for purchasing the pet")], **kwargs) -> Order: # noqa: E501 + """Place an order for a pet # noqa: E501 + + # noqa: E501 + + :param order: order placed for purchasing the pet (required) + :type order: Order + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: Order + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the place_order_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.place_order_with_http_info(order, **kwargs) # noqa: E501 + + @validate_arguments + async def place_order_with_http_info(self, order : Annotated[Order, Field(..., description="order placed for purchasing the pet")], **kwargs) -> ApiResponse: # noqa: E501 + """Place an order for a pet # noqa: E501 + + # noqa: E501 + + :param order: order placed for purchasing the pet (required) + :type order: Order + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(Order, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'order' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method place_order" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['order'] is not None: + _body_params = _params['order'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/xml', 'application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "Order", + '400': None, + } + + return await self.api_client.call_api( + '/store/order', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/user_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/user_api.py new file mode 100644 index 00000000000..379693e4bd0 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api/user_api.py @@ -0,0 +1,1055 @@ +# 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 re # noqa: F401 +import io +import warnings + +from pydantic import validate_arguments, ValidationError +from typing import overload, Optional, Union, Awaitable + +from typing_extensions import Annotated +from pydantic import Field, StrictStr, conlist + +from petstore_api.models.user import User + +from petstore_api.api_client import ApiClient +from petstore_api.api_response import ApiResponse +from petstore_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class UserApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_arguments + async def create_user(self, user : Annotated[User, Field(..., description="Created user object")], **kwargs) -> None: # noqa: E501 + """Create user # noqa: E501 + + This can only be done by the logged in user. # noqa: E501 + + :param user: Created user object (required) + :type user: User + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the create_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.create_user_with_http_info(user, **kwargs) # noqa: E501 + + @validate_arguments + async def create_user_with_http_info(self, user : Annotated[User, Field(..., description="Created user object")], **kwargs) -> ApiResponse: # noqa: E501 + """Create user # noqa: E501 + + This can only be done by the logged in user. # noqa: E501 + + :param user: Created user object (required) + :type user: User + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _hosts = [ + 'http://petstore.swagger.io/v2', + 'http://path-server-test.petstore.local/v2', + 'http://{server}.swagger.io:{port}/v2' + ] + _host = _hosts[0] + if kwargs.get('_host_index'): + _host_index = int(kwargs.get('_host_index')) + if _host_index < 0 or _host_index >= len(_hosts): + raise ApiValueError( + "Invalid host index. Must be 0 <= index < %s" + % len(_host) + ) + _host = _hosts[_host_index] + _params = locals() + + _all_params = [ + 'user' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params and _key != "_host_index": + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method create_user" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['user'] is not None: + _body_params = _params['user'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/user', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + _host=_host, + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def create_users_with_array_input(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501 + """Creates list of users with given input array # noqa: E501 + + # noqa: E501 + + :param user: List of user object (required) + :type user: List[User] + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the create_users_with_array_input_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.create_users_with_array_input_with_http_info(user, **kwargs) # noqa: E501 + + @validate_arguments + async def create_users_with_array_input_with_http_info(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> ApiResponse: # noqa: E501 + """Creates list of users with given input array # noqa: E501 + + # noqa: E501 + + :param user: List of user object (required) + :type user: List[User] + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'user' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method create_users_with_array_input" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['user'] is not None: + _body_params = _params['user'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/user/createWithArray', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def create_users_with_list_input(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501 + """Creates list of users with given input array # noqa: E501 + + # noqa: E501 + + :param user: List of user object (required) + :type user: List[User] + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the create_users_with_list_input_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.create_users_with_list_input_with_http_info(user, **kwargs) # noqa: E501 + + @validate_arguments + async def create_users_with_list_input_with_http_info(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> ApiResponse: # noqa: E501 + """Creates list of users with given input array # noqa: E501 + + # noqa: E501 + + :param user: List of user object (required) + :type user: List[User] + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'user' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method create_users_with_list_input" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['user'] is not None: + _body_params = _params['user'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/user/createWithList', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def delete_user(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be deleted")], **kwargs) -> None: # noqa: E501 + """Delete user # noqa: E501 + + This can only be done by the logged in user. # noqa: E501 + + :param username: The name that needs to be deleted (required) + :type username: str + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the delete_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.delete_user_with_http_info(username, **kwargs) # noqa: E501 + + @validate_arguments + async def delete_user_with_http_info(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be deleted")], **kwargs) -> ApiResponse: # noqa: E501 + """Delete user # noqa: E501 + + This can only be done by the logged in user. # noqa: E501 + + :param username: The name that needs to be deleted (required) + :type username: str + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'username' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_user" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['username'] is not None: + _path_params['username'] = _params['username'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/user/{username}', 'DELETE', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def get_user_by_name(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be fetched. Use user1 for testing.")], **kwargs) -> User: # noqa: E501 + """Get user by user name # noqa: E501 + + # noqa: E501 + + :param username: The name that needs to be fetched. Use user1 for testing. (required) + :type username: str + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: User + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the get_user_by_name_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.get_user_by_name_with_http_info(username, **kwargs) # noqa: E501 + + @validate_arguments + async def get_user_by_name_with_http_info(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be fetched. Use user1 for testing.")], **kwargs) -> ApiResponse: # noqa: E501 + """Get user by user name # noqa: E501 + + # noqa: E501 + + :param username: The name that needs to be fetched. Use user1 for testing. (required) + :type username: str + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(User, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'username' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_by_name" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['username'] is not None: + _path_params['username'] = _params['username'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/xml', 'application/json']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "User", + '400': None, + '404': None, + } + + return await self.api_client.call_api( + '/user/{username}', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def login_user(self, username : Annotated[StrictStr, Field(..., description="The user name for login")], password : Annotated[StrictStr, Field(..., description="The password for login in clear text")], **kwargs) -> str: # noqa: E501 + """Logs user into the system # noqa: E501 + + # noqa: E501 + + :param username: The user name for login (required) + :type username: str + :param password: The password for login in clear text (required) + :type password: str + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the login_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.login_user_with_http_info(username, password, **kwargs) # noqa: E501 + + @validate_arguments + async def login_user_with_http_info(self, username : Annotated[StrictStr, Field(..., description="The user name for login")], password : Annotated[StrictStr, Field(..., description="The password for login in clear text")], **kwargs) -> ApiResponse: # noqa: E501 + """Logs user into the system # noqa: E501 + + # noqa: E501 + + :param username: The user name for login (required) + :type username: str + :param password: The password for login in clear text (required) + :type password: str + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'username', + 'password' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method login_user" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('username') is not None: # noqa: E501 + _query_params.append(('username', _params['username'])) + + if _params.get('password') is not None: # noqa: E501 + _query_params.append(('password', _params['password'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/xml', 'application/json']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "str", + '400': None, + } + + return await self.api_client.call_api( + '/user/login', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def logout_user(self, **kwargs) -> None: # noqa: E501 + """Logs out current logged in user session # noqa: E501 + + # noqa: E501 + + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the logout_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.logout_user_with_http_info(**kwargs) # noqa: E501 + + @validate_arguments + async def logout_user_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 + """Logs out current logged in user session # noqa: E501 + + # noqa: E501 + + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method logout_user" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/user/logout', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + async def update_user(self, username : Annotated[StrictStr, Field(..., description="name that need to be deleted")], user : Annotated[User, Field(..., description="Updated user object")], **kwargs) -> None: # noqa: E501 + """Updated user # noqa: E501 + + This can only be done by the logged in user. # noqa: E501 + + :param username: name that need to be deleted (required) + :type username: str + :param user: Updated user object (required) + :type user: User + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the update_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return await self.update_user_with_http_info(username, user, **kwargs) # noqa: E501 + + @validate_arguments + async def update_user_with_http_info(self, username : Annotated[StrictStr, Field(..., description="name that need to be deleted")], user : Annotated[User, Field(..., description="Updated user object")], **kwargs) -> ApiResponse: # noqa: E501 + """Updated user # noqa: E501 + + This can only be done by the logged in user. # noqa: E501 + + :param username: name that need to be deleted (required) + :type username: str + :param user: Updated user object (required) + :type user: User + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'username', + 'user' + ] + _all_params.extend( + [ + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method update_user" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['username'] is not None: + _path_params['username'] = _params['username'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['user'] is not None: + _body_params = _params['user'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return await self.api_client.call_api( + '/user/{username}', 'PUT', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api_client.py new file mode 100644 index 00000000000..733ddaed7c3 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api_client.py @@ -0,0 +1,737 @@ +# 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 atexit +import datetime +from dateutil.parser import parse +import json +import mimetypes +import os +import re +import tempfile + +from urllib.parse import quote + +from petstore_api.configuration import Configuration +from petstore_api.api_response import ApiResponse +import petstore_api.models +from petstore_api import rest +from petstore_api.exceptions import ApiValueError, ApiException + + +class ApiClient: + """Generic API client for OpenAPI client library builds. + + OpenAPI generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the OpenAPI + templates. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API + """ + + PRIMITIVE_TYPES = (float, bool, bytes, str, int) + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int, # TODO remove as only py3 is supported? + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'object': object, + } + _pool = None + + def __init__(self, configuration=None, header_name=None, header_value=None, + cookie=None) -> None: + # use default configuration if none is provided + if configuration is None: + configuration = Configuration.get_default() + self.configuration = configuration + + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'OpenAPI-Generator/1.0.0/python' + self.client_side_validation = configuration.client_side_validation + + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc_value, traceback): + await self.close() + + async def close(self): + await self.rest_client.close() + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + + _default = None + + @classmethod + def get_default(cls): + """Return new instance of ApiClient. + + This method returns newly created, based on default constructor, + object of ApiClient class or returns a copy of default + ApiClient. + + :return: The ApiClient object. + """ + if cls._default is None: + cls._default = ApiClient() + return cls._default + + @classmethod + def set_default(cls, default): + """Set default instance of ApiClient. + + It stores default ApiClient. + + :param default: object of ApiClient. + """ + cls._default = default + + async def __call_api( + self, resource_path, method, path_params=None, + query_params=None, header_params=None, body=None, post_params=None, + files=None, response_types_map=None, auth_settings=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None, _host=None, + _request_auth=None): + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict(self.parameters_to_tuples(header_params, + collection_formats)) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples(path_params, + collection_formats) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # post parameters + if post_params or files: + post_params = post_params if post_params else [] + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples(post_params, + collection_formats) + post_params.extend(self.files_parameters(files)) + + # auth setting + self.update_params_for_auth( + header_params, query_params, auth_settings, + resource_path, method, body, + request_auth=_request_auth) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + if _host is None: + url = self.configuration.host + resource_path + else: + # use server/host defined in path or operation instead + url = _host + resource_path + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + url_query = self.parameters_to_url_query(query_params, + collection_formats) + url += "?" + url_query + + try: + # perform request and return response + response_data = await self.request( + method, url, + query_params=query_params, + headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + except ApiException as e: + if e.body: + e.body = e.body.decode('utf-8') + raise e + + self.last_response = response_data + + return_data = None # assuming deserialization is not needed + # data needs deserialization or returns HTTP data (deserialized) only + if _preload_content or _return_http_data_only: + response_type = response_types_map.get(str(response_data.status), None) + if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) + + if response_type == "bytearray": + response_data.data = response_data.data + else: + match = None + content_type = response_data.getheader('content-type') + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_data.data = response_data.data.decode(encoding) + + # deserialize response data + if response_type == "bytearray": + return_data = response_data.data + elif response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None + + if _return_http_data_only: + return return_data + else: + return ApiResponse(status_code = response_data.status, + data = return_data, + headers = response_data.getheaders(), + raw_data = response_data.data) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is OpenAPI model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, list): + return [self.sanitize_for_serialization(sub_obj) + for sub_obj in obj] + elif isinstance(obj, tuple): + return tuple(self.sanitize_for_serialization(sub_obj) + for sub_obj in obj) + elif isinstance(obj, (datetime.datetime, datetime.date)): + return obj.isoformat() + + if isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + obj_dict = obj.to_dict() + + return {key: self.sanitize_for_serialization(val) + for key, val in obj_dict.items()} + + def deserialize(self, response, response_type): + """Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + + :return: deserialized object. + """ + # handle file downloading + # save response body into a tmp file and return the instance + if response_type == "file": + return self.__deserialize_file(response) + + # fetch data from response object + try: + data = json.loads(response.data) + except ValueError: + data = response.data + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if isinstance(klass, str): + if klass.startswith('List['): + sub_kls = re.match(r'List\[(.*)]', klass).group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('Dict['): + sub_kls = re.match(r'Dict\[([^,]*), (.*)]', klass).group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in data.items()} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(petstore_api.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass == object: + return self.__deserialize_object(data) + elif klass == datetime.date: + return self.__deserialize_date(data) + elif klass == datetime.datetime: + return self.__deserialize_datetime(data) + else: + return self.__deserialize_model(data, klass) + + async def call_api(self, resource_path, method, + path_params=None, query_params=None, header_params=None, + body=None, post_params=None, files=None, + response_types_map=None, auth_settings=None, + _return_http_data_only=None, + collection_formats=None, _preload_content=True, + _request_timeout=None, _host=None, _request_auth=None): + """Makes the HTTP request (synchronous) and returns deserialized data. + + :param resource_path: Path to method endpoint. + :param method: Method to call. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param response: Response data type. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_token: dict, optional + :return: + The response. + """ + args = ( + resource_path, + method, + path_params, + query_params, + header_params, + body, + post_params, + files, + response_types_map, + auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + _host, + _request_auth, + ) + return await self.__call_api(*args) + + async def request(self, method, url, query_params=None, headers=None, + post_params=None, body=None, _preload_content=True, + _request_timeout=None): + """Makes the HTTP request using RESTClient.""" + if method == "GET": + return await self.rest_client.get_request(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "HEAD": + return await self.rest_client.head_request(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "OPTIONS": + return await self.rest_client.options_request(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + elif method == "POST": + return await self.rest_client.post_request(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PUT": + return await self.rest_client.put_request(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PATCH": + return await self.rest_client.patch_request(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "DELETE": + return await self.rest_client.delete_request(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + else: + raise ApiValueError( + "http method must be `GET`, `HEAD`, `OPTIONS`," + " `POST`, `PATCH`, `PUT` or `DELETE`." + ) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501 + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def parameters_to_url_query(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: URL query string (e.g. a=Hello%20World&b=123) + """ + new_params = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501 + if isinstance(v, (int, float)): + v = str(v) + if isinstance(v, bool): + v = str(v).lower() + if isinstance(v, dict): + v = json.dumps(v) + + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(quote(str(value)) for value in v))) + else: + new_params.append((k, quote(str(v)))) + + return "&".join(["=".join(item) for item in new_params]) + + def files_parameters(self, files=None): + """Builds form parameters. + + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + + if files: + for k, v in files.items(): + if not v: + continue + file_names = v if type(v) is list else [v] + for n in file_names: + with open(n, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + mimetype = (mimetypes.guess_type(filename)[0] or + 'application/octet-stream') + params.append( + tuple([k, tuple([filename, filedata, mimetype])])) + + return params + + def select_header_accept(self, accepts): + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return + + for accept in accepts: + if re.search('json', accept, re.IGNORECASE): + return accept + + return accepts[0] + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return None + + for content_type in content_types: + if re.search('json', content_type, re.IGNORECASE): + return content_type + + return content_types[0] + + def update_params_for_auth(self, headers, queries, auth_settings, + resource_path, method, body, + request_auth=None): + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param request_auth: if set, the provided settings will + override the token in the configuration. + """ + if not auth_settings: + return + + if request_auth: + self._apply_auth_params(headers, queries, + resource_path, method, body, + request_auth) + return + + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + self._apply_auth_params(headers, queries, + resource_path, method, body, + auth_setting) + + def _apply_auth_params(self, headers, queries, + resource_path, method, body, + auth_setting): + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + else: + # The HTTP signature scheme requires multiple HTTP headers + # that are calculated dynamically. + signing_info = self.configuration.signing_info + auth_headers = signing_info.get_http_signature_headers( + resource_path, method, headers, body, queries) + headers.update(auth_headers) + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.getheader("Content-Disposition") + if content_disposition: + filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition).group(1) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return str(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return an original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datetime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + return klass.from_dict(data) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api_response.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api_response.py new file mode 100644 index 00000000000..a0b62b95246 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/api_response.py @@ -0,0 +1,25 @@ +"""API response object.""" + +from __future__ import annotations +from typing import Any, Dict, Optional +from pydantic import Field, StrictInt, StrictStr + +class ApiResponse: + """ + API response object + """ + + status_code: Optional[StrictInt] = Field(None, description="HTTP status code") + headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") + data: Optional[Any] = Field(None, description="Deserialized data given the data type") + raw_data: Optional[Any] = Field(None, description="Raw data (HTTP response body)") + + def __init__(self, + status_code=None, + headers=None, + data=None, + raw_data=None) -> None: + self.status_code = status_code + self.headers = headers + self.data = data + self.raw_data = raw_data diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/configuration.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/configuration.py new file mode 100644 index 00000000000..1e0b9acbc97 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/configuration.py @@ -0,0 +1,601 @@ +# 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 copy +import logging +import sys +import urllib3 + +import http.client as httplib + +JSON_SCHEMA_VALIDATION_KEYWORDS = { + 'multipleOf', 'maximum', 'exclusiveMaximum', + 'minimum', 'exclusiveMinimum', 'maxLength', + 'minLength', 'pattern', 'maxItems', 'minItems' +} + +class Configuration: + """This class contains various settings of the API client. + + :param host: Base url. + :param api_key: Dict to store API key(s). + Each entry in the dict specifies an API key. + The dict key is the name of the security scheme in the OAS specification. + The dict value is the API key secret. + :param api_key_prefix: Dict to store API prefix (e.g. Bearer). + The dict key is the name of the security scheme in the OAS specification. + The dict value is an API key prefix when generating the auth data. + :param username: Username for HTTP basic authentication. + :param password: Password for HTTP basic authentication. + :param access_token: Access token. + :param signing_info: Configuration parameters for the HTTP signature security scheme. + Must be an instance of petstore_api.signing.HttpSigningConfiguration + :param server_index: Index to servers configuration. + :param server_variables: Mapping with string values to replace variables in + templated server configuration. The validation of enums is performed for + variables with defined enum values before. + :param server_operation_index: Mapping from operation ID to an index to server + configuration. + :param server_operation_variables: Mapping from operation ID to a mapping with + string values to replace variables in templated server configuration. + The validation of enums is performed for variables with defined enum + values before. + :param ssl_ca_cert: str - the path to a file of concatenated CA certificates + in PEM format. + + :Example: + + API Key Authentication Example. + Given the following security scheme in the OpenAPI specification: + components: + securitySchemes: + cookieAuth: # name for the security scheme + type: apiKey + in: cookie + name: JSESSIONID # cookie name + + You can programmatically set the cookie: + +conf = petstore_api.Configuration( + api_key={'cookieAuth': 'abc123'} + api_key_prefix={'cookieAuth': 'JSESSIONID'} +) + + The following cookie will be added to the HTTP request: + Cookie: JSESSIONID abc123 + + HTTP Basic Authentication Example. + Given the following security scheme in the OpenAPI specification: + components: + securitySchemes: + http_basic_auth: + type: http + scheme: basic + + Configure API client with HTTP basic authentication: + +conf = petstore_api.Configuration( + username='the-user', + password='the-password', +) + + + HTTP Signature Authentication Example. + Given the following security scheme in the OpenAPI specification: + components: + securitySchemes: + http_basic_auth: + type: http + scheme: signature + + Configure API client with HTTP signature authentication. Use the 'hs2019' signature scheme, + sign the HTTP requests with the RSA-SSA-PSS signature algorithm, and set the expiration time + of the signature to 5 minutes after the signature has been created. + Note you can use the constants defined in the petstore_api.signing module, and you can + also specify arbitrary HTTP headers to be included in the HTTP signature, except for the + 'Authorization' header, which is used to carry the signature. + + One may be tempted to sign all headers by default, but in practice it rarely works. + This is because explicit proxies, transparent proxies, TLS termination endpoints or + load balancers may add/modify/remove headers. Include the HTTP headers that you know + are not going to be modified in transit. + +conf = petstore_api.Configuration( + signing_info = petstore_api.signing.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'rsa.pem', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_RSASSA_PSS, + signed_headers = [petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) + """ + + _default = None + + def __init__(self, host=None, + api_key=None, api_key_prefix=None, + username=None, password=None, + access_token=None, + signing_info=None, + server_index=None, server_variables=None, + server_operation_index=None, server_operation_variables=None, + ssl_ca_cert=None, + ) -> None: + """Constructor + """ + self._base_path = "http://petstore.swagger.io:80/v2" if host is None else host + """Default Base url + """ + self.server_index = 0 if server_index is None and host is None else server_index + self.server_operation_index = server_operation_index or {} + """Default server index + """ + self.server_variables = server_variables or {} + self.server_operation_variables = server_operation_variables or {} + """Default server variables + """ + self.temp_folder_path = None + """Temp file folder for downloading files + """ + # Authentication Settings + self.api_key = {} + if api_key: + self.api_key = api_key + """dict to store API key(s) + """ + self.api_key_prefix = {} + if api_key_prefix: + self.api_key_prefix = api_key_prefix + """dict to store API prefix (e.g. Bearer) + """ + self.refresh_api_key_hook = None + """function hook to refresh API key if expired + """ + self.username = username + """Username for HTTP basic authentication + """ + self.password = password + """Password for HTTP basic authentication + """ + self.access_token = access_token + """Access token + """ + if signing_info is not None: + signing_info.host = host + self.signing_info = signing_info + """The HTTP signing configuration + """ + self.logger = {} + """Logging Settings + """ + self.logger["package_logger"] = logging.getLogger("petstore_api") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + """Log format + """ + self.logger_stream_handler = None + """Log stream handler + """ + self.logger_file_handler = None + """Log file handler + """ + self.logger_file = None + """Debug file location + """ + self.debug = False + """Debug switch + """ + + self.verify_ssl = True + """SSL/TLS verification + Set this to false to skip verifying SSL certificate when calling API + from https server. + """ + self.ssl_ca_cert = ssl_ca_cert + """Set this to customize the certificate file to verify the peer. + """ + self.cert_file = None + """client certificate file + """ + self.key_file = None + """client key file + """ + self.assert_hostname = None + """Set this to True/False to enable/disable SSL hostname verification. + """ + self.tls_server_name = None + """SSL/TLS Server Name Indication (SNI) + Set this to the SNI value expected by the server. + """ + + self.connection_pool_maxsize = 100 + """This value is passed to the aiohttp to limit simultaneous connections. + Default values is 100, None means no-limit. + """ + + self.proxy = None + """Proxy URL + """ + self.proxy_headers = None + """Proxy headers + """ + self.safe_chars_for_path_param = '' + """Safe chars for path_param + """ + self.retries = None + """Adding retries to override urllib3 default value 3 + """ + # Enable client side validation + self.client_side_validation = True + + self.socket_options = None + """Options to pass down to the underlying urllib3 socket + """ + + self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z" + """datetime format + """ + + self.date_format = "%Y-%m-%d" + """date format + """ + + def __deepcopy__(self, memo): + cls = self.__class__ + result = cls.__new__(cls) + memo[id(self)] = result + for k, v in self.__dict__.items(): + if k not in ('logger', 'logger_file_handler'): + setattr(result, k, copy.deepcopy(v, memo)) + # shallow copy of loggers + result.logger = copy.copy(self.logger) + # use setters to configure loggers + result.logger_file = self.logger_file + result.debug = self.debug + return result + + def __setattr__(self, name, value): + object.__setattr__(self, name, value) + if name == "signing_info" and value is not None: + # Ensure the host parameter from signing info is the same as + # Configuration.host. + value.host = self.host + + @classmethod + def set_default(cls, default): + """Set default instance of configuration. + + It stores default configuration, which can be + returned by get_default_copy method. + + :param default: object of Configuration + """ + cls._default = default + + @classmethod + def get_default_copy(cls): + """Deprecated. Please use `get_default` instead. + + Deprecated. Please use `get_default` instead. + + :return: The configuration object. + """ + return cls.get_default() + + @classmethod + def get_default(cls): + """Return the default configuration. + + This method returns newly created, based on default constructor, + object of Configuration class or returns a copy of default + configuration. + + :return: The configuration object. + """ + if cls._default is None: + cls._default = Configuration() + return cls._default + + @property + def logger_file(self): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in self.logger.items(): + logger.addHandler(self.logger_file_handler) + + @property + def debug(self): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in self.logger.items(): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in self.logger.items(): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier, alias=None): + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :param alias: The alternative identifier of apiKey. + :return: The token for api key authentication. + """ + if self.refresh_api_key_hook is not None: + self.refresh_api_key_hook(self) + key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) + if key: + prefix = self.api_key_prefix.get(identifier) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + def get_basic_auth_token(self): + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + username = "" + if self.username is not None: + username = self.username + password = "" + if self.password is not None: + password = self.password + return urllib3.util.make_headers( + basic_auth=username + ':' + password + ).get('authorization') + + def auth_settings(self): + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + auth = {} + if self.access_token is not None: + auth['petstore_auth'] = { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } + if 'api_key' in self.api_key: + auth['api_key'] = { + 'type': 'api_key', + 'in': 'header', + 'key': 'api_key', + 'value': self.get_api_key_with_prefix( + 'api_key', + ), + } + if 'api_key_query' in self.api_key: + auth['api_key_query'] = { + 'type': 'api_key', + 'in': 'query', + 'key': 'api_key_query', + 'value': self.get_api_key_with_prefix( + 'api_key_query', + ), + } + if self.username is not None and self.password is not None: + auth['http_basic_test'] = { + 'type': 'basic', + 'in': 'header', + 'key': 'Authorization', + 'value': self.get_basic_auth_token() + } + if self.access_token is not None: + auth['bearer_test'] = { + 'type': 'bearer', + 'in': 'header', + 'format': 'JWT', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } + if self.signing_info is not None: + auth['http_signature_test'] = { + 'type': 'http-signature', + 'in': 'header', + 'key': 'Authorization', + 'value': None # Signature headers are calculated for every HTTP request + } + return auth + + def to_debug_report(self): + """Gets the essential information for debugging. + + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: 1.0.0\n"\ + "SDK Package Version: 1.0.0".\ + format(env=sys.platform, pyversion=sys.version) + + def get_host_settings(self): + """Gets an array of host settings + + :return: An array of host settings + """ + return [ + { + 'url': "http://{server}.swagger.io:{port}/v2", + 'description': "petstore server", + 'variables': { + 'server': { + 'description': "No description provided", + 'default_value': "petstore", + 'enum_values': [ + "petstore", + "qa-petstore", + "dev-petstore" + ] + }, + 'port': { + 'description': "No description provided", + 'default_value': "80", + 'enum_values': [ + "80", + "8080" + ] + } + } + }, + { + 'url': "https://localhost:8080/{version}", + 'description': "The local server", + 'variables': { + 'version': { + 'description': "No description provided", + 'default_value': "v2", + 'enum_values': [ + "v1", + "v2" + ] + } + } + }, + { + 'url': "https://127.0.0.1/no_varaible", + 'description': "The local server without variables", + } + ] + + def get_host_from_settings(self, index, variables=None, servers=None): + """Gets host URL based on the index and variables + :param index: array index of the host settings + :param variables: hash of variable and the corresponding value + :param servers: an array of host settings or None + :return: URL based on host settings + """ + if index is None: + return self._base_path + + variables = {} if variables is None else variables + servers = self.get_host_settings() if servers is None else servers + + try: + server = servers[index] + except IndexError: + raise ValueError( + "Invalid index {0} when selecting the host settings. " + "Must be less than {1}".format(index, len(servers))) + + url = server['url'] + + # go through variables and replace placeholders + for variable_name, variable in server.get('variables', {}).items(): + used_value = variables.get( + variable_name, variable['default_value']) + + if 'enum_values' in variable \ + and used_value not in variable['enum_values']: + raise ValueError( + "The variable `{0}` in the host URL has invalid value " + "{1}. Must be {2}.".format( + variable_name, variables[variable_name], + variable['enum_values'])) + + url = url.replace("{" + variable_name + "}", used_value) + + return url + + @property + def host(self): + """Return generated host.""" + return self.get_host_from_settings(self.server_index, variables=self.server_variables) + + @host.setter + def host(self, value): + """Fix base path.""" + self._base_path = value + self.server_index = None diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/exceptions.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/exceptions.py new file mode 100644 index 00000000000..6c4ae9c4e02 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/exceptions.py @@ -0,0 +1,166 @@ +# 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 + + +class OpenApiException(Exception): + """The base exception class for all OpenAPIExceptions""" + + +class ApiTypeError(OpenApiException, TypeError): + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None) -> None: + """ Raises an exception for TypeErrors + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list): a list of keys an indices to get to the + current_item + None if unset + valid_classes (tuple): the primitive classes that current item + should be an instance of + None if unset + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + None if unset + """ + self.path_to_item = path_to_item + self.valid_classes = valid_classes + self.key_type = key_type + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiTypeError, self).__init__(full_msg) + + +class ApiValueError(OpenApiException, ValueError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list) the path to the exception in the + received_data dict. None if unset + """ + + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiValueError, self).__init__(full_msg) + + +class ApiAttributeError(OpenApiException, AttributeError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Raised when an attribute reference or assignment fails. + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiAttributeError, self).__init__(full_msg) + + +class ApiKeyError(OpenApiException, KeyError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiKeyError, self).__init__(full_msg) + + +class ApiException(OpenApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + if http_resp: + self.status = http_resp.status + self.reason = http_resp.reason + self.body = http_resp.data + self.headers = http_resp.getheaders() + else: + self.status = status + self.reason = reason + self.body = None + self.headers = None + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + return error_message + +class BadRequestException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + super(BadRequestException, self).__init__(status, reason, http_resp) + +class NotFoundException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + super(NotFoundException, self).__init__(status, reason, http_resp) + + +class UnauthorizedException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + super(UnauthorizedException, self).__init__(status, reason, http_resp) + + +class ForbiddenException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + super(ForbiddenException, self).__init__(status, reason, http_resp) + + +class ServiceException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + super(ServiceException, self).__init__(status, reason, http_resp) + + +def render_path(path_to_item): + """Returns a string representation of a path""" + result = "" + for pth in path_to_item: + if isinstance(pth, int): + result += "[{0}]".format(pth) + else: + result += "['{0}']".format(pth) + return result diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/__init__.py new file mode 100644 index 00000000000..e3ce5fa5538 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/__init__.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +# flake8: noqa +""" + 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 models into model package +from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType +from petstore_api.models.additional_properties_class import AdditionalPropertiesClass +from petstore_api.models.additional_properties_object import AdditionalPropertiesObject +from petstore_api.models.additional_properties_with_description_only import AdditionalPropertiesWithDescriptionOnly +from petstore_api.models.all_of_with_single_ref import AllOfWithSingleRef +from petstore_api.models.animal import Animal +from petstore_api.models.any_of_color import AnyOfColor +from petstore_api.models.any_of_pig import AnyOfPig +from petstore_api.models.api_response import ApiResponse +from petstore_api.models.array_of_array_of_model import ArrayOfArrayOfModel +from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly +from petstore_api.models.array_of_number_only import ArrayOfNumberOnly +from petstore_api.models.array_test import ArrayTest +from petstore_api.models.basque_pig import BasquePig +from petstore_api.models.capitalization import Capitalization +from petstore_api.models.cat import Cat +from petstore_api.models.category import Category +from petstore_api.models.circular_reference_model import CircularReferenceModel +from petstore_api.models.class_model import ClassModel +from petstore_api.models.client import Client +from petstore_api.models.color import Color +from petstore_api.models.creature import Creature +from petstore_api.models.creature_info import CreatureInfo +from petstore_api.models.danish_pig import DanishPig +from petstore_api.models.deprecated_object import DeprecatedObject +from petstore_api.models.dog import Dog +from petstore_api.models.dummy_model import DummyModel +from petstore_api.models.enum_arrays import EnumArrays +from petstore_api.models.enum_class import EnumClass +from petstore_api.models.enum_string1 import EnumString1 +from petstore_api.models.enum_string2 import EnumString2 +from petstore_api.models.enum_test import EnumTest +from petstore_api.models.file import File +from petstore_api.models.file_schema_test_class import FileSchemaTestClass +from petstore_api.models.first_ref import FirstRef +from petstore_api.models.foo import Foo +from petstore_api.models.foo_get_default_response import FooGetDefaultResponse +from petstore_api.models.format_test import FormatTest +from petstore_api.models.has_only_read_only import HasOnlyReadOnly +from petstore_api.models.health_check_result import HealthCheckResult +from petstore_api.models.inner_dict_with_property import InnerDictWithProperty +from petstore_api.models.int_or_string import IntOrString +from petstore_api.models.list import List +from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel +from petstore_api.models.map_test import MapTest +from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass +from petstore_api.models.model200_response import Model200Response +from petstore_api.models.model_return import ModelReturn +from petstore_api.models.name import Name +from petstore_api.models.nullable_class import NullableClass +from petstore_api.models.nullable_property import NullableProperty +from petstore_api.models.number_only import NumberOnly +from petstore_api.models.object_to_test_additional_properties import ObjectToTestAdditionalProperties +from petstore_api.models.object_with_deprecated_fields import ObjectWithDeprecatedFields +from petstore_api.models.one_of_enum_string import OneOfEnumString +from petstore_api.models.order import Order +from petstore_api.models.outer_composite import OuterComposite +from petstore_api.models.outer_enum import OuterEnum +from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue +from petstore_api.models.outer_enum_integer import OuterEnumInteger +from petstore_api.models.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue +from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty +from petstore_api.models.parent import Parent +from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict +from petstore_api.models.pet import Pet +from petstore_api.models.pig import Pig +from petstore_api.models.property_name_collision import PropertyNameCollision +from petstore_api.models.read_only_first import ReadOnlyFirst +from petstore_api.models.second_ref import SecondRef +from petstore_api.models.self_reference_model import SelfReferenceModel +from petstore_api.models.single_ref_type import SingleRefType +from petstore_api.models.special_character_enum import SpecialCharacterEnum +from petstore_api.models.special_model_name import SpecialModelName +from petstore_api.models.special_name import SpecialName +from petstore_api.models.tag import Tag +from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest +from petstore_api.models.tiger import Tiger +from petstore_api.models.user import User +from petstore_api.models.with_nested_one_of import WithNestedOneOf diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_any_type.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_any_type.py new file mode 100644 index 00000000000..0441dfd99e9 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_any_type.py @@ -0,0 +1,83 @@ +# 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 Optional +from pydantic import BaseModel, StrictStr + +class AdditionalPropertiesAnyType(BaseModel): + """ + AdditionalPropertiesAnyType + """ + name: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties = ["name"] + + 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) -> AdditionalPropertiesAnyType: + """Create an instance of AdditionalPropertiesAnyType 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) -> AdditionalPropertiesAnyType: + """Create an instance of AdditionalPropertiesAnyType from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return AdditionalPropertiesAnyType.parse_obj(obj) + + _obj = AdditionalPropertiesAnyType.parse_obj({ + "name": obj.get("name") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_class.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_class.py new file mode 100644 index 00000000000..c53af3e2ca6 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_class.py @@ -0,0 +1,73 @@ +# 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 Dict, Optional +from pydantic import BaseModel, StrictStr + +class AdditionalPropertiesClass(BaseModel): + """ + AdditionalPropertiesClass + """ + map_property: Optional[Dict[str, StrictStr]] = None + map_of_map_property: Optional[Dict[str, Dict[str, StrictStr]]] = None + __properties = ["map_property", "map_of_map_property"] + + 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) -> AdditionalPropertiesClass: + """Create an instance of AdditionalPropertiesClass 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) -> AdditionalPropertiesClass: + """Create an instance of AdditionalPropertiesClass from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return AdditionalPropertiesClass.parse_obj(obj) + + _obj = AdditionalPropertiesClass.parse_obj({ + "map_property": obj.get("map_property"), + "map_of_map_property": obj.get("map_of_map_property") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_object.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_object.py new file mode 100644 index 00000000000..cff0e89b056 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_object.py @@ -0,0 +1,83 @@ +# 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 Optional +from pydantic import BaseModel, StrictStr + +class AdditionalPropertiesObject(BaseModel): + """ + AdditionalPropertiesObject + """ + name: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties = ["name"] + + 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) -> AdditionalPropertiesObject: + """Create an instance of AdditionalPropertiesObject 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) -> AdditionalPropertiesObject: + """Create an instance of AdditionalPropertiesObject from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return AdditionalPropertiesObject.parse_obj(obj) + + _obj = AdditionalPropertiesObject.parse_obj({ + "name": obj.get("name") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_with_description_only.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_with_description_only.py new file mode 100644 index 00000000000..17d6c461ed1 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/additional_properties_with_description_only.py @@ -0,0 +1,83 @@ +# 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 Optional +from pydantic import BaseModel, StrictStr + +class AdditionalPropertiesWithDescriptionOnly(BaseModel): + """ + AdditionalPropertiesWithDescriptionOnly + """ + name: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties = ["name"] + + 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) -> AdditionalPropertiesWithDescriptionOnly: + """Create an instance of AdditionalPropertiesWithDescriptionOnly 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) -> AdditionalPropertiesWithDescriptionOnly: + """Create an instance of AdditionalPropertiesWithDescriptionOnly from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return AdditionalPropertiesWithDescriptionOnly.parse_obj(obj) + + _obj = AdditionalPropertiesWithDescriptionOnly.parse_obj({ + "name": obj.get("name") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/all_of_with_single_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/all_of_with_single_ref.py new file mode 100644 index 00000000000..c5d066463f6 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/all_of_with_single_ref.py @@ -0,0 +1,74 @@ +# 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 Optional +from pydantic import BaseModel, Field, StrictStr +from petstore_api.models.single_ref_type import SingleRefType + +class AllOfWithSingleRef(BaseModel): + """ + AllOfWithSingleRef + """ + username: Optional[StrictStr] = None + single_ref_type: Optional[SingleRefType] = Field(None, alias="SingleRefType") + __properties = ["username", "SingleRefType"] + + 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) -> AllOfWithSingleRef: + """Create an instance of AllOfWithSingleRef 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) -> AllOfWithSingleRef: + """Create an instance of AllOfWithSingleRef from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return AllOfWithSingleRef.parse_obj(obj) + + _obj = AllOfWithSingleRef.parse_obj({ + "username": obj.get("username"), + "single_ref_type": obj.get("SingleRefType") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/animal.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/animal.py new file mode 100644 index 00000000000..18738e6051b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/animal.py @@ -0,0 +1,92 @@ +# 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 Optional, Union +from pydantic import BaseModel, Field, StrictStr + +class Animal(BaseModel): + """ + Animal + """ + class_name: StrictStr = Field(..., alias="className") + color: Optional[StrictStr] = 'red' + __properties = ["className", "color"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + # JSON field name that stores the object type + __discriminator_property_name = 'className' + + # discriminator mappings + __discriminator_value_class_map = { + 'Cat': 'Cat', + 'Dog': 'Dog' + } + + @classmethod + def get_discriminator_value(cls, obj: dict) -> str: + """Returns the discriminator value (object type) of the data""" + discriminator_value = obj[cls.__discriminator_property_name] + if discriminator_value: + return cls.__discriminator_value_class_map.get(discriminator_value) + else: + return None + + 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) -> Union(Cat, Dog): + """Create an instance of Animal 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) -> Union(Cat, Dog): + """Create an instance of Animal from a dict""" + # look up the object type based on discriminator mapping + object_type = cls.get_discriminator_value(obj) + if object_type: + klass = globals()[object_type] + return klass.from_dict(obj) + else: + raise ValueError("Animal failed to lookup discriminator value from " + + json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name + + ", mapping: " + json.dumps(cls.__discriminator_value_class_map)) + +from petstore_api.models.cat import Cat +from petstore_api.models.dog import Dog +Animal.update_forward_refs() + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/any_of_color.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/any_of_color.py new file mode 100644 index 00000000000..b422650686f --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/any_of_color.py @@ -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 List, Optional +from pydantic import BaseModel, Field, StrictStr, ValidationError, conint, conlist, constr, validator +from typing import Union, Any, List, TYPE_CHECKING +from pydantic import StrictStr, Field + +ANYOFCOLOR_ANY_OF_SCHEMAS = ["List[int]", "str"] + +class AnyOfColor(BaseModel): + """ + Any of RGB array, RGBA array, or hex string. + """ + + # data type: List[int] + anyof_schema_1_validator: Optional[conlist(conint(strict=True, le=255, ge=0), max_items=3, min_items=3)] = Field(None, description="RGB three element array with values 0-255.") + # data type: List[int] + anyof_schema_2_validator: Optional[conlist(conint(strict=True, le=255, ge=0), max_items=4, min_items=4)] = Field(None, description="RGBA four element array with values 0-255.") + # data type: str + anyof_schema_3_validator: Optional[constr(strict=True, max_length=7, min_length=7)] = Field(None, description="Hex color string, such as #00FF00.") + if TYPE_CHECKING: + actual_instance: Union[List[int], str] + else: + actual_instance: Any + any_of_schemas: List[str] = Field(ANYOFCOLOR_ANY_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_anyof(cls, v): + instance = AnyOfColor.construct() + error_messages = [] + # validate data type: List[int] + try: + instance.anyof_schema_1_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: List[int] + try: + instance.anyof_schema_2_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: str + try: + instance.anyof_schema_3_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in AnyOfColor with anyOf schemas: List[int], str. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: dict) -> AnyOfColor: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> AnyOfColor: + """Returns the object represented by the json string""" + instance = AnyOfColor.construct() + error_messages = [] + # deserialize data into List[int] + try: + # validation + instance.anyof_schema_1_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_1_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into List[int] + try: + # validation + instance.anyof_schema_2_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_2_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into str + try: + # validation + instance.anyof_schema_3_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_3_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into AnyOfColor with anyOf schemas: List[int], str. 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 "null" + + to_json = getattr(self.actual_instance, "to_json", None) + if callable(to_json): + return self.actual_instance.to_dict() + else: + return json.dumps(self.actual_instance) + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.dict()) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/any_of_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/any_of_pig.py new file mode 100644 index 00000000000..1254f6789a8 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/any_of_pig.py @@ -0,0 +1,134 @@ +# 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 Optional +from pydantic import BaseModel, Field, StrictStr, ValidationError, validator +from petstore_api.models.basque_pig import BasquePig +from petstore_api.models.danish_pig import DanishPig +from typing import Union, Any, List, TYPE_CHECKING +from pydantic import StrictStr, Field + +ANYOFPIG_ANY_OF_SCHEMAS = ["BasquePig", "DanishPig"] + +class AnyOfPig(BaseModel): + """ + AnyOfPig + """ + + # data type: BasquePig + anyof_schema_1_validator: Optional[BasquePig] = None + # data type: DanishPig + anyof_schema_2_validator: Optional[DanishPig] = None + if TYPE_CHECKING: + actual_instance: Union[BasquePig, DanishPig] + else: + actual_instance: Any + any_of_schemas: List[str] = Field(ANYOFPIG_ANY_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_anyof(cls, v): + instance = AnyOfPig.construct() + error_messages = [] + # validate data type: BasquePig + if not isinstance(v, BasquePig): + error_messages.append(f"Error! Input type `{type(v)}` is not `BasquePig`") + else: + return v + + # validate data type: DanishPig + if not isinstance(v, DanishPig): + error_messages.append(f"Error! Input type `{type(v)}` is not `DanishPig`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in AnyOfPig with anyOf schemas: BasquePig, DanishPig. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: dict) -> AnyOfPig: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> AnyOfPig: + """Returns the object represented by the json string""" + instance = AnyOfPig.construct() + error_messages = [] + # anyof_schema_1_validator: Optional[BasquePig] = None + try: + instance.actual_instance = BasquePig.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[DanishPig] = None + try: + instance.actual_instance = DanishPig.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into AnyOfPig with anyOf schemas: BasquePig, DanishPig. 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 "null" + + to_json = getattr(self.actual_instance, "to_json", None) + if callable(to_json): + return self.actual_instance.to_dict() + else: + return json.dumps(self.actual_instance) + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.dict()) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/api_response.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/api_response.py new file mode 100644 index 00000000000..2c58b8b9ccb --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/api_response.py @@ -0,0 +1,75 @@ +# 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 Optional +from pydantic import BaseModel, StrictInt, StrictStr + +class ApiResponse(BaseModel): + """ + ApiResponse + """ + code: Optional[StrictInt] = None + type: Optional[StrictStr] = None + message: Optional[StrictStr] = None + __properties = ["code", "type", "message"] + + 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) -> ApiResponse: + """Create an instance of ApiResponse 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) -> ApiResponse: + """Create an instance of ApiResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ApiResponse.parse_obj(obj) + + _obj = ApiResponse.parse_obj({ + "code": obj.get("code"), + "type": obj.get("type"), + "message": obj.get("message") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_array_of_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_array_of_model.py new file mode 100644 index 00000000000..6f67b220ccf --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_array_of_model.py @@ -0,0 +1,84 @@ +# 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 List, Optional +from pydantic import BaseModel, conlist +from petstore_api.models.tag import Tag + +class ArrayOfArrayOfModel(BaseModel): + """ + ArrayOfArrayOfModel + """ + another_property: Optional[conlist(conlist(Tag))] = None + __properties = ["another_property"] + + 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) -> ArrayOfArrayOfModel: + """Create an instance of ArrayOfArrayOfModel 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 each item in another_property (list of list) + _items = [] + if self.another_property: + for _item in self.another_property: + if _item: + _items.append( + [_inner_item.to_dict() for _inner_item in _item if _inner_item is not None] + ) + _dict['another_property'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> ArrayOfArrayOfModel: + """Create an instance of ArrayOfArrayOfModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ArrayOfArrayOfModel.parse_obj(obj) + + _obj = ArrayOfArrayOfModel.parse_obj({ + "another_property": [ + [Tag.from_dict(_inner_item) for _inner_item in _item] + for _item in obj.get("another_property") + ] if obj.get("another_property") is not None else None + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_array_of_number_only.py new file mode 100644 index 00000000000..8ce909858b1 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_array_of_number_only.py @@ -0,0 +1,71 @@ +# 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 List, Optional +from pydantic import BaseModel, Field, conlist + +class ArrayOfArrayOfNumberOnly(BaseModel): + """ + ArrayOfArrayOfNumberOnly + """ + array_array_number: Optional[conlist(conlist(float))] = Field(None, alias="ArrayArrayNumber") + __properties = ["ArrayArrayNumber"] + + 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) -> ArrayOfArrayOfNumberOnly: + """Create an instance of ArrayOfArrayOfNumberOnly 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) -> ArrayOfArrayOfNumberOnly: + """Create an instance of ArrayOfArrayOfNumberOnly from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ArrayOfArrayOfNumberOnly.parse_obj(obj) + + _obj = ArrayOfArrayOfNumberOnly.parse_obj({ + "array_array_number": obj.get("ArrayArrayNumber") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_number_only.py new file mode 100644 index 00000000000..768ea5ef0ba --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_of_number_only.py @@ -0,0 +1,71 @@ +# 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 List, Optional +from pydantic import BaseModel, Field, conlist + +class ArrayOfNumberOnly(BaseModel): + """ + ArrayOfNumberOnly + """ + array_number: Optional[conlist(float)] = Field(None, alias="ArrayNumber") + __properties = ["ArrayNumber"] + + 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) -> ArrayOfNumberOnly: + """Create an instance of ArrayOfNumberOnly 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) -> ArrayOfNumberOnly: + """Create an instance of ArrayOfNumberOnly from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ArrayOfNumberOnly.parse_obj(obj) + + _obj = ArrayOfNumberOnly.parse_obj({ + "array_number": obj.get("ArrayNumber") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_test.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_test.py new file mode 100644 index 00000000000..8ec1a1ad67e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/array_test.py @@ -0,0 +1,88 @@ +# 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 List, Optional +from pydantic import BaseModel, StrictInt, StrictStr, conlist +from petstore_api.models.read_only_first import ReadOnlyFirst + +class ArrayTest(BaseModel): + """ + ArrayTest + """ + array_of_string: Optional[conlist(StrictStr, max_items=3, min_items=0)] = None + array_array_of_integer: Optional[conlist(conlist(StrictInt))] = None + array_array_of_model: Optional[conlist(conlist(ReadOnlyFirst))] = None + __properties = ["array_of_string", "array_array_of_integer", "array_array_of_model"] + + 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) -> ArrayTest: + """Create an instance of ArrayTest 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 each item in array_array_of_model (list of list) + _items = [] + if self.array_array_of_model: + for _item in self.array_array_of_model: + if _item: + _items.append( + [_inner_item.to_dict() for _inner_item in _item if _inner_item is not None] + ) + _dict['array_array_of_model'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> ArrayTest: + """Create an instance of ArrayTest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ArrayTest.parse_obj(obj) + + _obj = ArrayTest.parse_obj({ + "array_of_string": obj.get("array_of_string"), + "array_array_of_integer": obj.get("array_array_of_integer"), + "array_array_of_model": [ + [ReadOnlyFirst.from_dict(_inner_item) for _inner_item in _item] + for _item in obj.get("array_array_of_model") + ] if obj.get("array_array_of_model") is not None else None + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/basque_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/basque_pig.py new file mode 100644 index 00000000000..5683a73a3bf --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/basque_pig.py @@ -0,0 +1,73 @@ +# 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 + +class BasquePig(BaseModel): + """ + BasquePig + """ + class_name: StrictStr = Field(..., alias="className") + color: StrictStr = Field(...) + __properties = ["className", "color"] + + 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) -> BasquePig: + """Create an instance of BasquePig 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) -> BasquePig: + """Create an instance of BasquePig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return BasquePig.parse_obj(obj) + + _obj = BasquePig.parse_obj({ + "class_name": obj.get("className"), + "color": obj.get("color") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/capitalization.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/capitalization.py new file mode 100644 index 00000000000..2bb4435563b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/capitalization.py @@ -0,0 +1,81 @@ +# 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 Optional +from pydantic import BaseModel, Field, StrictStr + +class Capitalization(BaseModel): + """ + Capitalization + """ + small_camel: Optional[StrictStr] = Field(None, alias="smallCamel") + capital_camel: Optional[StrictStr] = Field(None, alias="CapitalCamel") + small_snake: Optional[StrictStr] = Field(None, alias="small_Snake") + capital_snake: Optional[StrictStr] = Field(None, alias="Capital_Snake") + sca_eth_flow_points: Optional[StrictStr] = Field(None, alias="SCA_ETH_Flow_Points") + att_name: Optional[StrictStr] = Field(None, alias="ATT_NAME", description="Name of the pet ") + __properties = ["smallCamel", "CapitalCamel", "small_Snake", "Capital_Snake", "SCA_ETH_Flow_Points", "ATT_NAME"] + + 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) -> Capitalization: + """Create an instance of Capitalization 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) -> Capitalization: + """Create an instance of Capitalization from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Capitalization.parse_obj(obj) + + _obj = Capitalization.parse_obj({ + "small_camel": obj.get("smallCamel"), + "capital_camel": obj.get("CapitalCamel"), + "small_snake": obj.get("small_Snake"), + "capital_snake": obj.get("Capital_Snake"), + "sca_eth_flow_points": obj.get("SCA_ETH_Flow_Points"), + "att_name": obj.get("ATT_NAME") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/cat.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/cat.py new file mode 100644 index 00000000000..efff0890a41 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/cat.py @@ -0,0 +1,74 @@ +# 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 Optional +from pydantic import StrictBool +from petstore_api.models.animal import Animal + +class Cat(Animal): + """ + Cat + """ + declawed: Optional[StrictBool] = None + __properties = ["className", "color", "declawed"] + + 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) -> Cat: + """Create an instance of Cat 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) -> Cat: + """Create an instance of Cat from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Cat.parse_obj(obj) + + _obj = Cat.parse_obj({ + "class_name": obj.get("className"), + "color": obj.get("color") if obj.get("color") is not None else 'red', + "declawed": obj.get("declawed") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/category.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/category.py new file mode 100644 index 00000000000..86a10a8683c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/category.py @@ -0,0 +1,73 @@ +# 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 Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr + +class Category(BaseModel): + """ + Category + """ + id: Optional[StrictInt] = None + name: StrictStr = Field(...) + __properties = ["id", "name"] + + 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) -> Category: + """Create an instance of Category 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) -> Category: + """Create an instance of Category from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Category.parse_obj(obj) + + _obj = Category.parse_obj({ + "id": obj.get("id"), + "name": obj.get("name") if obj.get("name") is not None else 'default-name' + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/circular_reference_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/circular_reference_model.py new file mode 100644 index 00000000000..6a9956f5af3 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/circular_reference_model.py @@ -0,0 +1,78 @@ +# 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 Optional +from pydantic import BaseModel, StrictInt + +class CircularReferenceModel(BaseModel): + """ + CircularReferenceModel + """ + size: Optional[StrictInt] = None + nested: Optional[FirstRef] = None + __properties = ["size", "nested"] + + 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) -> CircularReferenceModel: + """Create an instance of CircularReferenceModel 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 nested + if self.nested: + _dict['nested'] = self.nested.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CircularReferenceModel: + """Create an instance of CircularReferenceModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CircularReferenceModel.parse_obj(obj) + + _obj = CircularReferenceModel.parse_obj({ + "size": obj.get("size"), + "nested": FirstRef.from_dict(obj.get("nested")) if obj.get("nested") is not None else None + }) + return _obj + +from petstore_api.models.first_ref import FirstRef +CircularReferenceModel.update_forward_refs() + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/class_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/class_model.py new file mode 100644 index 00000000000..d345924958e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/class_model.py @@ -0,0 +1,71 @@ +# 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 Optional +from pydantic import BaseModel, Field, StrictStr + +class ClassModel(BaseModel): + """ + Model for testing model with \"_class\" property # noqa: E501 + """ + var_class: Optional[StrictStr] = Field(None, alias="_class") + __properties = ["_class"] + + 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) -> ClassModel: + """Create an instance of ClassModel 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) -> ClassModel: + """Create an instance of ClassModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ClassModel.parse_obj(obj) + + _obj = ClassModel.parse_obj({ + "var_class": obj.get("_class") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/client.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/client.py new file mode 100644 index 00000000000..01f60acef50 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/client.py @@ -0,0 +1,71 @@ +# 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 Optional +from pydantic import BaseModel, StrictStr + +class Client(BaseModel): + """ + Client + """ + client: Optional[StrictStr] = None + __properties = ["client"] + + 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) -> Client: + """Create an instance of Client 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) -> Client: + """Create an instance of Client from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Client.parse_obj(obj) + + _obj = Client.parse_obj({ + "client": obj.get("client") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/color.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/color.py new file mode 100644 index 00000000000..4dee9419ab7 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/color.py @@ -0,0 +1,170 @@ +# 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, conint, conlist, constr, validator +from typing import Union, Any, List, TYPE_CHECKING +from pydantic import StrictStr, Field + +COLOR_ONE_OF_SCHEMAS = ["List[int]", "str"] + +class Color(BaseModel): + """ + RGB array, RGBA array, or hex string. + """ + # data type: List[int] + oneof_schema_1_validator: Optional[conlist(conint(strict=True, le=255, ge=0), max_items=3, min_items=3)] = Field(None, description="RGB three element array with values 0-255.") + # data type: List[int] + oneof_schema_2_validator: Optional[conlist(conint(strict=True, le=255, ge=0), max_items=4, min_items=4)] = Field(None, description="RGBA four element array with values 0-255.") + # data type: str + oneof_schema_3_validator: Optional[constr(strict=True, max_length=7, min_length=7)] = Field(None, description="Hex color string, such as #00FF00.") + if TYPE_CHECKING: + actual_instance: Union[List[int], str] + else: + actual_instance: Any + one_of_schemas: List[str] = Field(COLOR_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): + if v is None: + return v + + instance = Color.construct() + error_messages = [] + match = 0 + # validate data type: List[int] + try: + instance.oneof_schema_1_validator = v + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: List[int] + try: + instance.oneof_schema_2_validator = v + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: str + try: + instance.oneof_schema_3_validator = v + 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 setting `actual_instance` in Color with oneOf schemas: List[int], str. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in Color with oneOf schemas: List[int], str. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: dict) -> Color: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Color: + """Returns the object represented by the json string""" + instance = Color.construct() + if json_str is None: + return instance + + error_messages = [] + match = 0 + + # deserialize data into List[int] + try: + # validation + instance.oneof_schema_1_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.oneof_schema_1_validator + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into List[int] + try: + # validation + instance.oneof_schema_2_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.oneof_schema_2_validator + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into str + try: + # validation + instance.oneof_schema_3_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.oneof_schema_3_validator + 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 Color with oneOf schemas: List[int], str. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into Color with oneOf schemas: List[int], str. 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()) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/creature.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/creature.py new file mode 100644 index 00000000000..dc2d94ece4c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/creature.py @@ -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.creature_info import CreatureInfo + +class Creature(BaseModel): + """ + Creature + """ + info: CreatureInfo = Field(...) + type: StrictStr = Field(...) + __properties = ["info", "type"] + + 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) -> Creature: + """Create an instance of Creature 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 info + if self.info: + _dict['info'] = self.info.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> Creature: + """Create an instance of Creature from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Creature.parse_obj(obj) + + _obj = Creature.parse_obj({ + "info": CreatureInfo.from_dict(obj.get("info")) if obj.get("info") is not None else None, + "type": obj.get("type") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/creature_info.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/creature_info.py new file mode 100644 index 00000000000..327ce9bc4fb --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/creature_info.py @@ -0,0 +1,71 @@ +# 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 + +class CreatureInfo(BaseModel): + """ + CreatureInfo + """ + name: StrictStr = Field(...) + __properties = ["name"] + + 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) -> CreatureInfo: + """Create an instance of CreatureInfo 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) -> CreatureInfo: + """Create an instance of CreatureInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CreatureInfo.parse_obj(obj) + + _obj = CreatureInfo.parse_obj({ + "name": obj.get("name") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/danish_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/danish_pig.py new file mode 100644 index 00000000000..cfb24a7d585 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/danish_pig.py @@ -0,0 +1,73 @@ +# 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, StrictInt, StrictStr + +class DanishPig(BaseModel): + """ + DanishPig + """ + class_name: StrictStr = Field(..., alias="className") + size: StrictInt = Field(...) + __properties = ["className", "size"] + + 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) -> DanishPig: + """Create an instance of DanishPig 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) -> DanishPig: + """Create an instance of DanishPig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return DanishPig.parse_obj(obj) + + _obj = DanishPig.parse_obj({ + "class_name": obj.get("className"), + "size": obj.get("size") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/deprecated_object.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/deprecated_object.py new file mode 100644 index 00000000000..9ce72f88d48 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/deprecated_object.py @@ -0,0 +1,71 @@ +# 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 Optional +from pydantic import BaseModel, StrictStr + +class DeprecatedObject(BaseModel): + """ + DeprecatedObject + """ + name: Optional[StrictStr] = None + __properties = ["name"] + + 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) -> DeprecatedObject: + """Create an instance of DeprecatedObject 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) -> DeprecatedObject: + """Create an instance of DeprecatedObject from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return DeprecatedObject.parse_obj(obj) + + _obj = DeprecatedObject.parse_obj({ + "name": obj.get("name") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/dog.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/dog.py new file mode 100644 index 00000000000..f0533a50e49 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/dog.py @@ -0,0 +1,74 @@ +# 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 Optional +from pydantic import StrictStr +from petstore_api.models.animal import Animal + +class Dog(Animal): + """ + Dog + """ + breed: Optional[StrictStr] = None + __properties = ["className", "color", "breed"] + + 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) -> Dog: + """Create an instance of Dog 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) -> Dog: + """Create an instance of Dog from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Dog.parse_obj(obj) + + _obj = Dog.parse_obj({ + "class_name": obj.get("className"), + "color": obj.get("color") if obj.get("color") is not None else 'red', + "breed": obj.get("breed") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/dummy_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/dummy_model.py new file mode 100644 index 00000000000..8e4db12e5c9 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/dummy_model.py @@ -0,0 +1,78 @@ +# 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 Optional +from pydantic import BaseModel, StrictStr + +class DummyModel(BaseModel): + """ + DummyModel + """ + category: Optional[StrictStr] = None + self_ref: Optional[SelfReferenceModel] = None + __properties = ["category", "self_ref"] + + 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) -> DummyModel: + """Create an instance of DummyModel 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 self_ref + if self.self_ref: + _dict['self_ref'] = self.self_ref.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> DummyModel: + """Create an instance of DummyModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return DummyModel.parse_obj(obj) + + _obj = DummyModel.parse_obj({ + "category": obj.get("category"), + "self_ref": SelfReferenceModel.from_dict(obj.get("self_ref")) if obj.get("self_ref") is not None else None + }) + return _obj + +from petstore_api.models.self_reference_model import SelfReferenceModel +DummyModel.update_forward_refs() + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_arrays.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_arrays.py new file mode 100644 index 00000000000..5f3363b0a56 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_arrays.py @@ -0,0 +1,94 @@ +# 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 List, Optional +from pydantic import BaseModel, StrictStr, conlist, validator + +class EnumArrays(BaseModel): + """ + EnumArrays + """ + just_symbol: Optional[StrictStr] = None + array_enum: Optional[conlist(StrictStr)] = None + __properties = ["just_symbol", "array_enum"] + + @validator('just_symbol') + def just_symbol_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('>=', '$'): + raise ValueError("must be one of enum values ('>=', '$')") + return value + + @validator('array_enum') + def array_enum_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in ('fish', 'crab'): + raise ValueError("each list item must be one of ('fish', 'crab')") + 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) -> EnumArrays: + """Create an instance of EnumArrays 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) -> EnumArrays: + """Create an instance of EnumArrays from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return EnumArrays.parse_obj(obj) + + _obj = EnumArrays.parse_obj({ + "just_symbol": obj.get("just_symbol"), + "array_enum": obj.get("array_enum") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_class.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_class.py new file mode 100644 index 00000000000..f3037885ed6 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_class.py @@ -0,0 +1,41 @@ +# 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 json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class EnumClass(str, Enum): + """ + EnumClass + """ + + """ + allowed enum values + """ + ABC = '_abc' + MINUS_EFG = '-efg' + LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS = '(xyz)' + + @classmethod + def from_json(cls, json_str: str) -> EnumClass: + """Create an instance of EnumClass from a JSON string""" + return EnumClass(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_string1.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_string1.py new file mode 100644 index 00000000000..8ced7d15629 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_string1.py @@ -0,0 +1,40 @@ +# 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 json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class EnumString1(str, Enum): + """ + EnumString1 + """ + + """ + allowed enum values + """ + A = 'a' + B = 'b' + + @classmethod + def from_json(cls, json_str: str) -> EnumString1: + """Create an instance of EnumString1 from a JSON string""" + return EnumString1(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_string2.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_string2.py new file mode 100644 index 00000000000..1ee33810910 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_string2.py @@ -0,0 +1,40 @@ +# 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 json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class EnumString2(str, Enum): + """ + EnumString2 + """ + + """ + allowed enum values + """ + C = 'c' + D = 'd' + + @classmethod + def from_json(cls, json_str: str) -> EnumString2: + """Create an instance of EnumString2 from a JSON string""" + return EnumString2(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_test.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_test.py new file mode 100644 index 00000000000..b3899720fd3 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/enum_test.py @@ -0,0 +1,143 @@ +# 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 Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr, validator +from petstore_api.models.outer_enum import OuterEnum +from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue +from petstore_api.models.outer_enum_integer import OuterEnumInteger +from petstore_api.models.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue + +class EnumTest(BaseModel): + """ + EnumTest + """ + enum_string: Optional[StrictStr] = None + enum_string_required: StrictStr = Field(...) + enum_integer_default: Optional[StrictInt] = 5 + enum_integer: Optional[StrictInt] = None + enum_number: Optional[float] = None + outer_enum: Optional[OuterEnum] = Field(None, alias="outerEnum") + outer_enum_integer: Optional[OuterEnumInteger] = Field(None, alias="outerEnumInteger") + outer_enum_default_value: Optional[OuterEnumDefaultValue] = Field(None, alias="outerEnumDefaultValue") + outer_enum_integer_default_value: Optional[OuterEnumIntegerDefaultValue] = Field(None, alias="outerEnumIntegerDefaultValue") + __properties = ["enum_string", "enum_string_required", "enum_integer_default", "enum_integer", "enum_number", "outerEnum", "outerEnumInteger", "outerEnumDefaultValue", "outerEnumIntegerDefaultValue"] + + @validator('enum_string') + def enum_string_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('UPPER', 'lower', ''): + raise ValueError("must be one of enum values ('UPPER', 'lower', '')") + return value + + @validator('enum_string_required') + def enum_string_required_validate_enum(cls, value): + """Validates the enum""" + if value not in ('UPPER', 'lower', ''): + raise ValueError("must be one of enum values ('UPPER', 'lower', '')") + return value + + @validator('enum_integer_default') + def enum_integer_default_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in (1, 5, 14): + raise ValueError("must be one of enum values (1, 5, 14)") + return value + + @validator('enum_integer') + def enum_integer_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in (1, -1): + raise ValueError("must be one of enum values (1, -1)") + return value + + @validator('enum_number') + def enum_number_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in (1.1, -1.2): + raise ValueError("must be one of enum values (1.1, -1.2)") + 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) -> EnumTest: + """Create an instance of EnumTest 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) + # set to None if outer_enum (nullable) is None + # and __fields_set__ contains the field + if self.outer_enum is None and "outer_enum" in self.__fields_set__: + _dict['outerEnum'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> EnumTest: + """Create an instance of EnumTest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return EnumTest.parse_obj(obj) + + _obj = EnumTest.parse_obj({ + "enum_string": obj.get("enum_string"), + "enum_string_required": obj.get("enum_string_required"), + "enum_integer_default": obj.get("enum_integer_default") if obj.get("enum_integer_default") is not None else 5, + "enum_integer": obj.get("enum_integer"), + "enum_number": obj.get("enum_number"), + "outer_enum": obj.get("outerEnum"), + "outer_enum_integer": obj.get("outerEnumInteger"), + "outer_enum_default_value": obj.get("outerEnumDefaultValue"), + "outer_enum_integer_default_value": obj.get("outerEnumIntegerDefaultValue") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/file.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/file.py new file mode 100644 index 00000000000..c87e30f73bf --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/file.py @@ -0,0 +1,71 @@ +# 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 Optional +from pydantic import BaseModel, Field, StrictStr + +class File(BaseModel): + """ + Must be named `File` for test. # noqa: E501 + """ + source_uri: Optional[StrictStr] = Field(None, alias="sourceURI", description="Test capitalization") + __properties = ["sourceURI"] + + 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) -> File: + """Create an instance of File 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) -> File: + """Create an instance of File from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return File.parse_obj(obj) + + _obj = File.parse_obj({ + "source_uri": obj.get("sourceURI") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/file_schema_test_class.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/file_schema_test_class.py new file mode 100644 index 00000000000..32058bd16fa --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/file_schema_test_class.py @@ -0,0 +1,84 @@ +# 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 List, Optional +from pydantic import BaseModel, conlist +from petstore_api.models.file import File + +class FileSchemaTestClass(BaseModel): + """ + FileSchemaTestClass + """ + file: Optional[File] = None + files: Optional[conlist(File)] = None + __properties = ["file", "files"] + + 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) -> FileSchemaTestClass: + """Create an instance of FileSchemaTestClass 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 file + if self.file: + _dict['file'] = self.file.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in files (list) + _items = [] + if self.files: + for _item in self.files: + if _item: + _items.append(_item.to_dict()) + _dict['files'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> FileSchemaTestClass: + """Create an instance of FileSchemaTestClass from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return FileSchemaTestClass.parse_obj(obj) + + _obj = FileSchemaTestClass.parse_obj({ + "file": File.from_dict(obj.get("file")) if obj.get("file") is not None else None, + "files": [File.from_dict(_item) for _item in obj.get("files")] if obj.get("files") is not None else None + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/first_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/first_ref.py new file mode 100644 index 00000000000..ace84a5bcb8 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/first_ref.py @@ -0,0 +1,78 @@ +# 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 Optional +from pydantic import BaseModel, StrictStr + +class FirstRef(BaseModel): + """ + FirstRef + """ + category: Optional[StrictStr] = None + self_ref: Optional[SecondRef] = None + __properties = ["category", "self_ref"] + + 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) -> FirstRef: + """Create an instance of FirstRef 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 self_ref + if self.self_ref: + _dict['self_ref'] = self.self_ref.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> FirstRef: + """Create an instance of FirstRef from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return FirstRef.parse_obj(obj) + + _obj = FirstRef.parse_obj({ + "category": obj.get("category"), + "self_ref": SecondRef.from_dict(obj.get("self_ref")) if obj.get("self_ref") is not None else None + }) + return _obj + +from petstore_api.models.second_ref import SecondRef +FirstRef.update_forward_refs() + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/foo.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/foo.py new file mode 100644 index 00000000000..fc58b159e5f --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/foo.py @@ -0,0 +1,71 @@ +# 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 Optional +from pydantic import BaseModel, StrictStr + +class Foo(BaseModel): + """ + Foo + """ + bar: Optional[StrictStr] = 'bar' + __properties = ["bar"] + + 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) -> Foo: + """Create an instance of Foo 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) -> Foo: + """Create an instance of Foo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Foo.parse_obj(obj) + + _obj = Foo.parse_obj({ + "bar": obj.get("bar") if obj.get("bar") is not None else 'bar' + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/foo_get_default_response.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/foo_get_default_response.py new file mode 100644 index 00000000000..e792358dc00 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/foo_get_default_response.py @@ -0,0 +1,75 @@ +# 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 Optional +from pydantic import BaseModel +from petstore_api.models.foo import Foo + +class FooGetDefaultResponse(BaseModel): + """ + FooGetDefaultResponse + """ + string: Optional[Foo] = None + __properties = ["string"] + + 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) -> FooGetDefaultResponse: + """Create an instance of FooGetDefaultResponse 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 string + if self.string: + _dict['string'] = self.string.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> FooGetDefaultResponse: + """Create an instance of FooGetDefaultResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return FooGetDefaultResponse.parse_obj(obj) + + _obj = FooGetDefaultResponse.parse_obj({ + "string": Foo.from_dict(obj.get("string")) if obj.get("string") is not None else None + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/format_test.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/format_test.py new file mode 100644 index 00000000000..a0abc32a659 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/format_test.py @@ -0,0 +1,143 @@ +# 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 datetime import date, datetime +from typing import Optional, Union +from pydantic import BaseModel, Field, StrictBytes, StrictInt, StrictStr, condecimal, confloat, conint, constr, validator + +class FormatTest(BaseModel): + """ + FormatTest + """ + integer: Optional[conint(strict=True, le=100, ge=10)] = None + int32: Optional[conint(strict=True, le=200, ge=20)] = None + int64: Optional[StrictInt] = None + number: confloat(le=543.2, ge=32.1) = Field(...) + float: Optional[confloat(le=987.6, ge=54.3)] = None + double: Optional[confloat(le=123.4, ge=67.8)] = None + decimal: Optional[condecimal()] = None + string: Optional[constr(strict=True)] = None + string_with_double_quote_pattern: Optional[constr(strict=True)] = None + byte: Optional[Union[StrictBytes, StrictStr]] = None + binary: Optional[Union[StrictBytes, StrictStr]] = None + var_date: date = Field(..., alias="date") + date_time: Optional[datetime] = Field(None, alias="dateTime") + uuid: Optional[StrictStr] = None + password: constr(strict=True, max_length=64, min_length=10) = Field(...) + pattern_with_digits: Optional[constr(strict=True)] = Field(None, description="A string that is a 10 digit number. Can have leading zeros.") + pattern_with_digits_and_delimiter: Optional[constr(strict=True)] = Field(None, description="A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.") + __properties = ["integer", "int32", "int64", "number", "float", "double", "decimal", "string", "string_with_double_quote_pattern", "byte", "binary", "date", "dateTime", "uuid", "password", "pattern_with_digits", "pattern_with_digits_and_delimiter"] + + @validator('string') + def string_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"[a-z]", value ,re.IGNORECASE): + raise ValueError(r"must validate the regular expression /[a-z]/i") + return value + + @validator('string_with_double_quote_pattern') + def string_with_double_quote_pattern_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"this is \"something\"", value): + raise ValueError(r"must validate the regular expression /this is \"something\"/") + return value + + @validator('pattern_with_digits') + def pattern_with_digits_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^\d{10}$", value): + raise ValueError(r"must validate the regular expression /^\d{10}$/") + return value + + @validator('pattern_with_digits_and_delimiter') + def pattern_with_digits_and_delimiter_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^image_\d{1,3}$", value ,re.IGNORECASE): + raise ValueError(r"must validate the regular expression /^image_\d{1,3}$/i") + 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) -> FormatTest: + """Create an instance of FormatTest 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) -> FormatTest: + """Create an instance of FormatTest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return FormatTest.parse_obj(obj) + + _obj = FormatTest.parse_obj({ + "integer": obj.get("integer"), + "int32": obj.get("int32"), + "int64": obj.get("int64"), + "number": obj.get("number"), + "float": obj.get("float"), + "double": obj.get("double"), + "decimal": obj.get("decimal"), + "string": obj.get("string"), + "string_with_double_quote_pattern": obj.get("string_with_double_quote_pattern"), + "byte": obj.get("byte"), + "binary": obj.get("binary"), + "var_date": obj.get("date"), + "date_time": obj.get("dateTime"), + "uuid": obj.get("uuid"), + "password": obj.get("password"), + "pattern_with_digits": obj.get("pattern_with_digits"), + "pattern_with_digits_and_delimiter": obj.get("pattern_with_digits_and_delimiter") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/has_only_read_only.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/has_only_read_only.py new file mode 100644 index 00000000000..5a6dd7857d1 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/has_only_read_only.py @@ -0,0 +1,75 @@ +# 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 Optional +from pydantic import BaseModel, StrictStr + +class HasOnlyReadOnly(BaseModel): + """ + HasOnlyReadOnly + """ + bar: Optional[StrictStr] = None + foo: Optional[StrictStr] = None + __properties = ["bar", "foo"] + + 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) -> HasOnlyReadOnly: + """Create an instance of HasOnlyReadOnly 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={ + "bar", + "foo", + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> HasOnlyReadOnly: + """Create an instance of HasOnlyReadOnly from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return HasOnlyReadOnly.parse_obj(obj) + + _obj = HasOnlyReadOnly.parse_obj({ + "bar": obj.get("bar"), + "foo": obj.get("foo") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/health_check_result.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/health_check_result.py new file mode 100644 index 00000000000..02405bea384 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/health_check_result.py @@ -0,0 +1,76 @@ +# 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 Optional +from pydantic import BaseModel, Field, StrictStr + +class HealthCheckResult(BaseModel): + """ + Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. # noqa: E501 + """ + nullable_message: Optional[StrictStr] = Field(None, alias="NullableMessage") + __properties = ["NullableMessage"] + + 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) -> HealthCheckResult: + """Create an instance of HealthCheckResult 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) + # set to None if nullable_message (nullable) is None + # and __fields_set__ contains the field + if self.nullable_message is None and "nullable_message" in self.__fields_set__: + _dict['NullableMessage'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> HealthCheckResult: + """Create an instance of HealthCheckResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return HealthCheckResult.parse_obj(obj) + + _obj = HealthCheckResult.parse_obj({ + "nullable_message": obj.get("NullableMessage") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/inner_dict_with_property.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/inner_dict_with_property.py new file mode 100644 index 00000000000..9f134186b6a --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/inner_dict_with_property.py @@ -0,0 +1,71 @@ +# 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, Optional +from pydantic import BaseModel, Field + +class InnerDictWithProperty(BaseModel): + """ + InnerDictWithProperty + """ + a_property: Optional[Dict[str, Any]] = Field(None, alias="aProperty") + __properties = ["aProperty"] + + 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) -> InnerDictWithProperty: + """Create an instance of InnerDictWithProperty 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) -> InnerDictWithProperty: + """Create an instance of InnerDictWithProperty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return InnerDictWithProperty.parse_obj(obj) + + _obj = InnerDictWithProperty.parse_obj({ + "a_property": obj.get("aProperty") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/int_or_string.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/int_or_string.py new file mode 100644 index 00000000000..5d5de47e305 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/int_or_string.py @@ -0,0 +1,147 @@ +# 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, conint, validator +from typing import Union, Any, List, TYPE_CHECKING +from pydantic import StrictStr, Field + +INTORSTRING_ONE_OF_SCHEMAS = ["int", "str"] + +class IntOrString(BaseModel): + """ + IntOrString + """ + # data type: int + oneof_schema_1_validator: Optional[conint(strict=True, ge=10)] = None + # data type: str + oneof_schema_2_validator: Optional[StrictStr] = None + if TYPE_CHECKING: + actual_instance: Union[int, str] + else: + actual_instance: Any + one_of_schemas: List[str] = Field(INTORSTRING_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 = IntOrString.construct() + error_messages = [] + match = 0 + # validate data type: int + try: + instance.oneof_schema_1_validator = v + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: str + try: + instance.oneof_schema_2_validator = v + 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 setting `actual_instance` in IntOrString with oneOf schemas: int, str. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in IntOrString with oneOf schemas: int, str. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: dict) -> IntOrString: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> IntOrString: + """Returns the object represented by the json string""" + instance = IntOrString.construct() + error_messages = [] + match = 0 + + # deserialize data into int + try: + # validation + instance.oneof_schema_1_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.oneof_schema_1_validator + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into str + try: + # validation + instance.oneof_schema_2_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.oneof_schema_2_validator + 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 IntOrString with oneOf schemas: int, str. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into IntOrString with oneOf schemas: int, str. 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()) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/list.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/list.py new file mode 100644 index 00000000000..4c6868146ad --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/list.py @@ -0,0 +1,71 @@ +# 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 Optional +from pydantic import BaseModel, Field, StrictStr + +class List(BaseModel): + """ + List + """ + var_123_list: Optional[StrictStr] = Field(None, alias="123-list") + __properties = ["123-list"] + + 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) -> List: + """Create an instance of List 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) -> List: + """Create an instance of List from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return List.parse_obj(obj) + + _obj = List.parse_obj({ + "var_123_list": obj.get("123-list") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/map_of_array_of_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/map_of_array_of_model.py new file mode 100644 index 00000000000..444732620ab --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/map_of_array_of_model.py @@ -0,0 +1,88 @@ +# 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 Dict, List, Optional +from pydantic import BaseModel, Field, conlist +from petstore_api.models.tag import Tag + +class MapOfArrayOfModel(BaseModel): + """ + MapOfArrayOfModel + """ + shop_id_to_org_online_lip_map: Optional[Dict[str, conlist(Tag)]] = Field(None, alias="shopIdToOrgOnlineLipMap") + __properties = ["shopIdToOrgOnlineLipMap"] + + 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) -> MapOfArrayOfModel: + """Create an instance of MapOfArrayOfModel 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 each value in shop_id_to_org_online_lip_map (dict of array) + _field_dict_of_array = {} + if self.shop_id_to_org_online_lip_map: + for _key in self.shop_id_to_org_online_lip_map: + if self.shop_id_to_org_online_lip_map[_key]: + _field_dict_of_array[_key] = [ + _item.to_dict() for _item in self.shop_id_to_org_online_lip_map[_key] + ] + _dict['shopIdToOrgOnlineLipMap'] = _field_dict_of_array + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> MapOfArrayOfModel: + """Create an instance of MapOfArrayOfModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return MapOfArrayOfModel.parse_obj(obj) + + _obj = MapOfArrayOfModel.parse_obj({ + "shop_id_to_org_online_lip_map": dict( + (_k, + [Tag.from_dict(_item) for _item in _v] + if _v is not None + else None + ) + for _k, _v in obj.get("shopIdToOrgOnlineLipMap").items() + ) + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/map_test.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/map_test.py new file mode 100644 index 00000000000..42e47b1cb4f --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/map_test.py @@ -0,0 +1,87 @@ +# 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 Dict, Optional +from pydantic import BaseModel, StrictBool, StrictStr, validator + +class MapTest(BaseModel): + """ + MapTest + """ + map_map_of_string: Optional[Dict[str, Dict[str, StrictStr]]] = None + map_of_enum_string: Optional[Dict[str, StrictStr]] = None + direct_map: Optional[Dict[str, StrictBool]] = None + indirect_map: Optional[Dict[str, StrictBool]] = None + __properties = ["map_map_of_string", "map_of_enum_string", "direct_map", "indirect_map"] + + @validator('map_of_enum_string') + def map_of_enum_string_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('UPPER', 'lower'): + raise ValueError("must be one of enum values ('UPPER', 'lower')") + 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) -> MapTest: + """Create an instance of MapTest 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) -> MapTest: + """Create an instance of MapTest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return MapTest.parse_obj(obj) + + _obj = MapTest.parse_obj({ + "map_map_of_string": obj.get("map_map_of_string"), + "map_of_enum_string": obj.get("map_of_enum_string"), + "direct_map": obj.get("direct_map"), + "indirect_map": obj.get("indirect_map") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/mixed_properties_and_additional_properties_class.py new file mode 100644 index 00000000000..03f306af535 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/mixed_properties_and_additional_properties_class.py @@ -0,0 +1,88 @@ +# 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 datetime import datetime +from typing import Dict, Optional +from pydantic import BaseModel, Field, StrictStr +from petstore_api.models.animal import Animal + +class MixedPropertiesAndAdditionalPropertiesClass(BaseModel): + """ + MixedPropertiesAndAdditionalPropertiesClass + """ + uuid: Optional[StrictStr] = None + date_time: Optional[datetime] = Field(None, alias="dateTime") + map: Optional[Dict[str, Animal]] = None + __properties = ["uuid", "dateTime", "map"] + + 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) -> MixedPropertiesAndAdditionalPropertiesClass: + """Create an instance of MixedPropertiesAndAdditionalPropertiesClass 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 each value in map (dict) + _field_dict = {} + if self.map: + for _key in self.map: + if self.map[_key]: + _field_dict[_key] = self.map[_key].to_dict() + _dict['map'] = _field_dict + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> MixedPropertiesAndAdditionalPropertiesClass: + """Create an instance of MixedPropertiesAndAdditionalPropertiesClass from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return MixedPropertiesAndAdditionalPropertiesClass.parse_obj(obj) + + _obj = MixedPropertiesAndAdditionalPropertiesClass.parse_obj({ + "uuid": obj.get("uuid"), + "date_time": obj.get("dateTime"), + "map": dict( + (_k, Animal.from_dict(_v)) + for _k, _v in obj.get("map").items() + ) + if obj.get("map") is not None + else None + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/model200_response.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/model200_response.py new file mode 100644 index 00000000000..f129e4dafe8 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/model200_response.py @@ -0,0 +1,73 @@ +# 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 Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr + +class Model200Response(BaseModel): + """ + Model for testing model name starting with number # noqa: E501 + """ + name: Optional[StrictInt] = None + var_class: Optional[StrictStr] = Field(None, alias="class") + __properties = ["name", "class"] + + 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) -> Model200Response: + """Create an instance of Model200Response 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) -> Model200Response: + """Create an instance of Model200Response from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Model200Response.parse_obj(obj) + + _obj = Model200Response.parse_obj({ + "name": obj.get("name"), + "var_class": obj.get("class") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/model_return.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/model_return.py new file mode 100644 index 00000000000..1d2b0266d34 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/model_return.py @@ -0,0 +1,71 @@ +# 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 Optional +from pydantic import BaseModel, Field, StrictInt + +class ModelReturn(BaseModel): + """ + Model for testing reserved words # noqa: E501 + """ + var_return: Optional[StrictInt] = Field(None, alias="return") + __properties = ["return"] + + 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) -> ModelReturn: + """Create an instance of ModelReturn 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) -> ModelReturn: + """Create an instance of ModelReturn from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ModelReturn.parse_obj(obj) + + _obj = ModelReturn.parse_obj({ + "var_return": obj.get("return") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/name.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/name.py new file mode 100644 index 00000000000..5284db112e9 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/name.py @@ -0,0 +1,79 @@ +# 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 Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr + +class Name(BaseModel): + """ + Model for testing model name same as property name # noqa: E501 + """ + name: StrictInt = Field(...) + snake_case: Optional[StrictInt] = None + var_property: Optional[StrictStr] = Field(None, alias="property") + var_123_number: Optional[StrictInt] = Field(None, alias="123Number") + __properties = ["name", "snake_case", "property", "123Number"] + + 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) -> Name: + """Create an instance of Name 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={ + "snake_case", + "var_123_number", + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> Name: + """Create an instance of Name from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Name.parse_obj(obj) + + _obj = Name.parse_obj({ + "name": obj.get("name"), + "snake_case": obj.get("snake_case"), + "var_property": obj.get("property"), + "var_123_number": obj.get("123Number") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/nullable_class.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/nullable_class.py new file mode 100644 index 00000000000..f26aac9ff07 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/nullable_class.py @@ -0,0 +1,162 @@ +# 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 datetime import date, datetime +from typing import Any, Dict, List, Optional +from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, conlist + +class NullableClass(BaseModel): + """ + NullableClass + """ + required_integer_prop: Optional[StrictInt] = Field(...) + integer_prop: Optional[StrictInt] = None + number_prop: Optional[float] = None + boolean_prop: Optional[StrictBool] = None + string_prop: Optional[StrictStr] = None + date_prop: Optional[date] = None + datetime_prop: Optional[datetime] = None + array_nullable_prop: Optional[conlist(Dict[str, Any])] = None + array_and_items_nullable_prop: Optional[conlist(Dict[str, Any])] = None + array_items_nullable: Optional[conlist(Dict[str, Any])] = None + object_nullable_prop: Optional[Dict[str, Dict[str, Any]]] = None + object_and_items_nullable_prop: Optional[Dict[str, Dict[str, Any]]] = None + object_items_nullable: Optional[Dict[str, Dict[str, Any]]] = None + additional_properties: Dict[str, Any] = {} + __properties = ["required_integer_prop", "integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable"] + + 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) -> NullableClass: + """Create an instance of NullableClass 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 + + # set to None if required_integer_prop (nullable) is None + # and __fields_set__ contains the field + if self.required_integer_prop is None and "required_integer_prop" in self.__fields_set__: + _dict['required_integer_prop'] = None + + # set to None if integer_prop (nullable) is None + # and __fields_set__ contains the field + if self.integer_prop is None and "integer_prop" in self.__fields_set__: + _dict['integer_prop'] = None + + # set to None if number_prop (nullable) is None + # and __fields_set__ contains the field + if self.number_prop is None and "number_prop" in self.__fields_set__: + _dict['number_prop'] = None + + # set to None if boolean_prop (nullable) is None + # and __fields_set__ contains the field + if self.boolean_prop is None and "boolean_prop" in self.__fields_set__: + _dict['boolean_prop'] = None + + # set to None if string_prop (nullable) is None + # and __fields_set__ contains the field + if self.string_prop is None and "string_prop" in self.__fields_set__: + _dict['string_prop'] = None + + # set to None if date_prop (nullable) is None + # and __fields_set__ contains the field + if self.date_prop is None and "date_prop" in self.__fields_set__: + _dict['date_prop'] = None + + # set to None if datetime_prop (nullable) is None + # and __fields_set__ contains the field + if self.datetime_prop is None and "datetime_prop" in self.__fields_set__: + _dict['datetime_prop'] = None + + # set to None if array_nullable_prop (nullable) is None + # and __fields_set__ contains the field + if self.array_nullable_prop is None and "array_nullable_prop" in self.__fields_set__: + _dict['array_nullable_prop'] = None + + # set to None if array_and_items_nullable_prop (nullable) is None + # and __fields_set__ contains the field + if self.array_and_items_nullable_prop is None and "array_and_items_nullable_prop" in self.__fields_set__: + _dict['array_and_items_nullable_prop'] = None + + # set to None if object_nullable_prop (nullable) is None + # and __fields_set__ contains the field + if self.object_nullable_prop is None and "object_nullable_prop" in self.__fields_set__: + _dict['object_nullable_prop'] = None + + # set to None if object_and_items_nullable_prop (nullable) is None + # and __fields_set__ contains the field + if self.object_and_items_nullable_prop is None and "object_and_items_nullable_prop" in self.__fields_set__: + _dict['object_and_items_nullable_prop'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> NullableClass: + """Create an instance of NullableClass from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return NullableClass.parse_obj(obj) + + _obj = NullableClass.parse_obj({ + "required_integer_prop": obj.get("required_integer_prop"), + "integer_prop": obj.get("integer_prop"), + "number_prop": obj.get("number_prop"), + "boolean_prop": obj.get("boolean_prop"), + "string_prop": obj.get("string_prop"), + "date_prop": obj.get("date_prop"), + "datetime_prop": obj.get("datetime_prop"), + "array_nullable_prop": obj.get("array_nullable_prop"), + "array_and_items_nullable_prop": obj.get("array_and_items_nullable_prop"), + "array_items_nullable": obj.get("array_items_nullable"), + "object_nullable_prop": obj.get("object_nullable_prop"), + "object_and_items_nullable_prop": obj.get("object_and_items_nullable_prop"), + "object_items_nullable": obj.get("object_items_nullable") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/nullable_property.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/nullable_property.py new file mode 100644 index 00000000000..2312fbbbf5f --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/nullable_property.py @@ -0,0 +1,88 @@ +# 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 Optional +from pydantic import BaseModel, Field, StrictInt, constr, validator + +class NullableProperty(BaseModel): + """ + NullableProperty + """ + id: StrictInt = Field(...) + name: Optional[constr(strict=True)] = Field(...) + __properties = ["id", "name"] + + @validator('name') + def name_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^[A-Z].*", value): + raise ValueError(r"must validate the regular expression /^[A-Z].*/") + 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) -> NullableProperty: + """Create an instance of NullableProperty 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) + # set to None if name (nullable) is None + # and __fields_set__ contains the field + if self.name is None and "name" in self.__fields_set__: + _dict['name'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> NullableProperty: + """Create an instance of NullableProperty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return NullableProperty.parse_obj(obj) + + _obj = NullableProperty.parse_obj({ + "id": obj.get("id"), + "name": obj.get("name") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/number_only.py new file mode 100644 index 00000000000..6549b261782 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/number_only.py @@ -0,0 +1,71 @@ +# 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 Optional +from pydantic import BaseModel, Field + +class NumberOnly(BaseModel): + """ + NumberOnly + """ + just_number: Optional[float] = Field(None, alias="JustNumber") + __properties = ["JustNumber"] + + 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) -> NumberOnly: + """Create an instance of NumberOnly 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) -> NumberOnly: + """Create an instance of NumberOnly from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return NumberOnly.parse_obj(obj) + + _obj = NumberOnly.parse_obj({ + "just_number": obj.get("JustNumber") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/object_to_test_additional_properties.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/object_to_test_additional_properties.py new file mode 100644 index 00000000000..f609e06f6a9 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/object_to_test_additional_properties.py @@ -0,0 +1,71 @@ +# 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 Optional +from pydantic import BaseModel, Field, StrictBool + +class ObjectToTestAdditionalProperties(BaseModel): + """ + Minimal object # noqa: E501 + """ + var_property: Optional[StrictBool] = Field(False, alias="property", description="Property") + __properties = ["property"] + + 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) -> ObjectToTestAdditionalProperties: + """Create an instance of ObjectToTestAdditionalProperties 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) -> ObjectToTestAdditionalProperties: + """Create an instance of ObjectToTestAdditionalProperties from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ObjectToTestAdditionalProperties.parse_obj(obj) + + _obj = ObjectToTestAdditionalProperties.parse_obj({ + "var_property": obj.get("property") if obj.get("property") is not None else False + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/object_with_deprecated_fields.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/object_with_deprecated_fields.py new file mode 100644 index 00000000000..421206c1bc7 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/object_with_deprecated_fields.py @@ -0,0 +1,81 @@ +# 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 List, Optional +from pydantic import BaseModel, Field, StrictStr, conlist +from petstore_api.models.deprecated_object import DeprecatedObject + +class ObjectWithDeprecatedFields(BaseModel): + """ + ObjectWithDeprecatedFields + """ + uuid: Optional[StrictStr] = None + id: Optional[float] = None + deprecated_ref: Optional[DeprecatedObject] = Field(None, alias="deprecatedRef") + bars: Optional[conlist(StrictStr)] = None + __properties = ["uuid", "id", "deprecatedRef", "bars"] + + 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) -> ObjectWithDeprecatedFields: + """Create an instance of ObjectWithDeprecatedFields 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 deprecated_ref + if self.deprecated_ref: + _dict['deprecatedRef'] = self.deprecated_ref.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> ObjectWithDeprecatedFields: + """Create an instance of ObjectWithDeprecatedFields from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ObjectWithDeprecatedFields.parse_obj(obj) + + _obj = ObjectWithDeprecatedFields.parse_obj({ + "uuid": obj.get("uuid"), + "id": obj.get("id"), + "deprecated_ref": DeprecatedObject.from_dict(obj.get("deprecatedRef")) if obj.get("deprecatedRef") is not None else None, + "bars": obj.get("bars") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/one_of_enum_string.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/one_of_enum_string.py new file mode 100644 index 00000000000..d7ae93ccb6a --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/one_of_enum_string.py @@ -0,0 +1,141 @@ +# 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.enum_string1 import EnumString1 +from petstore_api.models.enum_string2 import EnumString2 +from typing import Union, Any, List, TYPE_CHECKING +from pydantic import StrictStr, Field + +ONEOFENUMSTRING_ONE_OF_SCHEMAS = ["EnumString1", "EnumString2"] + +class OneOfEnumString(BaseModel): + """ + oneOf enum strings + """ + # data type: EnumString1 + oneof_schema_1_validator: Optional[EnumString1] = None + # data type: EnumString2 + oneof_schema_2_validator: Optional[EnumString2] = None + if TYPE_CHECKING: + actual_instance: Union[EnumString1, EnumString2] + else: + actual_instance: Any + one_of_schemas: List[str] = Field(ONEOFENUMSTRING_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 = OneOfEnumString.construct() + error_messages = [] + match = 0 + # validate data type: EnumString1 + if not isinstance(v, EnumString1): + error_messages.append(f"Error! Input type `{type(v)}` is not `EnumString1`") + else: + match += 1 + # validate data type: EnumString2 + if not isinstance(v, EnumString2): + error_messages.append(f"Error! Input type `{type(v)}` is not `EnumString2`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in OneOfEnumString with oneOf schemas: EnumString1, EnumString2. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in OneOfEnumString with oneOf schemas: EnumString1, EnumString2. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: dict) -> OneOfEnumString: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> OneOfEnumString: + """Returns the object represented by the json string""" + instance = OneOfEnumString.construct() + error_messages = [] + match = 0 + + # deserialize data into EnumString1 + try: + instance.actual_instance = EnumString1.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into EnumString2 + try: + instance.actual_instance = EnumString2.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 OneOfEnumString with oneOf schemas: EnumString1, EnumString2. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into OneOfEnumString with oneOf schemas: EnumString1, EnumString2. 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()) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/order.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/order.py new file mode 100644 index 00000000000..da726d2096d --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/order.py @@ -0,0 +1,91 @@ +# 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 datetime import datetime +from typing import Optional +from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, validator + +class Order(BaseModel): + """ + Order + """ + id: Optional[StrictInt] = None + pet_id: Optional[StrictInt] = Field(None, alias="petId") + quantity: Optional[StrictInt] = None + ship_date: Optional[datetime] = Field(None, alias="shipDate") + status: Optional[StrictStr] = Field(None, description="Order Status") + complete: Optional[StrictBool] = False + __properties = ["id", "petId", "quantity", "shipDate", "status", "complete"] + + @validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('placed', 'approved', 'delivered'): + raise ValueError("must be one of enum values ('placed', 'approved', 'delivered')") + 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) -> Order: + """Create an instance of Order 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) -> Order: + """Create an instance of Order from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Order.parse_obj(obj) + + _obj = Order.parse_obj({ + "id": obj.get("id"), + "pet_id": obj.get("petId"), + "quantity": obj.get("quantity"), + "ship_date": obj.get("shipDate"), + "status": obj.get("status"), + "complete": obj.get("complete") if obj.get("complete") is not None else False + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_composite.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_composite.py new file mode 100644 index 00000000000..63627c3d0fd --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_composite.py @@ -0,0 +1,75 @@ +# 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 Optional +from pydantic import BaseModel, StrictBool, StrictStr + +class OuterComposite(BaseModel): + """ + OuterComposite + """ + my_number: Optional[float] = None + my_string: Optional[StrictStr] = None + my_boolean: Optional[StrictBool] = None + __properties = ["my_number", "my_string", "my_boolean"] + + 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) -> OuterComposite: + """Create an instance of OuterComposite 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) -> OuterComposite: + """Create an instance of OuterComposite from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OuterComposite.parse_obj(obj) + + _obj = OuterComposite.parse_obj({ + "my_number": obj.get("my_number"), + "my_string": obj.get("my_string"), + "my_boolean": obj.get("my_boolean") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum.py new file mode 100644 index 00000000000..bfb06a008b5 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum.py @@ -0,0 +1,41 @@ +# 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 json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class OuterEnum(str, Enum): + """ + OuterEnum + """ + + """ + allowed enum values + """ + PLACED = 'placed' + APPROVED = 'approved' + DELIVERED = 'delivered' + + @classmethod + def from_json(cls, json_str: str) -> OuterEnum: + """Create an instance of OuterEnum from a JSON string""" + return OuterEnum(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_default_value.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_default_value.py new file mode 100644 index 00000000000..807c36f0fe5 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_default_value.py @@ -0,0 +1,41 @@ +# 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 json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class OuterEnumDefaultValue(str, Enum): + """ + OuterEnumDefaultValue + """ + + """ + allowed enum values + """ + PLACED = 'placed' + APPROVED = 'approved' + DELIVERED = 'delivered' + + @classmethod + def from_json(cls, json_str: str) -> OuterEnumDefaultValue: + """Create an instance of OuterEnumDefaultValue from a JSON string""" + return OuterEnumDefaultValue(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_integer.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_integer.py new file mode 100644 index 00000000000..77ae46fa705 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_integer.py @@ -0,0 +1,41 @@ +# 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 json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class OuterEnumInteger(int, Enum): + """ + OuterEnumInteger + """ + + """ + allowed enum values + """ + NUMBER_0 = 0 + NUMBER_1 = 1 + NUMBER_2 = 2 + + @classmethod + def from_json(cls, json_str: str) -> OuterEnumInteger: + """Create an instance of OuterEnumInteger from a JSON string""" + return OuterEnumInteger(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_integer_default_value.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_integer_default_value.py new file mode 100644 index 00000000000..36381197bb7 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_enum_integer_default_value.py @@ -0,0 +1,42 @@ +# 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 json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class OuterEnumIntegerDefaultValue(int, Enum): + """ + OuterEnumIntegerDefaultValue + """ + + """ + allowed enum values + """ + NUMBER_MINUS_1 = -1 + NUMBER_0 = 0 + NUMBER_1 = 1 + NUMBER_2 = 2 + + @classmethod + def from_json(cls, json_str: str) -> OuterEnumIntegerDefaultValue: + """Create an instance of OuterEnumIntegerDefaultValue from a JSON string""" + return OuterEnumIntegerDefaultValue(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_object_with_enum_property.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_object_with_enum_property.py new file mode 100644 index 00000000000..c4ae68e5510 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/outer_object_with_enum_property.py @@ -0,0 +1,80 @@ +# 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 Optional +from pydantic import BaseModel, Field +from petstore_api.models.outer_enum import OuterEnum +from petstore_api.models.outer_enum_integer import OuterEnumInteger + +class OuterObjectWithEnumProperty(BaseModel): + """ + OuterObjectWithEnumProperty + """ + str_value: Optional[OuterEnum] = None + value: OuterEnumInteger = Field(...) + __properties = ["str_value", "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) -> OuterObjectWithEnumProperty: + """Create an instance of OuterObjectWithEnumProperty 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) + # set to None if str_value (nullable) is None + # and __fields_set__ contains the field + if self.str_value is None and "str_value" in self.__fields_set__: + _dict['str_value'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> OuterObjectWithEnumProperty: + """Create an instance of OuterObjectWithEnumProperty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OuterObjectWithEnumProperty.parse_obj(obj) + + _obj = OuterObjectWithEnumProperty.parse_obj({ + "str_value": obj.get("str_value"), + "value": obj.get("value") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/parent.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/parent.py new file mode 100644 index 00000000000..a3105aff682 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/parent.py @@ -0,0 +1,84 @@ +# 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 Dict, Optional +from pydantic import BaseModel, Field +from petstore_api.models.inner_dict_with_property import InnerDictWithProperty + +class Parent(BaseModel): + """ + Parent + """ + optional_dict: Optional[Dict[str, InnerDictWithProperty]] = Field(None, alias="optionalDict") + __properties = ["optionalDict"] + + 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) -> Parent: + """Create an instance of Parent 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 each value in optional_dict (dict) + _field_dict = {} + if self.optional_dict: + for _key in self.optional_dict: + if self.optional_dict[_key]: + _field_dict[_key] = self.optional_dict[_key].to_dict() + _dict['optionalDict'] = _field_dict + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> Parent: + """Create an instance of Parent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Parent.parse_obj(obj) + + _obj = Parent.parse_obj({ + "optional_dict": dict( + (_k, InnerDictWithProperty.from_dict(_v)) + for _k, _v in obj.get("optionalDict").items() + ) + if obj.get("optionalDict") is not None + else None + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/parent_with_optional_dict.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/parent_with_optional_dict.py new file mode 100644 index 00000000000..253747b3abd --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/parent_with_optional_dict.py @@ -0,0 +1,84 @@ +# 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 Dict, Optional +from pydantic import BaseModel, Field +from petstore_api.models.inner_dict_with_property import InnerDictWithProperty + +class ParentWithOptionalDict(BaseModel): + """ + ParentWithOptionalDict + """ + optional_dict: Optional[Dict[str, InnerDictWithProperty]] = Field(None, alias="optionalDict") + __properties = ["optionalDict"] + + 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) -> ParentWithOptionalDict: + """Create an instance of ParentWithOptionalDict 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 each value in optional_dict (dict) + _field_dict = {} + if self.optional_dict: + for _key in self.optional_dict: + if self.optional_dict[_key]: + _field_dict[_key] = self.optional_dict[_key].to_dict() + _dict['optionalDict'] = _field_dict + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> ParentWithOptionalDict: + """Create an instance of ParentWithOptionalDict from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ParentWithOptionalDict.parse_obj(obj) + + _obj = ParentWithOptionalDict.parse_obj({ + "optional_dict": dict( + (_k, InnerDictWithProperty.from_dict(_v)) + for _k, _v in obj.get("optionalDict").items() + ) + if obj.get("optionalDict") is not None + else None + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/pet.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/pet.py new file mode 100644 index 00000000000..e45fdc4a27d --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/pet.py @@ -0,0 +1,103 @@ +# 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 List, Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator +from petstore_api.models.category import Category +from petstore_api.models.tag import Tag + +class Pet(BaseModel): + """ + Pet + """ + id: Optional[StrictInt] = None + category: Optional[Category] = None + name: StrictStr = Field(...) + photo_urls: conlist(StrictStr, min_items=0, unique_items=True) = Field(..., alias="photoUrls") + tags: Optional[conlist(Tag)] = None + status: Optional[StrictStr] = Field(None, description="pet status in the store") + __properties = ["id", "category", "name", "photoUrls", "tags", "status"] + + @validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('available', 'pending', 'sold'): + raise ValueError("must be one of enum values ('available', 'pending', 'sold')") + 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) -> Pet: + """Create an instance of Pet 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 category + if self.category: + _dict['category'] = self.category.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in tags (list) + _items = [] + if self.tags: + for _item in self.tags: + if _item: + _items.append(_item.to_dict()) + _dict['tags'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> Pet: + """Create an instance of Pet from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Pet.parse_obj(obj) + + _obj = Pet.parse_obj({ + "id": obj.get("id"), + "category": Category.from_dict(obj.get("category")) if obj.get("category") is not None else None, + "name": obj.get("name"), + "photo_urls": obj.get("photoUrls"), + "tags": [Tag.from_dict(_item) for _item in obj.get("tags")] if obj.get("tags") is not None else None, + "status": obj.get("status") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/pig.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/pig.py new file mode 100644 index 00000000000..1cb002bf6f7 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/pig.py @@ -0,0 +1,144 @@ +# 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.basque_pig import BasquePig +from petstore_api.models.danish_pig import DanishPig +from typing import Union, Any, List, TYPE_CHECKING +from pydantic import StrictStr, Field + +PIG_ONE_OF_SCHEMAS = ["BasquePig", "DanishPig"] + +class Pig(BaseModel): + """ + Pig + """ + # data type: BasquePig + oneof_schema_1_validator: Optional[BasquePig] = None + # data type: DanishPig + oneof_schema_2_validator: Optional[DanishPig] = None + if TYPE_CHECKING: + actual_instance: Union[BasquePig, DanishPig] + else: + actual_instance: Any + one_of_schemas: List[str] = Field(PIG_ONE_OF_SCHEMAS, const=True) + + class Config: + validate_assignment = True + + discriminator_value_class_map = { + } + + 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 = Pig.construct() + error_messages = [] + match = 0 + # validate data type: BasquePig + if not isinstance(v, BasquePig): + error_messages.append(f"Error! Input type `{type(v)}` is not `BasquePig`") + else: + match += 1 + # validate data type: DanishPig + if not isinstance(v, DanishPig): + error_messages.append(f"Error! Input type `{type(v)}` is not `DanishPig`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in Pig with oneOf schemas: BasquePig, DanishPig. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in Pig with oneOf schemas: BasquePig, DanishPig. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: dict) -> Pig: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Pig: + """Returns the object represented by the json string""" + instance = Pig.construct() + error_messages = [] + match = 0 + + # deserialize data into BasquePig + try: + instance.actual_instance = BasquePig.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into DanishPig + try: + instance.actual_instance = DanishPig.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 Pig with oneOf schemas: BasquePig, DanishPig. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into Pig with oneOf schemas: BasquePig, DanishPig. 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()) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/property_name_collision.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/property_name_collision.py new file mode 100644 index 00000000000..ed45ecdf74c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/property_name_collision.py @@ -0,0 +1,75 @@ +# 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 Optional +from pydantic import BaseModel, Field, StrictStr + +class PropertyNameCollision(BaseModel): + """ + PropertyNameCollision + """ + type: Optional[StrictStr] = Field(None, alias="_type") + type: Optional[StrictStr] = None + type_: Optional[StrictStr] = None + __properties = ["_type", "type", "type_"] + + 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) -> PropertyNameCollision: + """Create an instance of PropertyNameCollision 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) -> PropertyNameCollision: + """Create an instance of PropertyNameCollision from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return PropertyNameCollision.parse_obj(obj) + + _obj = PropertyNameCollision.parse_obj({ + "type": obj.get("_type"), + "type": obj.get("type"), + "type_": obj.get("type_") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/read_only_first.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/read_only_first.py new file mode 100644 index 00000000000..da66589ee79 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/read_only_first.py @@ -0,0 +1,74 @@ +# 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 Optional +from pydantic import BaseModel, StrictStr + +class ReadOnlyFirst(BaseModel): + """ + ReadOnlyFirst + """ + bar: Optional[StrictStr] = None + baz: Optional[StrictStr] = None + __properties = ["bar", "baz"] + + 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) -> ReadOnlyFirst: + """Create an instance of ReadOnlyFirst 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={ + "bar", + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> ReadOnlyFirst: + """Create an instance of ReadOnlyFirst from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ReadOnlyFirst.parse_obj(obj) + + _obj = ReadOnlyFirst.parse_obj({ + "bar": obj.get("bar"), + "baz": obj.get("baz") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/second_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/second_ref.py new file mode 100644 index 00000000000..0c4f70eb939 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/second_ref.py @@ -0,0 +1,78 @@ +# 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 Optional +from pydantic import BaseModel, StrictStr + +class SecondRef(BaseModel): + """ + SecondRef + """ + category: Optional[StrictStr] = None + circular_ref: Optional[CircularReferenceModel] = None + __properties = ["category", "circular_ref"] + + 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) -> SecondRef: + """Create an instance of SecondRef 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 circular_ref + if self.circular_ref: + _dict['circular_ref'] = self.circular_ref.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> SecondRef: + """Create an instance of SecondRef from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return SecondRef.parse_obj(obj) + + _obj = SecondRef.parse_obj({ + "category": obj.get("category"), + "circular_ref": CircularReferenceModel.from_dict(obj.get("circular_ref")) if obj.get("circular_ref") is not None else None + }) + return _obj + +from petstore_api.models.circular_reference_model import CircularReferenceModel +SecondRef.update_forward_refs() + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/self_reference_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/self_reference_model.py new file mode 100644 index 00000000000..f7470db995e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/self_reference_model.py @@ -0,0 +1,78 @@ +# 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 Optional +from pydantic import BaseModel, StrictInt + +class SelfReferenceModel(BaseModel): + """ + SelfReferenceModel + """ + size: Optional[StrictInt] = None + nested: Optional[DummyModel] = None + __properties = ["size", "nested"] + + 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) -> SelfReferenceModel: + """Create an instance of SelfReferenceModel 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 nested + if self.nested: + _dict['nested'] = self.nested.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> SelfReferenceModel: + """Create an instance of SelfReferenceModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return SelfReferenceModel.parse_obj(obj) + + _obj = SelfReferenceModel.parse_obj({ + "size": obj.get("size"), + "nested": DummyModel.from_dict(obj.get("nested")) if obj.get("nested") is not None else None + }) + return _obj + +from petstore_api.models.dummy_model import DummyModel +SelfReferenceModel.update_forward_refs() + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/single_ref_type.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/single_ref_type.py new file mode 100644 index 00000000000..7edec4bb32c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/single_ref_type.py @@ -0,0 +1,40 @@ +# 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 json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class SingleRefType(str, Enum): + """ + SingleRefType + """ + + """ + allowed enum values + """ + ADMIN = 'admin' + USER = 'user' + + @classmethod + def from_json(cls, json_str: str) -> SingleRefType: + """Create an instance of SingleRefType from a JSON string""" + return SingleRefType(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_character_enum.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_character_enum.py new file mode 100644 index 00000000000..14b8a7e3fd6 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_character_enum.py @@ -0,0 +1,48 @@ +# 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 json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class SpecialCharacterEnum(str, Enum): + """ + SpecialCharacterEnum + """ + + """ + allowed enum values + """ + ENUM_456 = '456' + ENUM_123ABC = '123abc' + UNDERSCORE = '_' + SPACE = ' ' + AMPERSAND = '&' + DOLLAR = '$' + GREATER_THAN_EQUAL = '>=' + THIS_IS_EXCLAMATION = 'this_is_!' + IMPORT = 'import' + HELLO_WORLD = ' hello world ' + + @classmethod + def from_json(cls, json_str: str) -> SpecialCharacterEnum: + """Create an instance of SpecialCharacterEnum from a JSON string""" + return SpecialCharacterEnum(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_model_name.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_model_name.py new file mode 100644 index 00000000000..43e57ff7b7b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_model_name.py @@ -0,0 +1,71 @@ +# 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 Optional +from pydantic import BaseModel, Field, StrictInt + +class SpecialModelName(BaseModel): + """ + SpecialModelName + """ + special_property_name: Optional[StrictInt] = Field(None, alias="$special[property.name]") + __properties = ["$special[property.name]"] + + 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) -> SpecialModelName: + """Create an instance of SpecialModelName 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) -> SpecialModelName: + """Create an instance of SpecialModelName from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return SpecialModelName.parse_obj(obj) + + _obj = SpecialModelName.parse_obj({ + "special_property_name": obj.get("$special[property.name]") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_name.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_name.py new file mode 100644 index 00000000000..f8841f7a4cc --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/special_name.py @@ -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 Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr, validator +from petstore_api.models.category import Category + +class SpecialName(BaseModel): + """ + SpecialName + """ + var_property: Optional[StrictInt] = Field(None, alias="property") + var_async: Optional[Category] = Field(None, alias="async") + var_schema: Optional[StrictStr] = Field(None, alias="schema", description="pet status in the store") + __properties = ["property", "async", "schema"] + + @validator('var_schema') + def var_schema_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('available', 'pending', 'sold'): + raise ValueError("must be one of enum values ('available', 'pending', 'sold')") + 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) -> SpecialName: + """Create an instance of SpecialName 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 var_async + if self.var_async: + _dict['async'] = self.var_async.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> SpecialName: + """Create an instance of SpecialName from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return SpecialName.parse_obj(obj) + + _obj = SpecialName.parse_obj({ + "var_property": obj.get("property"), + "var_async": Category.from_dict(obj.get("async")) if obj.get("async") is not None else None, + "var_schema": obj.get("schema") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/tag.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/tag.py new file mode 100644 index 00000000000..45605d23933 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/tag.py @@ -0,0 +1,73 @@ +# 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 Optional +from pydantic import BaseModel, StrictInt, StrictStr + +class Tag(BaseModel): + """ + Tag + """ + id: Optional[StrictInt] = None + name: Optional[StrictStr] = None + __properties = ["id", "name"] + + 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) -> Tag: + """Create an instance of Tag 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) -> Tag: + """Create an instance of Tag from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Tag.parse_obj(obj) + + _obj = Tag.parse_obj({ + "id": obj.get("id"), + "name": obj.get("name") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/test_inline_freeform_additional_properties_request.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/test_inline_freeform_additional_properties_request.py new file mode 100644 index 00000000000..a77233c5677 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/test_inline_freeform_additional_properties_request.py @@ -0,0 +1,83 @@ +# 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 Optional +from pydantic import BaseModel, Field, StrictStr + +class TestInlineFreeformAdditionalPropertiesRequest(BaseModel): + """ + TestInlineFreeformAdditionalPropertiesRequest + """ + some_property: Optional[StrictStr] = Field(None, alias="someProperty") + additional_properties: Dict[str, Any] = {} + __properties = ["someProperty"] + + 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) -> TestInlineFreeformAdditionalPropertiesRequest: + """Create an instance of TestInlineFreeformAdditionalPropertiesRequest 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) -> TestInlineFreeformAdditionalPropertiesRequest: + """Create an instance of TestInlineFreeformAdditionalPropertiesRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return TestInlineFreeformAdditionalPropertiesRequest.parse_obj(obj) + + _obj = TestInlineFreeformAdditionalPropertiesRequest.parse_obj({ + "some_property": obj.get("someProperty") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/tiger.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/tiger.py new file mode 100644 index 00000000000..88b2f3c6a04 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/tiger.py @@ -0,0 +1,71 @@ +# 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 Optional +from pydantic import BaseModel, StrictStr + +class Tiger(BaseModel): + """ + Tiger + """ + skill: Optional[StrictStr] = None + __properties = ["skill"] + + 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) -> Tiger: + """Create an instance of Tiger 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) -> Tiger: + """Create an instance of Tiger from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Tiger.parse_obj(obj) + + _obj = Tiger.parse_obj({ + "skill": obj.get("skill") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/user.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/user.py new file mode 100644 index 00000000000..5c09a897c70 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/user.py @@ -0,0 +1,85 @@ +# 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 Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr + +class User(BaseModel): + """ + User + """ + id: Optional[StrictInt] = None + username: Optional[StrictStr] = None + first_name: Optional[StrictStr] = Field(None, alias="firstName") + last_name: Optional[StrictStr] = Field(None, alias="lastName") + email: Optional[StrictStr] = None + password: Optional[StrictStr] = None + phone: Optional[StrictStr] = None + user_status: Optional[StrictInt] = Field(None, alias="userStatus", description="User Status") + __properties = ["id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus"] + + 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) -> User: + """Create an instance of User 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) -> User: + """Create an instance of User from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return User.parse_obj(obj) + + _obj = User.parse_obj({ + "id": obj.get("id"), + "username": obj.get("username"), + "first_name": obj.get("firstName"), + "last_name": obj.get("lastName"), + "email": obj.get("email"), + "password": obj.get("password"), + "phone": obj.get("phone"), + "user_status": obj.get("userStatus") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/with_nested_one_of.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/with_nested_one_of.py new file mode 100644 index 00000000000..0268402b5f4 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/with_nested_one_of.py @@ -0,0 +1,83 @@ +# 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 Optional +from pydantic import BaseModel, StrictInt +from petstore_api.models.one_of_enum_string import OneOfEnumString +from petstore_api.models.pig import Pig + +class WithNestedOneOf(BaseModel): + """ + WithNestedOneOf + """ + size: Optional[StrictInt] = None + nested_pig: Optional[Pig] = None + nested_oneof_enum_string: Optional[OneOfEnumString] = None + __properties = ["size", "nested_pig", "nested_oneof_enum_string"] + + 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) -> WithNestedOneOf: + """Create an instance of WithNestedOneOf 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 nested_pig + if self.nested_pig: + _dict['nested_pig'] = self.nested_pig.to_dict() + # override the default output from pydantic by calling `to_dict()` of nested_oneof_enum_string + if self.nested_oneof_enum_string: + _dict['nested_oneof_enum_string'] = self.nested_oneof_enum_string.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> WithNestedOneOf: + """Create an instance of WithNestedOneOf from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return WithNestedOneOf.parse_obj(obj) + + _obj = WithNestedOneOf.parse_obj({ + "size": obj.get("size"), + "nested_pig": Pig.from_dict(obj.get("nested_pig")) if obj.get("nested_pig") is not None else None, + "nested_oneof_enum_string": OneOfEnumString.from_dict(obj.get("nested_oneof_enum_string")) if obj.get("nested_oneof_enum_string") is not None else None + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/py.typed b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/py.typed new file mode 100644 index 00000000000..e69de29bb2d diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/rest.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/rest.py new file mode 100644 index 00000000000..7daf8c921c8 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/rest.py @@ -0,0 +1,251 @@ +# 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 io +import json +import logging +import re +import ssl + +import aiohttp +from urllib.parse import urlencode, quote_plus + +from petstore_api.exceptions import ApiException, ApiValueError + +logger = logging.getLogger(__name__) + + +class RESTResponse(io.IOBase): + + def __init__(self, resp, data) -> None: + self.aiohttp_response = resp + self.status = resp.status + self.reason = resp.reason + self.data = data + + def getheaders(self): + """Returns a CIMultiDictProxy of the response headers.""" + return self.aiohttp_response.headers + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.aiohttp_response.headers.get(name, default) + + +class RESTClientObject: + + def __init__(self, configuration, pools_size=4, maxsize=None) -> None: + + # maxsize is number of requests to host that are allowed in parallel + if maxsize is None: + maxsize = configuration.connection_pool_maxsize + + ssl_context = ssl.create_default_context(cafile=configuration.ssl_ca_cert) + if configuration.cert_file: + ssl_context.load_cert_chain( + configuration.cert_file, keyfile=configuration.key_file + ) + + if not configuration.verify_ssl: + ssl_context.check_hostname = False + ssl_context.verify_mode = ssl.CERT_NONE + + connector = aiohttp.TCPConnector( + limit=maxsize, + ssl=ssl_context + ) + + self.proxy = configuration.proxy + self.proxy_headers = configuration.proxy_headers + + # https pool manager + self.pool_manager = aiohttp.ClientSession( + connector=connector, + trust_env=True + ) + + async def close(self): + await self.pool_manager.close() + + async def request(self, method, url, query_params=None, headers=None, + body=None, post_params=None, _preload_content=True, + _request_timeout=None): + """Execute request + + :param method: http request method + :param url: http request url + :param query_params: query parameters in the url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :param _preload_content: this is a non-applicable field for + the AiohttpClient. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + """ + method = method.upper() + assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', + 'PATCH', 'OPTIONS'] + + if post_params and body: + raise ApiValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + # url already contains the URL query string + # so reset query_params to empty dict + query_params = {} + timeout = _request_timeout or 5 * 60 + + if 'Content-Type' not in headers: + headers['Content-Type'] = 'application/json' + + args = { + "method": method, + "url": url, + "timeout": timeout, + "headers": headers + } + + if self.proxy: + args["proxy"] = self.proxy + if self.proxy_headers: + args["proxy_headers"] = self.proxy_headers + + if query_params: + args["url"] += '?' + urlencode(query_params) + + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + if re.search('json', headers['Content-Type'], re.IGNORECASE): + if body is not None: + body = json.dumps(body) + args["data"] = body + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + args["data"] = aiohttp.FormData(post_params) + elif headers['Content-Type'] == 'multipart/form-data': + # must del headers['Content-Type'], or the correct + # Content-Type which generated by aiohttp + del headers['Content-Type'] + data = aiohttp.FormData() + for param in post_params: + k, v = param + if isinstance(v, tuple) and len(v) == 3: + data.add_field(k, + value=v[1], + filename=v[0], + content_type=v[2]) + else: + data.add_field(k, v) + args["data"] = data + + # Pass a `bytes` parameter directly in the body to support + # other content types than Json when `body` argument is provided + # in serialized form + elif isinstance(body, bytes): + args["data"] = body + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + + r = await self.pool_manager.request(**args) + if _preload_content: + + data = await r.read() + r = RESTResponse(r, data) + + # log response body + logger.debug("response body: %s", r.data) + + if not 200 <= r.status <= 299: + raise ApiException(http_resp=r) + + return r + + async def get_request(self, url, headers=None, query_params=None, + _preload_content=True, _request_timeout=None): + return (await self.request("GET", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params)) + + async def head_request(self, url, headers=None, query_params=None, + _preload_content=True, _request_timeout=None): + return (await self.request("HEAD", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params)) + + async def options_request(self, url, headers=None, query_params=None, + post_params=None, body=None, _preload_content=True, + _request_timeout=None): + return (await self.request("OPTIONS", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body)) + + async def delete_request(self, url, headers=None, query_params=None, body=None, + _preload_content=True, _request_timeout=None): + return (await self.request("DELETE", url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body)) + + async def post_request(self, url, headers=None, query_params=None, + post_params=None, body=None, _preload_content=True, + _request_timeout=None): + return (await self.request("POST", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body)) + + async def put_request(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return (await self.request("PUT", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body)) + + async def patch_request(self, url, headers=None, query_params=None, + post_params=None, body=None, _preload_content=True, + _request_timeout=None): + return (await self.request("PATCH", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body)) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/signing.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/signing.py new file mode 100644 index 00000000000..ec4d7d2a67f --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/signing.py @@ -0,0 +1,413 @@ +""" + 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 base64 import b64encode +from Crypto.IO import PEM, PKCS8 +from Crypto.Hash import SHA256, SHA512 +from Crypto.PublicKey import RSA, ECC +from Crypto.Signature import PKCS1_v1_5, pss, DSS +from email.utils import formatdate +import json +import os +import re +from time import time +from urllib.parse import urlencode, urlparse + +# The constants below define a subset of HTTP headers that can be included in the +# HTTP signature scheme. Additional headers may be included in the signature. + +# The '(request-target)' header is a calculated field that includes the HTTP verb, +# the URL path and the URL query. +HEADER_REQUEST_TARGET = '(request-target)' +# The time when the HTTP signature was generated. +HEADER_CREATED = '(created)' +# The time when the HTTP signature expires. The API server should reject HTTP requests +# that have expired. +HEADER_EXPIRES = '(expires)' +# The 'Host' header. +HEADER_HOST = 'Host' +# The 'Date' header. +HEADER_DATE = 'Date' +# When the 'Digest' header is included in the HTTP signature, the client automatically +# computes the digest of the HTTP request body, per RFC 3230. +HEADER_DIGEST = 'Digest' +# The 'Authorization' header is automatically generated by the client. It includes +# the list of signed headers and a base64-encoded signature. +HEADER_AUTHORIZATION = 'Authorization' + +# The constants below define the cryptographic schemes for the HTTP signature scheme. +SCHEME_HS2019 = 'hs2019' +SCHEME_RSA_SHA256 = 'rsa-sha256' +SCHEME_RSA_SHA512 = 'rsa-sha512' + +# The constants below define the signature algorithms that can be used for the HTTP +# signature scheme. +ALGORITHM_RSASSA_PSS = 'RSASSA-PSS' +ALGORITHM_RSASSA_PKCS1v15 = 'RSASSA-PKCS1-v1_5' + +ALGORITHM_ECDSA_MODE_FIPS_186_3 = 'fips-186-3' +ALGORITHM_ECDSA_MODE_DETERMINISTIC_RFC6979 = 'deterministic-rfc6979' +ALGORITHM_ECDSA_KEY_SIGNING_ALGORITHMS = { + ALGORITHM_ECDSA_MODE_FIPS_186_3, + ALGORITHM_ECDSA_MODE_DETERMINISTIC_RFC6979 +} + +# The cryptographic hash algorithm for the message signature. +HASH_SHA256 = 'sha256' +HASH_SHA512 = 'sha512' + + +class HttpSigningConfiguration: + """The configuration parameters for the HTTP signature security scheme. + The HTTP signature security scheme is used to sign HTTP requests with a private key + which is in possession of the API client. + An 'Authorization' header is calculated by creating a hash of select headers, + and optionally the body of the HTTP request, then signing the hash value using + a private key. The 'Authorization' header is added to outbound HTTP requests. + + :param key_id: A string value specifying the identifier of the cryptographic key, + when signing HTTP requests. + :param signing_scheme: A string value specifying the signature scheme, when + signing HTTP requests. + Supported value are hs2019, rsa-sha256, rsa-sha512. + Avoid using rsa-sha256, rsa-sha512 as they are deprecated. These values are + available for server-side applications that only support the older + HTTP signature algorithms. + :param private_key_path: A string value specifying the path of the file containing + a private key. The private key is used to sign HTTP requests. + :param private_key_passphrase: A string value specifying the passphrase to decrypt + the private key. + :param signed_headers: A list of strings. Each value is the name of a HTTP header + that must be included in the HTTP signature calculation. + The two special signature headers '(request-target)' and '(created)' SHOULD be + included in SignedHeaders. + The '(created)' header expresses when the signature was created. + The '(request-target)' header is a concatenation of the lowercased :method, an + ASCII space, and the :path pseudo-headers. + When signed_headers is not specified, the client defaults to a single value, + '(created)', in the list of HTTP headers. + When SignedHeaders contains the 'Digest' value, the client performs the + following operations: + 1. Calculate a digest of request body, as specified in RFC3230, section 4.3.2. + 2. Set the 'Digest' header in the request body. + 3. Include the 'Digest' header and value in the HTTP signature. + :param signing_algorithm: A string value specifying the signature algorithm, when + signing HTTP requests. + Supported values are: + 1. For RSA keys: RSASSA-PSS, RSASSA-PKCS1-v1_5. + 2. For ECDSA keys: fips-186-3, deterministic-rfc6979. + If None, the signing algorithm is inferred from the private key. + The default signing algorithm for RSA keys is RSASSA-PSS. + The default signing algorithm for ECDSA keys is fips-186-3. + :param hash_algorithm: The hash algorithm for the signature. Supported values are + sha256 and sha512. + If the signing_scheme is rsa-sha256, the hash algorithm must be set + to None or sha256. + If the signing_scheme is rsa-sha512, the hash algorithm must be set + to None or sha512. + :param signature_max_validity: The signature max validity, expressed as + a datetime.timedelta value. It must be a positive value. + """ + def __init__(self, key_id, signing_scheme, private_key_path, + private_key_passphrase=None, + signed_headers=None, + signing_algorithm=None, + hash_algorithm=None, + signature_max_validity=None) -> None: + self.key_id = key_id + if signing_scheme not in {SCHEME_HS2019, SCHEME_RSA_SHA256, SCHEME_RSA_SHA512}: + raise Exception("Unsupported security scheme: {0}".format(signing_scheme)) + self.signing_scheme = signing_scheme + if not os.path.exists(private_key_path): + raise Exception("Private key file does not exist") + self.private_key_path = private_key_path + self.private_key_passphrase = private_key_passphrase + self.signing_algorithm = signing_algorithm + self.hash_algorithm = hash_algorithm + if signing_scheme == SCHEME_RSA_SHA256: + if self.hash_algorithm is None: + self.hash_algorithm = HASH_SHA256 + elif self.hash_algorithm != HASH_SHA256: + raise Exception("Hash algorithm must be sha256 when security scheme is %s" % + SCHEME_RSA_SHA256) + elif signing_scheme == SCHEME_RSA_SHA512: + if self.hash_algorithm is None: + self.hash_algorithm = HASH_SHA512 + elif self.hash_algorithm != HASH_SHA512: + raise Exception("Hash algorithm must be sha512 when security scheme is %s" % + SCHEME_RSA_SHA512) + elif signing_scheme == SCHEME_HS2019: + if self.hash_algorithm is None: + self.hash_algorithm = HASH_SHA256 + elif self.hash_algorithm not in {HASH_SHA256, HASH_SHA512}: + raise Exception("Invalid hash algorithm") + if signature_max_validity is not None and signature_max_validity.total_seconds() < 0: + raise Exception("The signature max validity must be a positive value") + self.signature_max_validity = signature_max_validity + # If the user has not provided any signed_headers, the default must be set to '(created)', + # as specified in the 'HTTP signature' standard. + if signed_headers is None or len(signed_headers) == 0: + signed_headers = [HEADER_CREATED] + if self.signature_max_validity is None and HEADER_EXPIRES in signed_headers: + raise Exception( + "Signature max validity must be set when " + "'(expires)' signature parameter is specified") + if len(signed_headers) != len(set(signed_headers)): + raise Exception("Cannot have duplicates in the signed_headers parameter") + if HEADER_AUTHORIZATION in signed_headers: + raise Exception("'Authorization' header cannot be included in signed headers") + self.signed_headers = signed_headers + self.private_key = None + """The private key used to sign HTTP requests. + Initialized when the PEM-encoded private key is loaded from a file. + """ + self.host = None + """The host name, optionally followed by a colon and TCP port number. + """ + self._load_private_key() + + def get_http_signature_headers(self, resource_path, method, headers, body, query_params): + """Create a cryptographic message signature for the HTTP request and add the signed headers. + + :param resource_path : A string representation of the HTTP request resource path. + :param method: A string representation of the HTTP request method, e.g. GET, POST. + :param headers: A dict containing the HTTP request headers. + :param body: The object representing the HTTP request body. + :param query_params: A string representing the HTTP request query parameters. + :return: A dict of HTTP headers that must be added to the outbound HTTP request. + """ + if method is None: + raise Exception("HTTP method must be set") + if resource_path is None: + raise Exception("Resource path must be set") + + signed_headers_list, request_headers_dict = self._get_signed_header_info( + resource_path, method, headers, body, query_params) + + header_items = [ + "{0}: {1}".format(key.lower(), value) for key, value in signed_headers_list] + string_to_sign = "\n".join(header_items) + + digest, digest_prefix = self._get_message_digest(string_to_sign.encode()) + b64_signed_msg = self._sign_digest(digest) + + request_headers_dict[HEADER_AUTHORIZATION] = self._get_authorization_header( + signed_headers_list, b64_signed_msg) + + return request_headers_dict + + def get_public_key(self): + """Returns the public key object associated with the private key. + """ + pubkey = None + if isinstance(self.private_key, RSA.RsaKey): + pubkey = self.private_key.publickey() + elif isinstance(self.private_key, ECC.EccKey): + pubkey = self.private_key.public_key() + return pubkey + + def _load_private_key(self): + """Load the private key used to sign HTTP requests. + The private key is used to sign HTTP requests as defined in + https://datatracker.ietf.org/doc/draft-cavage-http-signatures/. + """ + if self.private_key is not None: + return + with open(self.private_key_path, 'r') as f: + pem_data = f.read() + # Verify PEM Pre-Encapsulation Boundary + r = re.compile(r"\s*-----BEGIN (.*)-----\s+") + m = r.match(pem_data) + if not m: + raise ValueError("Not a valid PEM pre boundary") + pem_header = m.group(1) + if pem_header == 'RSA PRIVATE KEY': + self.private_key = RSA.importKey(pem_data, self.private_key_passphrase) + elif pem_header == 'EC PRIVATE KEY': + self.private_key = ECC.import_key(pem_data, self.private_key_passphrase) + elif pem_header in {'PRIVATE KEY', 'ENCRYPTED PRIVATE KEY'}: + # Key is in PKCS8 format, which is capable of holding many different + # types of private keys, not just EC keys. + (key_binary, pem_header, is_encrypted) = \ + PEM.decode(pem_data, self.private_key_passphrase) + (oid, privkey, params) = \ + PKCS8.unwrap(key_binary, passphrase=self.private_key_passphrase) + if oid == '1.2.840.10045.2.1': + self.private_key = ECC.import_key(pem_data, self.private_key_passphrase) + else: + raise Exception("Unsupported key: {0}. OID: {1}".format(pem_header, oid)) + else: + raise Exception("Unsupported key: {0}".format(pem_header)) + # Validate the specified signature algorithm is compatible with the private key. + if self.signing_algorithm is not None: + supported_algs = None + if isinstance(self.private_key, RSA.RsaKey): + supported_algs = {ALGORITHM_RSASSA_PSS, ALGORITHM_RSASSA_PKCS1v15} + elif isinstance(self.private_key, ECC.EccKey): + supported_algs = ALGORITHM_ECDSA_KEY_SIGNING_ALGORITHMS + if supported_algs is not None and self.signing_algorithm not in supported_algs: + raise Exception( + "Signing algorithm {0} is not compatible with private key".format( + self.signing_algorithm)) + + def _get_signed_header_info(self, resource_path, method, headers, body, query_params): + """Build the HTTP headers (name, value) that need to be included in + the HTTP signature scheme. + + :param resource_path : A string representation of the HTTP request resource path. + :param method: A string representation of the HTTP request method, e.g. GET, POST. + :param headers: A dict containing the HTTP request headers. + :param body: The object (e.g. a dict) representing the HTTP request body. + :param query_params: A string representing the HTTP request query parameters. + :return: A tuple containing two dict objects: + The first dict contains the HTTP headers that are used to calculate + the HTTP signature. + The second dict contains the HTTP headers that must be added to + the outbound HTTP request. + """ + + if body is None: + body = '' + else: + body = body.to_json() + + # Build the '(request-target)' HTTP signature parameter. + target_host = urlparse(self.host).netloc + target_path = urlparse(self.host).path + request_target = method.lower() + " " + target_path + resource_path + if query_params: + request_target += "?" + urlencode(query_params) + + # Get UNIX time, e.g. seconds since epoch, not including leap seconds. + now = time() + # Format date per RFC 7231 section-7.1.1.2. An example is: + # Date: Wed, 21 Oct 2015 07:28:00 GMT + cdate = formatdate(timeval=now, localtime=False, usegmt=True) + # The '(created)' value MUST be a Unix timestamp integer value. + # Subsecond precision is not supported. + created = int(now) + if self.signature_max_validity is not None: + expires = now + self.signature_max_validity.total_seconds() + + signed_headers_list = [] + request_headers_dict = {} + for hdr_key in self.signed_headers: + hdr_key = hdr_key.lower() + if hdr_key == HEADER_REQUEST_TARGET: + value = request_target + elif hdr_key == HEADER_CREATED: + value = '{0}'.format(created) + elif hdr_key == HEADER_EXPIRES: + value = '{0}'.format(expires) + elif hdr_key == HEADER_DATE.lower(): + value = cdate + request_headers_dict[HEADER_DATE] = '{0}'.format(cdate) + elif hdr_key == HEADER_DIGEST.lower(): + request_body = body.encode() + body_digest, digest_prefix = self._get_message_digest(request_body) + b64_body_digest = b64encode(body_digest.digest()) + value = digest_prefix + b64_body_digest.decode('ascii') + request_headers_dict[HEADER_DIGEST] = '{0}{1}'.format( + digest_prefix, b64_body_digest.decode('ascii')) + elif hdr_key == HEADER_HOST.lower(): + value = target_host + request_headers_dict[HEADER_HOST] = '{0}'.format(target_host) + else: + value = next((v for k, v in headers.items() if k.lower() == hdr_key), None) + if value is None: + raise Exception( + "Cannot sign HTTP request. " + "Request does not contain the '{0}' header".format(hdr_key)) + signed_headers_list.append((hdr_key, value)) + + return signed_headers_list, request_headers_dict + + def _get_message_digest(self, data): + """Calculates and returns a cryptographic digest of a specified HTTP request. + + :param data: The string representation of the date to be hashed with a cryptographic hash. + :return: A tuple of (digest, prefix). + The digest is a hashing object that contains the cryptographic digest of + the HTTP request. + The prefix is a string that identifies the cryptographic hash. It is used + to generate the 'Digest' header as specified in RFC 3230. + """ + if self.hash_algorithm == HASH_SHA512: + digest = SHA512.new() + prefix = 'SHA-512=' + elif self.hash_algorithm == HASH_SHA256: + digest = SHA256.new() + prefix = 'SHA-256=' + else: + raise Exception("Unsupported hash algorithm: {0}".format(self.hash_algorithm)) + digest.update(data) + return digest, prefix + + def _sign_digest(self, digest): + """Signs a message digest with a private key specified in the signing_info. + + :param digest: A hashing object that contains the cryptographic digest of the HTTP request. + :return: A base-64 string representing the cryptographic signature of the input digest. + """ + sig_alg = self.signing_algorithm + if isinstance(self.private_key, RSA.RsaKey): + if sig_alg is None or sig_alg == ALGORITHM_RSASSA_PSS: + # RSASSA-PSS in Section 8.1 of RFC8017. + signature = pss.new(self.private_key).sign(digest) + elif sig_alg == ALGORITHM_RSASSA_PKCS1v15: + # RSASSA-PKCS1-v1_5 in Section 8.2 of RFC8017. + signature = PKCS1_v1_5.new(self.private_key).sign(digest) + else: + raise Exception("Unsupported signature algorithm: {0}".format(sig_alg)) + elif isinstance(self.private_key, ECC.EccKey): + if sig_alg is None: + sig_alg = ALGORITHM_ECDSA_MODE_FIPS_186_3 + if sig_alg in ALGORITHM_ECDSA_KEY_SIGNING_ALGORITHMS: + # draft-ietf-httpbis-message-signatures-00 does not specify the ECDSA encoding. + # Issue: https://github.com/w3c-ccg/http-signatures/issues/107 + signature = DSS.new(key=self.private_key, mode=sig_alg, + encoding='der').sign(digest) + else: + raise Exception("Unsupported signature algorithm: {0}".format(sig_alg)) + else: + raise Exception("Unsupported private key: {0}".format(type(self.private_key))) + return b64encode(signature) + + def _get_authorization_header(self, signed_headers, signed_msg): + """Calculates and returns the value of the 'Authorization' header when signing HTTP requests. + + :param signed_headers : A list of tuples. Each value is the name of a HTTP header that + must be included in the HTTP signature calculation. + :param signed_msg: A base-64 encoded string representation of the signature. + :return: The string value of the 'Authorization' header, representing the signature + of the HTTP request. + """ + created_ts = None + expires_ts = None + for k, v in signed_headers: + if k == HEADER_CREATED: + created_ts = v + elif k == HEADER_EXPIRES: + expires_ts = v + lower_keys = [k.lower() for k, v in signed_headers] + headers_value = " ".join(lower_keys) + + auth_str = "Signature keyId=\"{0}\",algorithm=\"{1}\",".format( + self.key_id, self.signing_scheme) + if created_ts is not None: + auth_str = auth_str + "created={0},".format(created_ts) + if expires_ts is not None: + auth_str = auth_str + "expires={0},".format(expires_ts) + auth_str = auth_str + "headers=\"{0}\",signature=\"{1}\"".format( + headers_value, signed_msg.decode('ascii')) + + return auth_str diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/pyproject.toml b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/pyproject.toml new file mode 100644 index 00000000000..8c0a993b36f --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/pyproject.toml @@ -0,0 +1,33 @@ +[tool.poetry] +name = "petstore_api" +version = "1.0.0" +description = "OpenAPI Petstore" +authors = ["OpenAPI Generator Community "] +license = "Apache-2.0" +readme = "README.md" +repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID" +keywords = ["OpenAPI", "OpenAPI-Generator", "OpenAPI Petstore"] +include = ["petstore_api/py.typed"] + +[tool.poetry.dependencies] +python = "^3.7" + +urllib3 = ">= 1.25.3" +python-dateutil = ">=2.8.2" +aiohttp = ">= 3.8.4" +pem = ">= 19.3.0" +pycryptodome = ">= 3.9.0" +pydantic = "^1.10.5, <2" +aenum = ">=3.1.11" + +[tool.poetry.dev-dependencies] +pytest = ">=7.2.1" +tox = ">=3.9.0" +flake8 = ">=4.0.0" + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[tool.pylint.'MESSAGES CONTROL'] +extension-pkg-whitelist = "pydantic" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/requirements.txt b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/requirements.txt new file mode 100644 index 00000000000..bd242be2a0f --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/requirements.txt @@ -0,0 +1,7 @@ +python_dateutil >= 2.5.3 +setuptools >= 21.0.0 +urllib3 >= 1.25.3, < 2.1.0 +pydantic >= 1.10.5, < 2 +aenum >= 3.1.11 +aiohttp >= 3.0.0 +pycryptodome >= 3.9.0 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/setup.cfg b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/setup.cfg new file mode 100644 index 00000000000..11433ee875a --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/setup.cfg @@ -0,0 +1,2 @@ +[flake8] +max-line-length=99 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/setup.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/setup.py new file mode 100644 index 00000000000..e5b090da62b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/setup.py @@ -0,0 +1,53 @@ +# 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 setuptools import setup, find_packages # noqa: H301 + +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools +NAME = "petstore-api" +VERSION = "1.0.0" +PYTHON_REQUIRES = ">=3.7" +REQUIRES = [ + "urllib3 >= 1.25.3, < 2.1.0", + "python-dateutil", + "aiohttp >= 3.0.0", + "pem>=19.3.0", + "pycryptodome>=3.9.0", + "pydantic >= 1.10.5, < 2", + "aenum" +] + +setup( + name=NAME, + version=VERSION, + description="OpenAPI Petstore", + author="OpenAPI Generator community", + author_email="team@openapitools.org", + url="", + keywords=["OpenAPI", "OpenAPI-Generator", "OpenAPI Petstore"], + install_requires=REQUIRES, + packages=find_packages(exclude=["test", "tests"]), + include_package_data=True, + license="Apache-2.0", + long_description_content_type='text/markdown', + long_description="""\ + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + """, # noqa: E501 + package_data={"petstore_api": ["py.typed"]}, +) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test-requirements.txt b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test-requirements.txt new file mode 100644 index 00000000000..3a0d0b939a1 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test-requirements.txt @@ -0,0 +1,3 @@ +pytest~=7.1.3 +pytest-cov>=2.8.1 +pytest-randomly>=3.12.0 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_any_type.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_any_type.py new file mode 100644 index 00000000000..a1669f0664d --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_any_type.py @@ -0,0 +1,52 @@ +# 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.additional_properties_any_type import AdditionalPropertiesAnyType # noqa: E501 + +class TestAdditionalPropertiesAnyType(unittest.TestCase): + """AdditionalPropertiesAnyType unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AdditionalPropertiesAnyType: + """Test AdditionalPropertiesAnyType + 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 `AdditionalPropertiesAnyType` + """ + model = AdditionalPropertiesAnyType() # noqa: E501 + if include_optional: + return AdditionalPropertiesAnyType( + name = '' + ) + else: + return AdditionalPropertiesAnyType( + ) + """ + + def testAdditionalPropertiesAnyType(self): + """Test AdditionalPropertiesAnyType""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_class.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_class.py new file mode 100644 index 00000000000..d1dc12c4458 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_class.py @@ -0,0 +1,59 @@ +# 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.additional_properties_class import AdditionalPropertiesClass # noqa: E501 + +class TestAdditionalPropertiesClass(unittest.TestCase): + """AdditionalPropertiesClass unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AdditionalPropertiesClass: + """Test AdditionalPropertiesClass + 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 `AdditionalPropertiesClass` + """ + model = AdditionalPropertiesClass() # noqa: E501 + if include_optional: + return AdditionalPropertiesClass( + map_property = { + 'key' : '' + }, + map_of_map_property = { + 'key' : { + 'key' : '' + } + } + ) + else: + return AdditionalPropertiesClass( + ) + """ + + def testAdditionalPropertiesClass(self): + """Test AdditionalPropertiesClass""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_object.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_object.py new file mode 100644 index 00000000000..9bfa2a0cde8 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_object.py @@ -0,0 +1,52 @@ +# 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.additional_properties_object import AdditionalPropertiesObject # noqa: E501 + +class TestAdditionalPropertiesObject(unittest.TestCase): + """AdditionalPropertiesObject unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AdditionalPropertiesObject: + """Test AdditionalPropertiesObject + 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 `AdditionalPropertiesObject` + """ + model = AdditionalPropertiesObject() # noqa: E501 + if include_optional: + return AdditionalPropertiesObject( + name = '' + ) + else: + return AdditionalPropertiesObject( + ) + """ + + def testAdditionalPropertiesObject(self): + """Test AdditionalPropertiesObject""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_with_description_only.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_with_description_only.py new file mode 100644 index 00000000000..88df1cc9295 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_additional_properties_with_description_only.py @@ -0,0 +1,52 @@ +# 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.additional_properties_with_description_only import AdditionalPropertiesWithDescriptionOnly # noqa: E501 + +class TestAdditionalPropertiesWithDescriptionOnly(unittest.TestCase): + """AdditionalPropertiesWithDescriptionOnly unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AdditionalPropertiesWithDescriptionOnly: + """Test AdditionalPropertiesWithDescriptionOnly + 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 `AdditionalPropertiesWithDescriptionOnly` + """ + model = AdditionalPropertiesWithDescriptionOnly() # noqa: E501 + if include_optional: + return AdditionalPropertiesWithDescriptionOnly( + name = '' + ) + else: + return AdditionalPropertiesWithDescriptionOnly( + ) + """ + + def testAdditionalPropertiesWithDescriptionOnly(self): + """Test AdditionalPropertiesWithDescriptionOnly""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_all_of_with_single_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_all_of_with_single_ref.py new file mode 100644 index 00000000000..920ad3782e1 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_all_of_with_single_ref.py @@ -0,0 +1,53 @@ +# 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.all_of_with_single_ref import AllOfWithSingleRef # noqa: E501 + +class TestAllOfWithSingleRef(unittest.TestCase): + """AllOfWithSingleRef unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AllOfWithSingleRef: + """Test AllOfWithSingleRef + 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 `AllOfWithSingleRef` + """ + model = AllOfWithSingleRef() # noqa: E501 + if include_optional: + return AllOfWithSingleRef( + username = '', + single_ref_type = 'admin' + ) + else: + return AllOfWithSingleRef( + ) + """ + + def testAllOfWithSingleRef(self): + """Test AllOfWithSingleRef""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_animal.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_animal.py new file mode 100644 index 00000000000..b0b62a0bb2b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_animal.py @@ -0,0 +1,54 @@ +# 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.animal import Animal # noqa: E501 + +class TestAnimal(unittest.TestCase): + """Animal unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Animal: + """Test Animal + 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 `Animal` + """ + model = Animal() # noqa: E501 + if include_optional: + return Animal( + class_name = '', + color = 'red' + ) + else: + return Animal( + class_name = '', + ) + """ + + def testAnimal(self): + """Test Animal""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_another_fake_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_another_fake_api.py new file mode 100644 index 00000000000..a6070f5b5f5 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_another_fake_api.py @@ -0,0 +1,38 @@ +# 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.api.another_fake_api import AnotherFakeApi # noqa: E501 + + +class TestAnotherFakeApi(unittest.TestCase): + """AnotherFakeApi unit test stubs""" + + def setUp(self) -> None: + self.api = AnotherFakeApi() # noqa: E501 + + def tearDown(self) -> None: + pass + + def test_call_123_test_special_tags(self) -> None: + """Test case for call_123_test_special_tags + + To test special tags # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_any_of_color.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_any_of_color.py new file mode 100644 index 00000000000..f99dfd0020b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_any_of_color.py @@ -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 +import datetime + +from petstore_api.models.any_of_color import AnyOfColor # noqa: E501 + +class TestAnyOfColor(unittest.TestCase): + """AnyOfColor unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AnyOfColor: + """Test AnyOfColor + 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 `AnyOfColor` + """ + model = AnyOfColor() # noqa: E501 + if include_optional: + return AnyOfColor( + ) + else: + return AnyOfColor( + ) + """ + + def testAnyOfColor(self): + """Test AnyOfColor""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_any_of_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_any_of_pig.py new file mode 100644 index 00000000000..c3e4760182c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_any_of_pig.py @@ -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.any_of_pig import AnyOfPig # noqa: E501 + +class TestAnyOfPig(unittest.TestCase): + """AnyOfPig unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AnyOfPig: + """Test AnyOfPig + 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 `AnyOfPig` + """ + model = AnyOfPig() # noqa: E501 + if include_optional: + return AnyOfPig( + class_name = '', + color = '', + size = 56 + ) + else: + return AnyOfPig( + class_name = '', + color = '', + size = 56, + ) + """ + + def testAnyOfPig(self): + """Test AnyOfPig""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_api_response.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_api_response.py new file mode 100644 index 00000000000..9882aa1b900 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_api_response.py @@ -0,0 +1,54 @@ +# 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.api_response import ApiResponse # noqa: E501 + +class TestApiResponse(unittest.TestCase): + """ApiResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ApiResponse: + """Test ApiResponse + 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 `ApiResponse` + """ + model = ApiResponse() # noqa: E501 + if include_optional: + return ApiResponse( + code = 56, + type = '', + message = '' + ) + else: + return ApiResponse( + ) + """ + + def testApiResponse(self): + """Test ApiResponse""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_array_of_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_array_of_model.py new file mode 100644 index 00000000000..7c0809b0b23 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_array_of_model.py @@ -0,0 +1,58 @@ +# 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.array_of_array_of_model import ArrayOfArrayOfModel # noqa: E501 + +class TestArrayOfArrayOfModel(unittest.TestCase): + """ArrayOfArrayOfModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ArrayOfArrayOfModel: + """Test ArrayOfArrayOfModel + 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 `ArrayOfArrayOfModel` + """ + model = ArrayOfArrayOfModel() # noqa: E501 + if include_optional: + return ArrayOfArrayOfModel( + another_property = [ + [ + petstore_api.models.tag.Tag( + id = 56, + name = '', ) + ] + ] + ) + else: + return ArrayOfArrayOfModel( + ) + """ + + def testArrayOfArrayOfModel(self): + """Test ArrayOfArrayOfModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_array_of_number_only.py new file mode 100644 index 00000000000..22160c2bd05 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_array_of_number_only.py @@ -0,0 +1,56 @@ +# 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.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly # noqa: E501 + +class TestArrayOfArrayOfNumberOnly(unittest.TestCase): + """ArrayOfArrayOfNumberOnly unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ArrayOfArrayOfNumberOnly: + """Test ArrayOfArrayOfNumberOnly + 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 `ArrayOfArrayOfNumberOnly` + """ + model = ArrayOfArrayOfNumberOnly() # noqa: E501 + if include_optional: + return ArrayOfArrayOfNumberOnly( + array_array_number = [ + [ + 1.337 + ] + ] + ) + else: + return ArrayOfArrayOfNumberOnly( + ) + """ + + def testArrayOfArrayOfNumberOnly(self): + """Test ArrayOfArrayOfNumberOnly""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_number_only.py new file mode 100644 index 00000000000..ade32f4f8f2 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_of_number_only.py @@ -0,0 +1,54 @@ +# 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.array_of_number_only import ArrayOfNumberOnly # noqa: E501 + +class TestArrayOfNumberOnly(unittest.TestCase): + """ArrayOfNumberOnly unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ArrayOfNumberOnly: + """Test ArrayOfNumberOnly + 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 `ArrayOfNumberOnly` + """ + model = ArrayOfNumberOnly() # noqa: E501 + if include_optional: + return ArrayOfNumberOnly( + array_number = [ + 1.337 + ] + ) + else: + return ArrayOfNumberOnly( + ) + """ + + def testArrayOfNumberOnly(self): + """Test ArrayOfNumberOnly""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_test.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_test.py new file mode 100644 index 00000000000..dc20a60413c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_array_test.py @@ -0,0 +1,66 @@ +# 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.array_test import ArrayTest # noqa: E501 + +class TestArrayTest(unittest.TestCase): + """ArrayTest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ArrayTest: + """Test ArrayTest + 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 `ArrayTest` + """ + model = ArrayTest() # noqa: E501 + if include_optional: + return ArrayTest( + array_of_string = [ + '' + ], + array_array_of_integer = [ + [ + 56 + ] + ], + array_array_of_model = [ + [ + petstore_api.models.read_only_first.ReadOnlyFirst( + bar = '', + baz = '', ) + ] + ] + ) + else: + return ArrayTest( + ) + """ + + def testArrayTest(self): + """Test ArrayTest""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_basque_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_basque_pig.py new file mode 100644 index 00000000000..42f62fa3111 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_basque_pig.py @@ -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.basque_pig import BasquePig # noqa: E501 + +class TestBasquePig(unittest.TestCase): + """BasquePig unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> BasquePig: + """Test BasquePig + 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 `BasquePig` + """ + model = BasquePig() # noqa: E501 + if include_optional: + return BasquePig( + class_name = '', + color = '' + ) + else: + return BasquePig( + class_name = '', + color = '', + ) + """ + + def testBasquePig(self): + """Test BasquePig""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_capitalization.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_capitalization.py new file mode 100644 index 00000000000..17b75e51e36 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_capitalization.py @@ -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.capitalization import Capitalization # noqa: E501 + +class TestCapitalization(unittest.TestCase): + """Capitalization unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Capitalization: + """Test Capitalization + 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 `Capitalization` + """ + model = Capitalization() # noqa: E501 + if include_optional: + return Capitalization( + small_camel = '', + capital_camel = '', + small_snake = '', + capital_snake = '', + sca_eth_flow_points = '', + att_name = '' + ) + else: + return Capitalization( + ) + """ + + def testCapitalization(self): + """Test Capitalization""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_cat.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_cat.py new file mode 100644 index 00000000000..58e743f44c8 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_cat.py @@ -0,0 +1,52 @@ +# 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.cat import Cat # noqa: E501 + +class TestCat(unittest.TestCase): + """Cat unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Cat: + """Test Cat + 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 `Cat` + """ + model = Cat() # noqa: E501 + if include_optional: + return Cat( + declawed = True + ) + else: + return Cat( + ) + """ + + def testCat(self): + """Test Cat""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_category.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_category.py new file mode 100644 index 00000000000..2a287246f81 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_category.py @@ -0,0 +1,54 @@ +# 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.category import Category # noqa: E501 + +class TestCategory(unittest.TestCase): + """Category unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Category: + """Test Category + 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 `Category` + """ + model = Category() # noqa: E501 + if include_optional: + return Category( + id = 56, + name = 'default-name' + ) + else: + return Category( + name = 'default-name', + ) + """ + + def testCategory(self): + """Test Category""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_circular_reference_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_circular_reference_model.py new file mode 100644 index 00000000000..f23f0200022 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_circular_reference_model.py @@ -0,0 +1,60 @@ +# 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.circular_reference_model import CircularReferenceModel # noqa: E501 + +class TestCircularReferenceModel(unittest.TestCase): + """CircularReferenceModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> CircularReferenceModel: + """Test CircularReferenceModel + 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 `CircularReferenceModel` + """ + model = CircularReferenceModel() # noqa: E501 + if include_optional: + return CircularReferenceModel( + size = 56, + nested = petstore_api.models.first_ref.FirstRef( + category = '', + self_ref = petstore_api.models.second_ref.SecondRef( + category = '', + circular_ref = petstore_api.models.circular_reference_model.Circular-Reference-Model( + size = 56, + nested = petstore_api.models.first_ref.FirstRef( + category = '', ), ), ), ) + ) + else: + return CircularReferenceModel( + ) + """ + + def testCircularReferenceModel(self): + """Test CircularReferenceModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_class_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_class_model.py new file mode 100644 index 00000000000..6b78a194182 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_class_model.py @@ -0,0 +1,52 @@ +# 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.class_model import ClassModel # noqa: E501 + +class TestClassModel(unittest.TestCase): + """ClassModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ClassModel: + """Test ClassModel + 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 `ClassModel` + """ + model = ClassModel() # noqa: E501 + if include_optional: + return ClassModel( + var_class = '' + ) + else: + return ClassModel( + ) + """ + + def testClassModel(self): + """Test ClassModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_client.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_client.py new file mode 100644 index 00000000000..9d109601e81 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_client.py @@ -0,0 +1,52 @@ +# 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.client import Client # noqa: E501 + +class TestClient(unittest.TestCase): + """Client unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Client: + """Test Client + 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 `Client` + """ + model = Client() # noqa: E501 + if include_optional: + return Client( + client = '' + ) + else: + return Client( + ) + """ + + def testClient(self): + """Test Client""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_color.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_color.py new file mode 100644 index 00000000000..21f53552b36 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_color.py @@ -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 +import datetime + +from petstore_api.models.color import Color # noqa: E501 + +class TestColor(unittest.TestCase): + """Color unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Color: + """Test Color + 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 `Color` + """ + model = Color() # noqa: E501 + if include_optional: + return Color( + ) + else: + return Color( + ) + """ + + def testColor(self): + """Test Color""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_creature.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_creature.py new file mode 100644 index 00000000000..af6b9ef7b31 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_creature.py @@ -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.creature import Creature # noqa: E501 + +class TestCreature(unittest.TestCase): + """Creature unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Creature: + """Test Creature + 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 `Creature` + """ + model = Creature() # noqa: E501 + if include_optional: + return Creature( + info = petstore_api.models.creature_info.CreatureInfo( + name = '', ), + type = '' + ) + else: + return Creature( + info = petstore_api.models.creature_info.CreatureInfo( + name = '', ), + type = '', + ) + """ + + def testCreature(self): + """Test Creature""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_creature_info.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_creature_info.py new file mode 100644 index 00000000000..a95dfd3d922 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_creature_info.py @@ -0,0 +1,53 @@ +# 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.creature_info import CreatureInfo # noqa: E501 + +class TestCreatureInfo(unittest.TestCase): + """CreatureInfo unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> CreatureInfo: + """Test CreatureInfo + 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 `CreatureInfo` + """ + model = CreatureInfo() # noqa: E501 + if include_optional: + return CreatureInfo( + name = '' + ) + else: + return CreatureInfo( + name = '', + ) + """ + + def testCreatureInfo(self): + """Test CreatureInfo""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_danish_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_danish_pig.py new file mode 100644 index 00000000000..bbd0ffcb5f0 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_danish_pig.py @@ -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.danish_pig import DanishPig # noqa: E501 + +class TestDanishPig(unittest.TestCase): + """DanishPig unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DanishPig: + """Test DanishPig + 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 `DanishPig` + """ + model = DanishPig() # noqa: E501 + if include_optional: + return DanishPig( + class_name = '', + size = 56 + ) + else: + return DanishPig( + class_name = '', + size = 56, + ) + """ + + def testDanishPig(self): + """Test DanishPig""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_default_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_default_api.py new file mode 100644 index 00000000000..2d9b266a725 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_default_api.py @@ -0,0 +1,37 @@ +# 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.api.default_api import DefaultApi # noqa: E501 + + +class TestDefaultApi(unittest.TestCase): + """DefaultApi unit test stubs""" + + def setUp(self) -> None: + self.api = DefaultApi() # noqa: E501 + + def tearDown(self) -> None: + pass + + def test_foo_get(self) -> None: + """Test case for foo_get + + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_deprecated_object.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_deprecated_object.py new file mode 100644 index 00000000000..ba3a63c719d --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_deprecated_object.py @@ -0,0 +1,52 @@ +# 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.deprecated_object import DeprecatedObject # noqa: E501 + +class TestDeprecatedObject(unittest.TestCase): + """DeprecatedObject unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DeprecatedObject: + """Test DeprecatedObject + 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 `DeprecatedObject` + """ + model = DeprecatedObject() # noqa: E501 + if include_optional: + return DeprecatedObject( + name = '' + ) + else: + return DeprecatedObject( + ) + """ + + def testDeprecatedObject(self): + """Test DeprecatedObject""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_dog.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_dog.py new file mode 100644 index 00000000000..d8a51df906c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_dog.py @@ -0,0 +1,52 @@ +# 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.dog import Dog # noqa: E501 + +class TestDog(unittest.TestCase): + """Dog unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Dog: + """Test Dog + 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 `Dog` + """ + model = Dog() # noqa: E501 + if include_optional: + return Dog( + breed = '' + ) + else: + return Dog( + ) + """ + + def testDog(self): + """Test Dog""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_dummy_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_dummy_model.py new file mode 100644 index 00000000000..45459b666b1 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_dummy_model.py @@ -0,0 +1,56 @@ +# 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.dummy_model import DummyModel # noqa: E501 + +class TestDummyModel(unittest.TestCase): + """DummyModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DummyModel: + """Test DummyModel + 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 `DummyModel` + """ + model = DummyModel() # noqa: E501 + if include_optional: + return DummyModel( + category = '', + self_ref = petstore_api.models.self_reference_model.Self-Reference-Model( + size = 56, + nested = petstore_api.models.dummy_model.Dummy-Model( + category = '', ), ) + ) + else: + return DummyModel( + ) + """ + + def testDummyModel(self): + """Test DummyModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_arrays.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_arrays.py new file mode 100644 index 00000000000..21e4cf531c4 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_arrays.py @@ -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.enum_arrays import EnumArrays # noqa: E501 + +class TestEnumArrays(unittest.TestCase): + """EnumArrays unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> EnumArrays: + """Test EnumArrays + 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 `EnumArrays` + """ + model = EnumArrays() # noqa: E501 + if include_optional: + return EnumArrays( + just_symbol = '>=', + array_enum = [ + 'fish' + ] + ) + else: + return EnumArrays( + ) + """ + + def testEnumArrays(self): + """Test EnumArrays""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_class.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_class.py new file mode 100644 index 00000000000..92822bcdd97 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_class.py @@ -0,0 +1,34 @@ +# 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.enum_class import EnumClass # noqa: E501 + +class TestEnumClass(unittest.TestCase): + """EnumClass unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEnumClass(self): + """Test EnumClass""" + # inst = EnumClass() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_string1.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_string1.py new file mode 100644 index 00000000000..9cbeacbe344 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_string1.py @@ -0,0 +1,34 @@ +# 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.enum_string1 import EnumString1 # noqa: E501 + +class TestEnumString1(unittest.TestCase): + """EnumString1 unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEnumString1(self): + """Test EnumString1""" + # inst = EnumString1() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_string2.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_string2.py new file mode 100644 index 00000000000..409c7f257a5 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_string2.py @@ -0,0 +1,34 @@ +# 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.enum_string2 import EnumString2 # noqa: E501 + +class TestEnumString2(unittest.TestCase): + """EnumString2 unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEnumString2(self): + """Test EnumString2""" + # inst = EnumString2() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_test.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_test.py new file mode 100644 index 00000000000..b706fa63df2 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_test.py @@ -0,0 +1,61 @@ +# 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.enum_test import EnumTest # noqa: E501 + +class TestEnumTest(unittest.TestCase): + """EnumTest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> EnumTest: + """Test EnumTest + 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 `EnumTest` + """ + model = EnumTest() # noqa: E501 + if include_optional: + return EnumTest( + enum_string = 'UPPER', + enum_string_required = 'UPPER', + enum_integer_default = 1, + enum_integer = 1, + enum_number = 1.1, + outer_enum = 'placed', + outer_enum_integer = 2, + outer_enum_default_value = 'placed', + outer_enum_integer_default_value = -1 + ) + else: + return EnumTest( + enum_string_required = 'UPPER', + ) + """ + + def testEnumTest(self): + """Test EnumTest""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_api.py new file mode 100644 index 00000000000..0d3fca3d755 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_api.py @@ -0,0 +1,175 @@ +# 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.api.fake_api import FakeApi # noqa: E501 + + +class TestFakeApi(unittest.TestCase): + """FakeApi unit test stubs""" + + def setUp(self) -> None: + self.api = FakeApi() # noqa: E501 + + def tearDown(self) -> None: + pass + + def test_fake_any_type_request_body(self) -> None: + """Test case for fake_any_type_request_body + + test any type request body # noqa: E501 + """ + pass + + def test_fake_enum_ref_query_parameter(self) -> None: + """Test case for fake_enum_ref_query_parameter + + test enum reference query parameter # noqa: E501 + """ + pass + + def test_fake_health_get(self) -> None: + """Test case for fake_health_get + + Health check endpoint # noqa: E501 + """ + pass + + def test_fake_http_signature_test(self) -> None: + """Test case for fake_http_signature_test + + test http signature authentication # noqa: E501 + """ + pass + + def test_fake_outer_boolean_serialize(self) -> None: + """Test case for fake_outer_boolean_serialize + + """ + pass + + def test_fake_outer_composite_serialize(self) -> None: + """Test case for fake_outer_composite_serialize + + """ + pass + + def test_fake_outer_number_serialize(self) -> None: + """Test case for fake_outer_number_serialize + + """ + pass + + def test_fake_outer_string_serialize(self) -> None: + """Test case for fake_outer_string_serialize + + """ + pass + + def test_fake_property_enum_integer_serialize(self) -> None: + """Test case for fake_property_enum_integer_serialize + + """ + pass + + def test_fake_return_list_of_objects(self) -> None: + """Test case for fake_return_list_of_objects + + test returning list of objects # noqa: E501 + """ + pass + + def test_fake_uuid_example(self) -> None: + """Test case for fake_uuid_example + + test uuid example # noqa: E501 + """ + pass + + def test_test_body_with_binary(self) -> None: + """Test case for test_body_with_binary + + """ + pass + + def test_test_body_with_file_schema(self) -> None: + """Test case for test_body_with_file_schema + + """ + pass + + def test_test_body_with_query_params(self) -> None: + """Test case for test_body_with_query_params + + """ + pass + + def test_test_client_model(self) -> None: + """Test case for test_client_model + + To test \"client\" model # noqa: E501 + """ + pass + + def test_test_date_time_query_parameter(self) -> None: + """Test case for test_date_time_query_parameter + + """ + pass + + def test_test_endpoint_parameters(self) -> None: + """Test case for test_endpoint_parameters + + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 + """ + pass + + def test_test_group_parameters(self) -> None: + """Test case for test_group_parameters + + Fake endpoint to test group parameters (optional) # noqa: E501 + """ + pass + + def test_test_inline_additional_properties(self) -> None: + """Test case for test_inline_additional_properties + + test inline additionalProperties # noqa: E501 + """ + pass + + def test_test_inline_freeform_additional_properties(self) -> None: + """Test case for test_inline_freeform_additional_properties + + test inline free-form additionalProperties # noqa: E501 + """ + pass + + def test_test_json_form_data(self) -> None: + """Test case for test_json_form_data + + test json serialization of form data # noqa: E501 + """ + pass + + def test_test_query_parameter_collection_format(self) -> None: + """Test case for test_query_parameter_collection_format + + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_classname_tags123_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_classname_tags123_api.py new file mode 100644 index 00000000000..25088624aea --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_classname_tags123_api.py @@ -0,0 +1,38 @@ +# 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.api.fake_classname_tags123_api import FakeClassnameTags123Api # noqa: E501 + + +class TestFakeClassnameTags123Api(unittest.TestCase): + """FakeClassnameTags123Api unit test stubs""" + + def setUp(self) -> None: + self.api = FakeClassnameTags123Api() # noqa: E501 + + def tearDown(self) -> None: + pass + + def test_test_classname(self) -> None: + """Test case for test_classname + + To test class name in snake case # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_file.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_file.py new file mode 100644 index 00000000000..0896f1869db --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_file.py @@ -0,0 +1,52 @@ +# 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.file import File # noqa: E501 + +class TestFile(unittest.TestCase): + """File unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> File: + """Test File + 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 `File` + """ + model = File() # noqa: E501 + if include_optional: + return File( + source_uri = '' + ) + else: + return File( + ) + """ + + def testFile(self): + """Test File""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_file_schema_test_class.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_file_schema_test_class.py new file mode 100644 index 00000000000..72963bf91d5 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_file_schema_test_class.py @@ -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.file_schema_test_class import FileSchemaTestClass # noqa: E501 + +class TestFileSchemaTestClass(unittest.TestCase): + """FileSchemaTestClass unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> FileSchemaTestClass: + """Test FileSchemaTestClass + 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 `FileSchemaTestClass` + """ + model = FileSchemaTestClass() # noqa: E501 + if include_optional: + return FileSchemaTestClass( + file = petstore_api.models.file.File( + source_uri = '', ), + files = [ + petstore_api.models.file.File( + source_uri = '', ) + ] + ) + else: + return FileSchemaTestClass( + ) + """ + + def testFileSchemaTestClass(self): + """Test FileSchemaTestClass""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_first_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_first_ref.py new file mode 100644 index 00000000000..a99fc7cfc79 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_first_ref.py @@ -0,0 +1,58 @@ +# 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.first_ref import FirstRef # noqa: E501 + +class TestFirstRef(unittest.TestCase): + """FirstRef unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> FirstRef: + """Test FirstRef + 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 `FirstRef` + """ + model = FirstRef() # noqa: E501 + if include_optional: + return FirstRef( + category = '', + self_ref = petstore_api.models.second_ref.SecondRef( + category = '', + circular_ref = petstore_api.models.circular_reference_model.Circular-Reference-Model( + size = 56, + nested = petstore_api.models.first_ref.FirstRef( + category = '', ), ), ) + ) + else: + return FirstRef( + ) + """ + + def testFirstRef(self): + """Test FirstRef""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_foo.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_foo.py new file mode 100644 index 00000000000..f92679671c7 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_foo.py @@ -0,0 +1,52 @@ +# 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.foo import Foo # noqa: E501 + +class TestFoo(unittest.TestCase): + """Foo unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Foo: + """Test Foo + 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 `Foo` + """ + model = Foo() # noqa: E501 + if include_optional: + return Foo( + bar = 'bar' + ) + else: + return Foo( + ) + """ + + def testFoo(self): + """Test Foo""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_foo_get_default_response.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_foo_get_default_response.py new file mode 100644 index 00000000000..3a024f8e6c7 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_foo_get_default_response.py @@ -0,0 +1,53 @@ +# 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.foo_get_default_response import FooGetDefaultResponse # noqa: E501 + +class TestFooGetDefaultResponse(unittest.TestCase): + """FooGetDefaultResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> FooGetDefaultResponse: + """Test FooGetDefaultResponse + 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 `FooGetDefaultResponse` + """ + model = FooGetDefaultResponse() # noqa: E501 + if include_optional: + return FooGetDefaultResponse( + string = petstore_api.models.foo.Foo( + bar = 'bar', ) + ) + else: + return FooGetDefaultResponse( + ) + """ + + def testFooGetDefaultResponse(self): + """Test FooGetDefaultResponse""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_format_test.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_format_test.py new file mode 100644 index 00000000000..72c8965d491 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_format_test.py @@ -0,0 +1,71 @@ +# 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.format_test import FormatTest # noqa: E501 + +class TestFormatTest(unittest.TestCase): + """FormatTest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> FormatTest: + """Test FormatTest + 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 `FormatTest` + """ + model = FormatTest() # noqa: E501 + if include_optional: + return FormatTest( + integer = 10, + int32 = 20, + int64 = 56, + number = 32.1, + float = 54.3, + double = 67.8, + decimal = 1, + string = 'a', + string_with_double_quote_pattern = 'this is \"something\"', + byte = 'YQ==', + binary = bytes(b'blah'), + var_date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + date_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + uuid = '72f98069-206d-4f12-9f12-3d1e525a8e84', + password = '0123456789', + pattern_with_digits = '0480728880', + pattern_with_digits_and_delimiter = 'image_480' + ) + else: + return FormatTest( + number = 32.1, + var_date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + password = '0123456789', + ) + """ + + def testFormatTest(self): + """Test FormatTest""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_has_only_read_only.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_has_only_read_only.py new file mode 100644 index 00000000000..f106dda48d7 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_has_only_read_only.py @@ -0,0 +1,53 @@ +# 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.has_only_read_only import HasOnlyReadOnly # noqa: E501 + +class TestHasOnlyReadOnly(unittest.TestCase): + """HasOnlyReadOnly unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> HasOnlyReadOnly: + """Test HasOnlyReadOnly + 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 `HasOnlyReadOnly` + """ + model = HasOnlyReadOnly() # noqa: E501 + if include_optional: + return HasOnlyReadOnly( + bar = '', + foo = '' + ) + else: + return HasOnlyReadOnly( + ) + """ + + def testHasOnlyReadOnly(self): + """Test HasOnlyReadOnly""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_health_check_result.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_health_check_result.py new file mode 100644 index 00000000000..4f36cde5f8b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_health_check_result.py @@ -0,0 +1,52 @@ +# 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.health_check_result import HealthCheckResult # noqa: E501 + +class TestHealthCheckResult(unittest.TestCase): + """HealthCheckResult unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> HealthCheckResult: + """Test HealthCheckResult + 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 `HealthCheckResult` + """ + model = HealthCheckResult() # noqa: E501 + if include_optional: + return HealthCheckResult( + nullable_message = '' + ) + else: + return HealthCheckResult( + ) + """ + + def testHealthCheckResult(self): + """Test HealthCheckResult""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_inner_dict_with_property.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_inner_dict_with_property.py new file mode 100644 index 00000000000..1ba15fd984d --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_inner_dict_with_property.py @@ -0,0 +1,52 @@ +# 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.inner_dict_with_property import InnerDictWithProperty # noqa: E501 + +class TestInnerDictWithProperty(unittest.TestCase): + """InnerDictWithProperty unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> InnerDictWithProperty: + """Test InnerDictWithProperty + 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 `InnerDictWithProperty` + """ + model = InnerDictWithProperty() # noqa: E501 + if include_optional: + return InnerDictWithProperty( + a_property = None + ) + else: + return InnerDictWithProperty( + ) + """ + + def testInnerDictWithProperty(self): + """Test InnerDictWithProperty""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_int_or_string.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_int_or_string.py new file mode 100644 index 00000000000..41bf80d02cb --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_int_or_string.py @@ -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 +import datetime + +from petstore_api.models.int_or_string import IntOrString # noqa: E501 + +class TestIntOrString(unittest.TestCase): + """IntOrString unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> IntOrString: + """Test IntOrString + 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 `IntOrString` + """ + model = IntOrString() # noqa: E501 + if include_optional: + return IntOrString( + ) + else: + return IntOrString( + ) + """ + + def testIntOrString(self): + """Test IntOrString""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_list.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_list.py new file mode 100644 index 00000000000..63be8f9a3d3 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_list.py @@ -0,0 +1,52 @@ +# 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.list import List # noqa: E501 + +class TestList(unittest.TestCase): + """List unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> List: + """Test List + 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 `List` + """ + model = List() # noqa: E501 + if include_optional: + return List( + var_123_list = '' + ) + else: + return List( + ) + """ + + def testList(self): + """Test List""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_map_of_array_of_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_map_of_array_of_model.py new file mode 100644 index 00000000000..2f88aa7935a --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_map_of_array_of_model.py @@ -0,0 +1,58 @@ +# 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.map_of_array_of_model import MapOfArrayOfModel # noqa: E501 + +class TestMapOfArrayOfModel(unittest.TestCase): + """MapOfArrayOfModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> MapOfArrayOfModel: + """Test MapOfArrayOfModel + 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 `MapOfArrayOfModel` + """ + model = MapOfArrayOfModel() # noqa: E501 + if include_optional: + return MapOfArrayOfModel( + shop_id_to_org_online_lip_map = { + 'key' : [ + petstore_api.models.tag.Tag( + id = 56, + name = '', ) + ] + } + ) + else: + return MapOfArrayOfModel( + ) + """ + + def testMapOfArrayOfModel(self): + """Test MapOfArrayOfModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_map_test.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_map_test.py new file mode 100644 index 00000000000..8aedbfa8f66 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_map_test.py @@ -0,0 +1,65 @@ +# 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.map_test import MapTest # noqa: E501 + +class TestMapTest(unittest.TestCase): + """MapTest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> MapTest: + """Test MapTest + 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 `MapTest` + """ + model = MapTest() # noqa: E501 + if include_optional: + return MapTest( + map_map_of_string = { + 'key' : { + 'key' : '' + } + }, + map_of_enum_string = { + 'UPPER' : 'UPPER' + }, + direct_map = { + 'key' : True + }, + indirect_map = { + 'key' : True + } + ) + else: + return MapTest( + ) + """ + + def testMapTest(self): + """Test MapTest""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_mixed_properties_and_additional_properties_class.py new file mode 100644 index 00000000000..12a96998a56 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_mixed_properties_and_additional_properties_class.py @@ -0,0 +1,58 @@ +# 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.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass # noqa: E501 + +class TestMixedPropertiesAndAdditionalPropertiesClass(unittest.TestCase): + """MixedPropertiesAndAdditionalPropertiesClass unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> MixedPropertiesAndAdditionalPropertiesClass: + """Test MixedPropertiesAndAdditionalPropertiesClass + 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 `MixedPropertiesAndAdditionalPropertiesClass` + """ + model = MixedPropertiesAndAdditionalPropertiesClass() # noqa: E501 + if include_optional: + return MixedPropertiesAndAdditionalPropertiesClass( + uuid = '', + date_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + map = { + 'key' : petstore_api.models.animal.Animal( + class_name = '', + color = 'red', ) + } + ) + else: + return MixedPropertiesAndAdditionalPropertiesClass( + ) + """ + + def testMixedPropertiesAndAdditionalPropertiesClass(self): + """Test MixedPropertiesAndAdditionalPropertiesClass""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_model200_response.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_model200_response.py new file mode 100644 index 00000000000..f5e65f1aca4 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_model200_response.py @@ -0,0 +1,53 @@ +# 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.model200_response import Model200Response # noqa: E501 + +class TestModel200Response(unittest.TestCase): + """Model200Response unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Model200Response: + """Test Model200Response + 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 `Model200Response` + """ + model = Model200Response() # noqa: E501 + if include_optional: + return Model200Response( + name = 56, + var_class = '' + ) + else: + return Model200Response( + ) + """ + + def testModel200Response(self): + """Test Model200Response""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_model_return.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_model_return.py new file mode 100644 index 00000000000..e011892fb0b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_model_return.py @@ -0,0 +1,52 @@ +# 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.model_return import ModelReturn # noqa: E501 + +class TestModelReturn(unittest.TestCase): + """ModelReturn unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ModelReturn: + """Test ModelReturn + 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 `ModelReturn` + """ + model = ModelReturn() # noqa: E501 + if include_optional: + return ModelReturn( + var_return = 56 + ) + else: + return ModelReturn( + ) + """ + + def testModelReturn(self): + """Test ModelReturn""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_name.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_name.py new file mode 100644 index 00000000000..be7ddc8461d --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_name.py @@ -0,0 +1,56 @@ +# 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.name import Name # noqa: E501 + +class TestName(unittest.TestCase): + """Name unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Name: + """Test Name + 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 `Name` + """ + model = Name() # noqa: E501 + if include_optional: + return Name( + name = 56, + snake_case = 56, + var_property = '', + var_123_number = 56 + ) + else: + return Name( + name = 56, + ) + """ + + def testName(self): + """Test Name""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_nullable_class.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_nullable_class.py new file mode 100644 index 00000000000..b1170db23c4 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_nullable_class.py @@ -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 + + +import unittest +import datetime + +from petstore_api.models.nullable_class import NullableClass # noqa: E501 + +class TestNullableClass(unittest.TestCase): + """NullableClass unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> NullableClass: + """Test NullableClass + 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 `NullableClass` + """ + model = NullableClass() # noqa: E501 + if include_optional: + return NullableClass( + required_integer_prop = 56, + integer_prop = 56, + number_prop = 1.337, + boolean_prop = True, + string_prop = '', + date_prop = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + datetime_prop = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + array_nullable_prop = [ + None + ], + array_and_items_nullable_prop = [ + None + ], + array_items_nullable = [ + None + ], + object_nullable_prop = { + 'key' : None + }, + object_and_items_nullable_prop = { + 'key' : None + }, + object_items_nullable = { + 'key' : None + } + ) + else: + return NullableClass( + required_integer_prop = 56, + ) + """ + + def testNullableClass(self): + """Test NullableClass""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_nullable_property.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_nullable_property.py new file mode 100644 index 00000000000..aa34b84e797 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_nullable_property.py @@ -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.nullable_property import NullableProperty # noqa: E501 + +class TestNullableProperty(unittest.TestCase): + """NullableProperty unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> NullableProperty: + """Test NullableProperty + 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 `NullableProperty` + """ + model = NullableProperty() # noqa: E501 + if include_optional: + return NullableProperty( + id = 56, + name = 'AUR,rZ#UM/?R,Fp^l6$ARjbhJk C>' + ) + else: + return NullableProperty( + id = 56, + name = 'AUR,rZ#UM/?R,Fp^l6$ARjbhJk C>', + ) + """ + + def testNullableProperty(self): + """Test NullableProperty""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_number_only.py new file mode 100644 index 00000000000..cfc8c5c778c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_number_only.py @@ -0,0 +1,52 @@ +# 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.number_only import NumberOnly # noqa: E501 + +class TestNumberOnly(unittest.TestCase): + """NumberOnly unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> NumberOnly: + """Test NumberOnly + 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 `NumberOnly` + """ + model = NumberOnly() # noqa: E501 + if include_optional: + return NumberOnly( + just_number = 1.337 + ) + else: + return NumberOnly( + ) + """ + + def testNumberOnly(self): + """Test NumberOnly""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_object_to_test_additional_properties.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_object_to_test_additional_properties.py new file mode 100644 index 00000000000..d080b21afb3 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_object_to_test_additional_properties.py @@ -0,0 +1,52 @@ +# 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.object_to_test_additional_properties import ObjectToTestAdditionalProperties # noqa: E501 + +class TestObjectToTestAdditionalProperties(unittest.TestCase): + """ObjectToTestAdditionalProperties unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ObjectToTestAdditionalProperties: + """Test ObjectToTestAdditionalProperties + 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 `ObjectToTestAdditionalProperties` + """ + model = ObjectToTestAdditionalProperties() # noqa: E501 + if include_optional: + return ObjectToTestAdditionalProperties( + var_property = True + ) + else: + return ObjectToTestAdditionalProperties( + ) + """ + + def testObjectToTestAdditionalProperties(self): + """Test ObjectToTestAdditionalProperties""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_object_with_deprecated_fields.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_object_with_deprecated_fields.py new file mode 100644 index 00000000000..5f04c63a3cb --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_object_with_deprecated_fields.py @@ -0,0 +1,58 @@ +# 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.object_with_deprecated_fields import ObjectWithDeprecatedFields # noqa: E501 + +class TestObjectWithDeprecatedFields(unittest.TestCase): + """ObjectWithDeprecatedFields unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ObjectWithDeprecatedFields: + """Test ObjectWithDeprecatedFields + 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 `ObjectWithDeprecatedFields` + """ + model = ObjectWithDeprecatedFields() # noqa: E501 + if include_optional: + return ObjectWithDeprecatedFields( + uuid = '', + id = 1.337, + deprecated_ref = petstore_api.models.deprecated_object.DeprecatedObject( + name = '', ), + bars = [ + 'bar' + ] + ) + else: + return ObjectWithDeprecatedFields( + ) + """ + + def testObjectWithDeprecatedFields(self): + """Test ObjectWithDeprecatedFields""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_one_of_enum_string.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_one_of_enum_string.py new file mode 100644 index 00000000000..3db614a16ca --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_one_of_enum_string.py @@ -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 +import datetime + +from petstore_api.models.one_of_enum_string import OneOfEnumString # noqa: E501 + +class TestOneOfEnumString(unittest.TestCase): + """OneOfEnumString unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> OneOfEnumString: + """Test OneOfEnumString + 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 `OneOfEnumString` + """ + model = OneOfEnumString() # noqa: E501 + if include_optional: + return OneOfEnumString( + ) + else: + return OneOfEnumString( + ) + """ + + def testOneOfEnumString(self): + """Test OneOfEnumString""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_order.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_order.py new file mode 100644 index 00000000000..3334ed8f949 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_order.py @@ -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.order import Order # noqa: E501 + +class TestOrder(unittest.TestCase): + """Order unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Order: + """Test Order + 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 `Order` + """ + model = Order() # noqa: E501 + if include_optional: + return Order( + id = 56, + pet_id = 56, + quantity = 56, + ship_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + status = 'placed', + complete = True + ) + else: + return Order( + ) + """ + + def testOrder(self): + """Test Order""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_composite.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_composite.py new file mode 100644 index 00000000000..7df32d8c672 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_composite.py @@ -0,0 +1,54 @@ +# 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.outer_composite import OuterComposite # noqa: E501 + +class TestOuterComposite(unittest.TestCase): + """OuterComposite unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> OuterComposite: + """Test OuterComposite + 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 `OuterComposite` + """ + model = OuterComposite() # noqa: E501 + if include_optional: + return OuterComposite( + my_number = 1.337, + my_string = '', + my_boolean = True + ) + else: + return OuterComposite( + ) + """ + + def testOuterComposite(self): + """Test OuterComposite""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum.py new file mode 100644 index 00000000000..5da04a9a45c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum.py @@ -0,0 +1,34 @@ +# 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.outer_enum import OuterEnum # noqa: E501 + +class TestOuterEnum(unittest.TestCase): + """OuterEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOuterEnum(self): + """Test OuterEnum""" + # inst = OuterEnum() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_default_value.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_default_value.py new file mode 100644 index 00000000000..df6499565fd --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_default_value.py @@ -0,0 +1,34 @@ +# 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.outer_enum_default_value import OuterEnumDefaultValue # noqa: E501 + +class TestOuterEnumDefaultValue(unittest.TestCase): + """OuterEnumDefaultValue unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOuterEnumDefaultValue(self): + """Test OuterEnumDefaultValue""" + # inst = OuterEnumDefaultValue() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_integer.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_integer.py new file mode 100644 index 00000000000..7b89b806ba2 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_integer.py @@ -0,0 +1,34 @@ +# 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.outer_enum_integer import OuterEnumInteger # noqa: E501 + +class TestOuterEnumInteger(unittest.TestCase): + """OuterEnumInteger unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOuterEnumInteger(self): + """Test OuterEnumInteger""" + # inst = OuterEnumInteger() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_integer_default_value.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_integer_default_value.py new file mode 100644 index 00000000000..532616fdee1 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_enum_integer_default_value.py @@ -0,0 +1,34 @@ +# 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.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue # noqa: E501 + +class TestOuterEnumIntegerDefaultValue(unittest.TestCase): + """OuterEnumIntegerDefaultValue unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOuterEnumIntegerDefaultValue(self): + """Test OuterEnumIntegerDefaultValue""" + # inst = OuterEnumIntegerDefaultValue() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_object_with_enum_property.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_object_with_enum_property.py new file mode 100644 index 00000000000..27e518b0059 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_outer_object_with_enum_property.py @@ -0,0 +1,54 @@ +# 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.outer_object_with_enum_property import OuterObjectWithEnumProperty # noqa: E501 + +class TestOuterObjectWithEnumProperty(unittest.TestCase): + """OuterObjectWithEnumProperty unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> OuterObjectWithEnumProperty: + """Test OuterObjectWithEnumProperty + 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 `OuterObjectWithEnumProperty` + """ + model = OuterObjectWithEnumProperty() # noqa: E501 + if include_optional: + return OuterObjectWithEnumProperty( + str_value = 'placed', + value = 2 + ) + else: + return OuterObjectWithEnumProperty( + value = 2, + ) + """ + + def testOuterObjectWithEnumProperty(self): + """Test OuterObjectWithEnumProperty""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_parent.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_parent.py new file mode 100644 index 00000000000..ea206970c9c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_parent.py @@ -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.parent import Parent # noqa: E501 + +class TestParent(unittest.TestCase): + """Parent unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Parent: + """Test Parent + 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 `Parent` + """ + model = Parent() # noqa: E501 + if include_optional: + return Parent( + optional_dict = { + 'key' : petstore_api.models.inner_dict_with_property.InnerDictWithProperty( + a_property = petstore_api.models.a_property.aProperty(), ) + } + ) + else: + return Parent( + ) + """ + + def testParent(self): + """Test Parent""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_parent_with_optional_dict.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_parent_with_optional_dict.py new file mode 100644 index 00000000000..2c668a7047a --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_parent_with_optional_dict.py @@ -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.parent_with_optional_dict import ParentWithOptionalDict # noqa: E501 + +class TestParentWithOptionalDict(unittest.TestCase): + """ParentWithOptionalDict unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ParentWithOptionalDict: + """Test ParentWithOptionalDict + 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 `ParentWithOptionalDict` + """ + model = ParentWithOptionalDict() # noqa: E501 + if include_optional: + return ParentWithOptionalDict( + optional_dict = { + 'key' : petstore_api.models.inner_dict_with_property.InnerDictWithProperty( + a_property = petstore_api.models.a_property.aProperty(), ) + } + ) + else: + return ParentWithOptionalDict( + ) + """ + + def testParentWithOptionalDict(self): + """Test ParentWithOptionalDict""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pet.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pet.py new file mode 100644 index 00000000000..f89e6cdf4b4 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pet.py @@ -0,0 +1,69 @@ +# 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.pet import Pet # noqa: E501 + +class TestPet(unittest.TestCase): + """Pet unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Pet: + """Test Pet + 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 `Pet` + """ + model = Pet() # noqa: E501 + if include_optional: + return Pet( + id = 56, + category = petstore_api.models.category.Category( + id = 56, + name = 'default-name', ), + name = 'doggie', + photo_urls = [ + '' + ], + tags = [ + petstore_api.models.tag.Tag( + id = 56, + name = '', ) + ], + status = 'available' + ) + else: + return Pet( + name = 'doggie', + photo_urls = [ + '' + ], + ) + """ + + def testPet(self): + """Test Pet""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pet_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pet_api.py new file mode 100644 index 00000000000..2352eb7ab40 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pet_api.py @@ -0,0 +1,94 @@ +# 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.api.pet_api import PetApi # noqa: E501 + + +class TestPetApi(unittest.TestCase): + """PetApi unit test stubs""" + + def setUp(self) -> None: + self.api = PetApi() # noqa: E501 + + def tearDown(self) -> None: + pass + + def test_add_pet(self) -> None: + """Test case for add_pet + + Add a new pet to the store # noqa: E501 + """ + pass + + def test_delete_pet(self) -> None: + """Test case for delete_pet + + Deletes a pet # noqa: E501 + """ + pass + + def test_find_pets_by_status(self) -> None: + """Test case for find_pets_by_status + + Finds Pets by status # noqa: E501 + """ + pass + + def test_find_pets_by_tags(self) -> None: + """Test case for find_pets_by_tags + + Finds Pets by tags # noqa: E501 + """ + pass + + def test_get_pet_by_id(self) -> None: + """Test case for get_pet_by_id + + Find pet by ID # noqa: E501 + """ + pass + + def test_update_pet(self) -> None: + """Test case for update_pet + + Update an existing pet # noqa: E501 + """ + pass + + def test_update_pet_with_form(self) -> None: + """Test case for update_pet_with_form + + Updates a pet in the store with form data # noqa: E501 + """ + pass + + def test_upload_file(self) -> None: + """Test case for upload_file + + uploads an image # noqa: E501 + """ + pass + + def test_upload_file_with_required_file(self) -> None: + """Test case for upload_file_with_required_file + + uploads an image (required) # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pig.py new file mode 100644 index 00000000000..cd3f112aabc --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pig.py @@ -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.pig import Pig # noqa: E501 + +class TestPig(unittest.TestCase): + """Pig unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Pig: + """Test Pig + 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 `Pig` + """ + model = Pig() # noqa: E501 + if include_optional: + return Pig( + class_name = '', + color = '', + size = 56 + ) + else: + return Pig( + class_name = '', + color = '', + size = 56, + ) + """ + + def testPig(self): + """Test Pig""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_property_name_collision.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_property_name_collision.py new file mode 100644 index 00000000000..f9c8d8a7721 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_property_name_collision.py @@ -0,0 +1,54 @@ +# 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.property_name_collision import PropertyNameCollision # noqa: E501 + +class TestPropertyNameCollision(unittest.TestCase): + """PropertyNameCollision unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PropertyNameCollision: + """Test PropertyNameCollision + 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 `PropertyNameCollision` + """ + model = PropertyNameCollision() # noqa: E501 + if include_optional: + return PropertyNameCollision( + type = '', + type = '', + type_ = '' + ) + else: + return PropertyNameCollision( + ) + """ + + def testPropertyNameCollision(self): + """Test PropertyNameCollision""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_read_only_first.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_read_only_first.py new file mode 100644 index 00000000000..1026a73205d --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_read_only_first.py @@ -0,0 +1,53 @@ +# 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.read_only_first import ReadOnlyFirst # noqa: E501 + +class TestReadOnlyFirst(unittest.TestCase): + """ReadOnlyFirst unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ReadOnlyFirst: + """Test ReadOnlyFirst + 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 `ReadOnlyFirst` + """ + model = ReadOnlyFirst() # noqa: E501 + if include_optional: + return ReadOnlyFirst( + bar = '', + baz = '' + ) + else: + return ReadOnlyFirst( + ) + """ + + def testReadOnlyFirst(self): + """Test ReadOnlyFirst""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_second_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_second_ref.py new file mode 100644 index 00000000000..44194f94544 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_second_ref.py @@ -0,0 +1,58 @@ +# 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.second_ref import SecondRef # noqa: E501 + +class TestSecondRef(unittest.TestCase): + """SecondRef unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> SecondRef: + """Test SecondRef + 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 `SecondRef` + """ + model = SecondRef() # noqa: E501 + if include_optional: + return SecondRef( + category = '', + circular_ref = petstore_api.models.circular_reference_model.Circular-Reference-Model( + size = 56, + nested = petstore_api.models.first_ref.FirstRef( + category = '', + self_ref = petstore_api.models.second_ref.SecondRef( + category = '', ), ), ) + ) + else: + return SecondRef( + ) + """ + + def testSecondRef(self): + """Test SecondRef""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_self_reference_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_self_reference_model.py new file mode 100644 index 00000000000..8c23008b26e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_self_reference_model.py @@ -0,0 +1,58 @@ +# 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.self_reference_model import SelfReferenceModel # noqa: E501 + +class TestSelfReferenceModel(unittest.TestCase): + """SelfReferenceModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> SelfReferenceModel: + """Test SelfReferenceModel + 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 `SelfReferenceModel` + """ + model = SelfReferenceModel() # noqa: E501 + if include_optional: + return SelfReferenceModel( + size = 56, + nested = petstore_api.models.dummy_model.Dummy-Model( + category = '', + self_ref = petstore_api.models.self_reference_model.Self-Reference-Model( + size = 56, + nested = petstore_api.models.dummy_model.Dummy-Model( + category = '', ), ), ) + ) + else: + return SelfReferenceModel( + ) + """ + + def testSelfReferenceModel(self): + """Test SelfReferenceModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_single_ref_type.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_single_ref_type.py new file mode 100644 index 00000000000..f5642b8376b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_single_ref_type.py @@ -0,0 +1,34 @@ +# 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.single_ref_type import SingleRefType # noqa: E501 + +class TestSingleRefType(unittest.TestCase): + """SingleRefType unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testSingleRefType(self): + """Test SingleRefType""" + # inst = SingleRefType() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_character_enum.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_character_enum.py new file mode 100644 index 00000000000..ee5baab1309 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_character_enum.py @@ -0,0 +1,34 @@ +# 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.special_character_enum import SpecialCharacterEnum # noqa: E501 + +class TestSpecialCharacterEnum(unittest.TestCase): + """SpecialCharacterEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testSpecialCharacterEnum(self): + """Test SpecialCharacterEnum""" + # inst = SpecialCharacterEnum() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_model_name.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_model_name.py new file mode 100644 index 00000000000..12ec90a9067 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_model_name.py @@ -0,0 +1,52 @@ +# 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.special_model_name import SpecialModelName # noqa: E501 + +class TestSpecialModelName(unittest.TestCase): + """SpecialModelName unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> SpecialModelName: + """Test SpecialModelName + 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 `SpecialModelName` + """ + model = SpecialModelName() # noqa: E501 + if include_optional: + return SpecialModelName( + special_property_name = 56 + ) + else: + return SpecialModelName( + ) + """ + + def testSpecialModelName(self): + """Test SpecialModelName""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_name.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_name.py new file mode 100644 index 00000000000..afaf0996b74 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_special_name.py @@ -0,0 +1,56 @@ +# 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.special_name import SpecialName # noqa: E501 + +class TestSpecialName(unittest.TestCase): + """SpecialName unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> SpecialName: + """Test SpecialName + 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 `SpecialName` + """ + model = SpecialName() # noqa: E501 + if include_optional: + return SpecialName( + var_property = 56, + var_async = petstore_api.models.category.Category( + id = 56, + name = 'default-name', ), + var_schema = 'available' + ) + else: + return SpecialName( + ) + """ + + def testSpecialName(self): + """Test SpecialName""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_store_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_store_api.py new file mode 100644 index 00000000000..c25309ee006 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_store_api.py @@ -0,0 +1,59 @@ +# 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.api.store_api import StoreApi # noqa: E501 + + +class TestStoreApi(unittest.TestCase): + """StoreApi unit test stubs""" + + def setUp(self) -> None: + self.api = StoreApi() # noqa: E501 + + def tearDown(self) -> None: + pass + + def test_delete_order(self) -> None: + """Test case for delete_order + + Delete purchase order by ID # noqa: E501 + """ + pass + + def test_get_inventory(self) -> None: + """Test case for get_inventory + + Returns pet inventories by status # noqa: E501 + """ + pass + + def test_get_order_by_id(self) -> None: + """Test case for get_order_by_id + + Find purchase order by ID # noqa: E501 + """ + pass + + def test_place_order(self) -> None: + """Test case for place_order + + Place an order for a pet # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_tag.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_tag.py new file mode 100644 index 00000000000..d5ce3fb8a0c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_tag.py @@ -0,0 +1,53 @@ +# 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.tag import Tag # noqa: E501 + +class TestTag(unittest.TestCase): + """Tag unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Tag: + """Test Tag + 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 `Tag` + """ + model = Tag() # noqa: E501 + if include_optional: + return Tag( + id = 56, + name = '' + ) + else: + return Tag( + ) + """ + + def testTag(self): + """Test Tag""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_test_inline_freeform_additional_properties_request.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_test_inline_freeform_additional_properties_request.py new file mode 100644 index 00000000000..5c40397bc91 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_test_inline_freeform_additional_properties_request.py @@ -0,0 +1,52 @@ +# 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.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest # noqa: E501 + +class TestTestInlineFreeformAdditionalPropertiesRequest(unittest.TestCase): + """TestInlineFreeformAdditionalPropertiesRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TestInlineFreeformAdditionalPropertiesRequest: + """Test TestInlineFreeformAdditionalPropertiesRequest + 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 `TestInlineFreeformAdditionalPropertiesRequest` + """ + model = TestInlineFreeformAdditionalPropertiesRequest() # noqa: E501 + if include_optional: + return TestInlineFreeformAdditionalPropertiesRequest( + some_property = '' + ) + else: + return TestInlineFreeformAdditionalPropertiesRequest( + ) + """ + + def testTestInlineFreeformAdditionalPropertiesRequest(self): + """Test TestInlineFreeformAdditionalPropertiesRequest""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_tiger.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_tiger.py new file mode 100644 index 00000000000..7aab61a4606 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_tiger.py @@ -0,0 +1,52 @@ +# 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.tiger import Tiger # noqa: E501 + +class TestTiger(unittest.TestCase): + """Tiger unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Tiger: + """Test Tiger + 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 `Tiger` + """ + model = Tiger() # noqa: E501 + if include_optional: + return Tiger( + skill = '' + ) + else: + return Tiger( + ) + """ + + def testTiger(self): + """Test Tiger""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_user.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_user.py new file mode 100644 index 00000000000..a1ce46e87a1 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_user.py @@ -0,0 +1,59 @@ +# 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.user import User # noqa: E501 + +class TestUser(unittest.TestCase): + """User unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> User: + """Test User + 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 `User` + """ + model = User() # noqa: E501 + if include_optional: + return User( + id = 56, + username = '', + first_name = '', + last_name = '', + email = '', + password = '', + phone = '', + user_status = 56 + ) + else: + return User( + ) + """ + + def testUser(self): + """Test User""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_user_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_user_api.py new file mode 100644 index 00000000000..28103bb27ea --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_user_api.py @@ -0,0 +1,87 @@ +# 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.api.user_api import UserApi # noqa: E501 + + +class TestUserApi(unittest.TestCase): + """UserApi unit test stubs""" + + def setUp(self) -> None: + self.api = UserApi() # noqa: E501 + + def tearDown(self) -> None: + pass + + def test_create_user(self) -> None: + """Test case for create_user + + Create user # noqa: E501 + """ + pass + + def test_create_users_with_array_input(self) -> None: + """Test case for create_users_with_array_input + + Creates list of users with given input array # noqa: E501 + """ + pass + + def test_create_users_with_list_input(self) -> None: + """Test case for create_users_with_list_input + + Creates list of users with given input array # noqa: E501 + """ + pass + + def test_delete_user(self) -> None: + """Test case for delete_user + + Delete user # noqa: E501 + """ + pass + + def test_get_user_by_name(self) -> None: + """Test case for get_user_by_name + + Get user by user name # noqa: E501 + """ + pass + + def test_login_user(self) -> None: + """Test case for login_user + + Logs user into the system # noqa: E501 + """ + pass + + def test_logout_user(self) -> None: + """Test case for logout_user + + Logs out current logged in user session # noqa: E501 + """ + pass + + def test_update_user(self) -> None: + """Test case for update_user + + Updated user # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_with_nested_one_of.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_with_nested_one_of.py new file mode 100644 index 00000000000..43c4a69a29b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_with_nested_one_of.py @@ -0,0 +1,54 @@ +# 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.with_nested_one_of import WithNestedOneOf # noqa: E501 + +class TestWithNestedOneOf(unittest.TestCase): + """WithNestedOneOf unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> WithNestedOneOf: + """Test WithNestedOneOf + 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 `WithNestedOneOf` + """ + model = WithNestedOneOf() # noqa: E501 + if include_optional: + return WithNestedOneOf( + size = 56, + nested_pig = None, + nested_oneof_enum_string = None + ) + else: + return WithNestedOneOf( + ) + """ + + def testWithNestedOneOf(self): + """Test WithNestedOneOf""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/tox.ini b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/tox.ini new file mode 100644 index 00000000000..8989fc3c4d9 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/tox.ini @@ -0,0 +1,9 @@ +[tox] +envlist = py3 + +[testenv] +deps=-r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + +commands= + pytest --cov=petstore_api diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/.github/workflows/python.yml b/samples/openapi3/client/petstore/python-pydantic-v1/.github/workflows/python.yml new file mode 100644 index 00000000000..fed030f265e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/.github/workflows/python.yml @@ -0,0 +1,38 @@ +# NOTE: This file is auto generated by OpenAPI Generator. +# URL: https://openapi-generator.tech +# +# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: petstore_api Python package + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/.gitignore b/samples/openapi3/client/petstore/python-pydantic-v1/.gitignore new file mode 100644 index 00000000000..43995bd42fa --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/.gitignore @@ -0,0 +1,66 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ +venv/ +.venv/ +.python-version +.pytest_cache + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +#Ipython Notebook +.ipynb_checkpoints diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/.gitlab-ci.yml b/samples/openapi3/client/petstore/python-pydantic-v1/.gitlab-ci.yml new file mode 100644 index 00000000000..b4719756536 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/.gitlab-ci.yml @@ -0,0 +1,31 @@ +# NOTE: This file is auto generated by OpenAPI Generator. +# URL: https://openapi-generator.tech +# +# ref: https://docs.gitlab.com/ee/ci/README.html +# ref: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml + +stages: + - test + +.pytest: + stage: test + script: + - pip install -r requirements.txt + - pip install -r test-requirements.txt + - pytest --cov=petstore_api + +pytest-3.7: + extends: .pytest + image: python:3.7-alpine +pytest-3.8: + extends: .pytest + image: python:3.8-alpine +pytest-3.9: + extends: .pytest + image: python:3.9-alpine +pytest-3.10: + extends: .pytest + image: python:3.10-alpine +pytest-3.11: + extends: .pytest + image: python:3.11-alpine diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator-ignore b/samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator/FILES b/samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator/FILES new file mode 100644 index 00000000000..e943667b1f6 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator/FILES @@ -0,0 +1,195 @@ +.github/workflows/python.yml +.gitignore +.gitlab-ci.yml +.travis.yml +README.md +docs/AdditionalPropertiesAnyType.md +docs/AdditionalPropertiesClass.md +docs/AdditionalPropertiesObject.md +docs/AdditionalPropertiesWithDescriptionOnly.md +docs/AllOfWithSingleRef.md +docs/Animal.md +docs/AnotherFakeApi.md +docs/AnyOfColor.md +docs/AnyOfPig.md +docs/ApiResponse.md +docs/ArrayOfArrayOfModel.md +docs/ArrayOfArrayOfNumberOnly.md +docs/ArrayOfNumberOnly.md +docs/ArrayTest.md +docs/BasquePig.md +docs/Capitalization.md +docs/Cat.md +docs/Category.md +docs/CircularReferenceModel.md +docs/ClassModel.md +docs/Client.md +docs/Color.md +docs/Creature.md +docs/CreatureInfo.md +docs/DanishPig.md +docs/DefaultApi.md +docs/DeprecatedObject.md +docs/Dog.md +docs/DummyModel.md +docs/EnumArrays.md +docs/EnumClass.md +docs/EnumString1.md +docs/EnumString2.md +docs/EnumTest.md +docs/FakeApi.md +docs/FakeClassnameTags123Api.md +docs/File.md +docs/FileSchemaTestClass.md +docs/FirstRef.md +docs/Foo.md +docs/FooGetDefaultResponse.md +docs/FormatTest.md +docs/HasOnlyReadOnly.md +docs/HealthCheckResult.md +docs/InnerDictWithProperty.md +docs/IntOrString.md +docs/List.md +docs/MapOfArrayOfModel.md +docs/MapTest.md +docs/MixedPropertiesAndAdditionalPropertiesClass.md +docs/Model200Response.md +docs/ModelReturn.md +docs/Name.md +docs/NullableClass.md +docs/NullableProperty.md +docs/NumberOnly.md +docs/ObjectToTestAdditionalProperties.md +docs/ObjectWithDeprecatedFields.md +docs/OneOfEnumString.md +docs/Order.md +docs/OuterComposite.md +docs/OuterEnum.md +docs/OuterEnumDefaultValue.md +docs/OuterEnumInteger.md +docs/OuterEnumIntegerDefaultValue.md +docs/OuterObjectWithEnumProperty.md +docs/Parent.md +docs/ParentWithOptionalDict.md +docs/Pet.md +docs/PetApi.md +docs/Pig.md +docs/PropertyNameCollision.md +docs/ReadOnlyFirst.md +docs/SecondRef.md +docs/SelfReferenceModel.md +docs/SingleRefType.md +docs/SpecialCharacterEnum.md +docs/SpecialModelName.md +docs/SpecialName.md +docs/StoreApi.md +docs/Tag.md +docs/TestInlineFreeformAdditionalPropertiesRequest.md +docs/Tiger.md +docs/User.md +docs/UserApi.md +docs/WithNestedOneOf.md +git_push.sh +petstore_api/__init__.py +petstore_api/api/__init__.py +petstore_api/api/another_fake_api.py +petstore_api/api/default_api.py +petstore_api/api/fake_api.py +petstore_api/api/fake_classname_tags123_api.py +petstore_api/api/pet_api.py +petstore_api/api/store_api.py +petstore_api/api/user_api.py +petstore_api/api_client.py +petstore_api/api_response.py +petstore_api/configuration.py +petstore_api/exceptions.py +petstore_api/models/__init__.py +petstore_api/models/additional_properties_any_type.py +petstore_api/models/additional_properties_class.py +petstore_api/models/additional_properties_object.py +petstore_api/models/additional_properties_with_description_only.py +petstore_api/models/all_of_with_single_ref.py +petstore_api/models/animal.py +petstore_api/models/any_of_color.py +petstore_api/models/any_of_pig.py +petstore_api/models/api_response.py +petstore_api/models/array_of_array_of_model.py +petstore_api/models/array_of_array_of_number_only.py +petstore_api/models/array_of_number_only.py +petstore_api/models/array_test.py +petstore_api/models/basque_pig.py +petstore_api/models/capitalization.py +petstore_api/models/cat.py +petstore_api/models/category.py +petstore_api/models/circular_reference_model.py +petstore_api/models/class_model.py +petstore_api/models/client.py +petstore_api/models/color.py +petstore_api/models/creature.py +petstore_api/models/creature_info.py +petstore_api/models/danish_pig.py +petstore_api/models/deprecated_object.py +petstore_api/models/dog.py +petstore_api/models/dummy_model.py +petstore_api/models/enum_arrays.py +petstore_api/models/enum_class.py +petstore_api/models/enum_string1.py +petstore_api/models/enum_string2.py +petstore_api/models/enum_test.py +petstore_api/models/file.py +petstore_api/models/file_schema_test_class.py +petstore_api/models/first_ref.py +petstore_api/models/foo.py +petstore_api/models/foo_get_default_response.py +petstore_api/models/format_test.py +petstore_api/models/has_only_read_only.py +petstore_api/models/health_check_result.py +petstore_api/models/inner_dict_with_property.py +petstore_api/models/int_or_string.py +petstore_api/models/list.py +petstore_api/models/map_of_array_of_model.py +petstore_api/models/map_test.py +petstore_api/models/mixed_properties_and_additional_properties_class.py +petstore_api/models/model200_response.py +petstore_api/models/model_return.py +petstore_api/models/name.py +petstore_api/models/nullable_class.py +petstore_api/models/nullable_property.py +petstore_api/models/number_only.py +petstore_api/models/object_to_test_additional_properties.py +petstore_api/models/object_with_deprecated_fields.py +petstore_api/models/one_of_enum_string.py +petstore_api/models/order.py +petstore_api/models/outer_composite.py +petstore_api/models/outer_enum.py +petstore_api/models/outer_enum_default_value.py +petstore_api/models/outer_enum_integer.py +petstore_api/models/outer_enum_integer_default_value.py +petstore_api/models/outer_object_with_enum_property.py +petstore_api/models/parent.py +petstore_api/models/parent_with_optional_dict.py +petstore_api/models/pet.py +petstore_api/models/pig.py +petstore_api/models/property_name_collision.py +petstore_api/models/read_only_first.py +petstore_api/models/second_ref.py +petstore_api/models/self_reference_model.py +petstore_api/models/single_ref_type.py +petstore_api/models/special_character_enum.py +petstore_api/models/special_model_name.py +petstore_api/models/special_name.py +petstore_api/models/tag.py +petstore_api/models/test_inline_freeform_additional_properties_request.py +petstore_api/models/tiger.py +petstore_api/models/user.py +petstore_api/models/with_nested_one_of.py +petstore_api/py.typed +petstore_api/rest.py +petstore_api/signing.py +pyproject.toml +requirements.txt +setup.cfg +setup.py +test-requirements.txt +test/__init__.py +tox.ini diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator/VERSION b/samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator/VERSION new file mode 100644 index 00000000000..40e36364ab2 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/.travis.yml b/samples/openapi3/client/petstore/python-pydantic-v1/.travis.yml new file mode 100644 index 00000000000..bb28138c5b1 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/.travis.yml @@ -0,0 +1,17 @@ +# ref: https://docs.travis-ci.com/user/languages/python +language: python +python: + - "3.7" + - "3.8" + - "3.9" + - "3.10" + - "3.11" + # uncomment the following if needed + #- "3.11-dev" # 3.11 development branch + #- "nightly" # nightly build +# command to install dependencies +install: + - "pip install -r requirements.txt" + - "pip install -r test-requirements.txt" +# command to run tests +script: pytest --cov=petstore_api diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/README.md b/samples/openapi3/client/petstore/python-pydantic-v1/README.md new file mode 100644 index 00000000000..c38079fcb5f --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/README.md @@ -0,0 +1,268 @@ +# petstore-api +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 1.0.0 +- Package version: 1.0.0 +- Build package: org.openapitools.codegen.languages.PythonClientPydanticV1Codegen + +## Requirements. + +Python 3.7+ + +## Installation & Usage +### pip install + +If the python package is hosted on a repository, you can install directly using: + +```sh +pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git +``` +(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`) + +Then import the package: +```python +import petstore_api +``` + +### Setuptools + +Install via [Setuptools](http://pypi.python.org/pypi/setuptools). + +```sh +python setup.py install --user +``` +(or `sudo python setup.py install` to install the package for all users) + +Then import the package: +```python +import petstore_api +``` + +### Tests + +Execute `pytest` to run the tests. + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```python +import datetime +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.AnotherFakeApi(api_client) + client = petstore_api.Client() # Client | client model + + try: + # To test special tags + api_response = api_instance.call_123_test_special_tags(client) + print("The response of AnotherFakeApi->call_123_test_special_tags:\n") + pprint(api_response) + except ApiException as e: + print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e) + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags +*DefaultApi* | [**foo_get**](docs/DefaultApi.md#foo_get) | **GET** /foo | +*FakeApi* | [**fake_any_type_request_body**](docs/FakeApi.md#fake_any_type_request_body) | **POST** /fake/any_type_body | test any type request body +*FakeApi* | [**fake_enum_ref_query_parameter**](docs/FakeApi.md#fake_enum_ref_query_parameter) | **GET** /fake/enum_ref_query_parameter | test enum reference query parameter +*FakeApi* | [**fake_health_get**](docs/FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint +*FakeApi* | [**fake_http_signature_test**](docs/FakeApi.md#fake_http_signature_test) | **GET** /fake/http-signature-test | test http signature authentication +*FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | +*FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | +*FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | +*FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | +*FakeApi* | [**fake_property_enum_integer_serialize**](docs/FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | +*FakeApi* | [**fake_return_list_of_objects**](docs/FakeApi.md#fake_return_list_of_objects) | **GET** /fake/return_list_of_object | test returning list of objects +*FakeApi* | [**fake_uuid_example**](docs/FakeApi.md#fake_uuid_example) | **GET** /fake/uuid_example | test uuid example +*FakeApi* | [**test_body_with_binary**](docs/FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | +*FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | +*FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | +*FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model +*FakeApi* | [**test_date_time_query_parameter**](docs/FakeApi.md#test_date_time_query_parameter) | **PUT** /fake/date-time-query-params | +*FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**test_group_parameters**](docs/FakeApi.md#test_group_parameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +*FakeApi* | [**test_inline_additional_properties**](docs/FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +*FakeApi* | [**test_inline_freeform_additional_properties**](docs/FakeApi.md#test_inline_freeform_additional_properties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties +*FakeApi* | [**test_json_form_data**](docs/FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeApi* | [**test_query_parameter_collection_format**](docs/FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters | +*FakeClassnameTags123Api* | [**test_classname**](docs/FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case +*PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet +*PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**upload_file_with_required_file**](docs/PetApi.md#upload_file_with_required_file) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +*StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +*StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{order_id} | Find purchase order by ID +*StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet +*UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user +*UserApi* | [**create_users_with_array_input**](docs/UserApi.md#create_users_with_array_input) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**create_users_with_list_input**](docs/UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**delete_user**](docs/UserApi.md#delete_user) | **DELETE** /user/{username} | Delete user +*UserApi* | [**get_user_by_name**](docs/UserApi.md#get_user_by_name) | **GET** /user/{username} | Get user by user name +*UserApi* | [**login_user**](docs/UserApi.md#login_user) | **GET** /user/login | Logs user into the system +*UserApi* | [**logout_user**](docs/UserApi.md#logout_user) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**update_user**](docs/UserApi.md#update_user) | **PUT** /user/{username} | Updated user + + +## Documentation For Models + + - [AdditionalPropertiesAnyType](docs/AdditionalPropertiesAnyType.md) + - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [AdditionalPropertiesObject](docs/AdditionalPropertiesObject.md) + - [AdditionalPropertiesWithDescriptionOnly](docs/AdditionalPropertiesWithDescriptionOnly.md) + - [AllOfWithSingleRef](docs/AllOfWithSingleRef.md) + - [Animal](docs/Animal.md) + - [AnyOfColor](docs/AnyOfColor.md) + - [AnyOfPig](docs/AnyOfPig.md) + - [ApiResponse](docs/ApiResponse.md) + - [ArrayOfArrayOfModel](docs/ArrayOfArrayOfModel.md) + - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) + - [ArrayTest](docs/ArrayTest.md) + - [BasquePig](docs/BasquePig.md) + - [Capitalization](docs/Capitalization.md) + - [Cat](docs/Cat.md) + - [Category](docs/Category.md) + - [CircularReferenceModel](docs/CircularReferenceModel.md) + - [ClassModel](docs/ClassModel.md) + - [Client](docs/Client.md) + - [Color](docs/Color.md) + - [Creature](docs/Creature.md) + - [CreatureInfo](docs/CreatureInfo.md) + - [DanishPig](docs/DanishPig.md) + - [DeprecatedObject](docs/DeprecatedObject.md) + - [Dog](docs/Dog.md) + - [DummyModel](docs/DummyModel.md) + - [EnumArrays](docs/EnumArrays.md) + - [EnumClass](docs/EnumClass.md) + - [EnumString1](docs/EnumString1.md) + - [EnumString2](docs/EnumString2.md) + - [EnumTest](docs/EnumTest.md) + - [File](docs/File.md) + - [FileSchemaTestClass](docs/FileSchemaTestClass.md) + - [FirstRef](docs/FirstRef.md) + - [Foo](docs/Foo.md) + - [FooGetDefaultResponse](docs/FooGetDefaultResponse.md) + - [FormatTest](docs/FormatTest.md) + - [HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [HealthCheckResult](docs/HealthCheckResult.md) + - [InnerDictWithProperty](docs/InnerDictWithProperty.md) + - [IntOrString](docs/IntOrString.md) + - [List](docs/List.md) + - [MapOfArrayOfModel](docs/MapOfArrayOfModel.md) + - [MapTest](docs/MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](docs/Model200Response.md) + - [ModelReturn](docs/ModelReturn.md) + - [Name](docs/Name.md) + - [NullableClass](docs/NullableClass.md) + - [NullableProperty](docs/NullableProperty.md) + - [NumberOnly](docs/NumberOnly.md) + - [ObjectToTestAdditionalProperties](docs/ObjectToTestAdditionalProperties.md) + - [ObjectWithDeprecatedFields](docs/ObjectWithDeprecatedFields.md) + - [OneOfEnumString](docs/OneOfEnumString.md) + - [Order](docs/Order.md) + - [OuterComposite](docs/OuterComposite.md) + - [OuterEnum](docs/OuterEnum.md) + - [OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md) + - [OuterEnumInteger](docs/OuterEnumInteger.md) + - [OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md) + - [OuterObjectWithEnumProperty](docs/OuterObjectWithEnumProperty.md) + - [Parent](docs/Parent.md) + - [ParentWithOptionalDict](docs/ParentWithOptionalDict.md) + - [Pet](docs/Pet.md) + - [Pig](docs/Pig.md) + - [PropertyNameCollision](docs/PropertyNameCollision.md) + - [ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [SecondRef](docs/SecondRef.md) + - [SelfReferenceModel](docs/SelfReferenceModel.md) + - [SingleRefType](docs/SingleRefType.md) + - [SpecialCharacterEnum](docs/SpecialCharacterEnum.md) + - [SpecialModelName](docs/SpecialModelName.md) + - [SpecialName](docs/SpecialName.md) + - [Tag](docs/Tag.md) + - [TestInlineFreeformAdditionalPropertiesRequest](docs/TestInlineFreeformAdditionalPropertiesRequest.md) + - [Tiger](docs/Tiger.md) + - [User](docs/User.md) + - [WithNestedOneOf](docs/WithNestedOneOf.md) + + + +## Documentation For Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - **write:pets**: modify pets in your account + - **read:pets**: read your pets + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +### api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + + +### http_basic_test + +- **Type**: HTTP basic authentication + + +### bearer_test + +- **Type**: Bearer authentication (JWT) + + +### http_signature_test + +- **Type**: HTTP signature authentication + + +## Author + + + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/AdditionalPropertiesAnyType.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/AdditionalPropertiesAnyType.md new file mode 100644 index 00000000000..beedef76c05 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/AdditionalPropertiesAnyType.md @@ -0,0 +1,28 @@ +# AdditionalPropertiesAnyType + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType + +# TODO update the JSON string below +json = "{}" +# create an instance of AdditionalPropertiesAnyType from a JSON string +additional_properties_any_type_instance = AdditionalPropertiesAnyType.from_json(json) +# print the JSON string representation of the object +print AdditionalPropertiesAnyType.to_json() + +# convert the object into a dict +additional_properties_any_type_dict = additional_properties_any_type_instance.to_dict() +# create an instance of AdditionalPropertiesAnyType from a dict +additional_properties_any_type_form_dict = additional_properties_any_type.from_dict(additional_properties_any_type_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/AdditionalPropertiesClass.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/AdditionalPropertiesClass.md new file mode 100644 index 00000000000..6abc3136b9c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/AdditionalPropertiesClass.md @@ -0,0 +1,29 @@ +# AdditionalPropertiesClass + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**map_property** | **Dict[str, str]** | | [optional] +**map_of_map_property** | **Dict[str, Dict[str, str]]** | | [optional] + +## Example + +```python +from petstore_api.models.additional_properties_class import AdditionalPropertiesClass + +# TODO update the JSON string below +json = "{}" +# create an instance of AdditionalPropertiesClass from a JSON string +additional_properties_class_instance = AdditionalPropertiesClass.from_json(json) +# print the JSON string representation of the object +print AdditionalPropertiesClass.to_json() + +# convert the object into a dict +additional_properties_class_dict = additional_properties_class_instance.to_dict() +# create an instance of AdditionalPropertiesClass from a dict +additional_properties_class_form_dict = additional_properties_class.from_dict(additional_properties_class_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/AdditionalPropertiesObject.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/AdditionalPropertiesObject.md new file mode 100644 index 00000000000..8b9259c687f --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/AdditionalPropertiesObject.md @@ -0,0 +1,28 @@ +# AdditionalPropertiesObject + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.additional_properties_object import AdditionalPropertiesObject + +# TODO update the JSON string below +json = "{}" +# create an instance of AdditionalPropertiesObject from a JSON string +additional_properties_object_instance = AdditionalPropertiesObject.from_json(json) +# print the JSON string representation of the object +print AdditionalPropertiesObject.to_json() + +# convert the object into a dict +additional_properties_object_dict = additional_properties_object_instance.to_dict() +# create an instance of AdditionalPropertiesObject from a dict +additional_properties_object_form_dict = additional_properties_object.from_dict(additional_properties_object_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/AdditionalPropertiesWithDescriptionOnly.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/AdditionalPropertiesWithDescriptionOnly.md new file mode 100644 index 00000000000..d66094f18e5 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/AdditionalPropertiesWithDescriptionOnly.md @@ -0,0 +1,28 @@ +# AdditionalPropertiesWithDescriptionOnly + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.additional_properties_with_description_only import AdditionalPropertiesWithDescriptionOnly + +# TODO update the JSON string below +json = "{}" +# create an instance of AdditionalPropertiesWithDescriptionOnly from a JSON string +additional_properties_with_description_only_instance = AdditionalPropertiesWithDescriptionOnly.from_json(json) +# print the JSON string representation of the object +print AdditionalPropertiesWithDescriptionOnly.to_json() + +# convert the object into a dict +additional_properties_with_description_only_dict = additional_properties_with_description_only_instance.to_dict() +# create an instance of AdditionalPropertiesWithDescriptionOnly from a dict +additional_properties_with_description_only_form_dict = additional_properties_with_description_only.from_dict(additional_properties_with_description_only_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/AllOfWithSingleRef.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/AllOfWithSingleRef.md new file mode 100644 index 00000000000..1a8b4df7ecc --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/AllOfWithSingleRef.md @@ -0,0 +1,29 @@ +# AllOfWithSingleRef + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**username** | **str** | | [optional] +**single_ref_type** | [**SingleRefType**](SingleRefType.md) | | [optional] + +## Example + +```python +from petstore_api.models.all_of_with_single_ref import AllOfWithSingleRef + +# TODO update the JSON string below +json = "{}" +# create an instance of AllOfWithSingleRef from a JSON string +all_of_with_single_ref_instance = AllOfWithSingleRef.from_json(json) +# print the JSON string representation of the object +print AllOfWithSingleRef.to_json() + +# convert the object into a dict +all_of_with_single_ref_dict = all_of_with_single_ref_instance.to_dict() +# create an instance of AllOfWithSingleRef from a dict +all_of_with_single_ref_form_dict = all_of_with_single_ref.from_dict(all_of_with_single_ref_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/Animal.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Animal.md new file mode 100644 index 00000000000..b62f1969099 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Animal.md @@ -0,0 +1,29 @@ +# Animal + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_name** | **str** | | +**color** | **str** | | [optional] [default to 'red'] + +## Example + +```python +from petstore_api.models.animal import Animal + +# TODO update the JSON string below +json = "{}" +# create an instance of Animal from a JSON string +animal_instance = Animal.from_json(json) +# print the JSON string representation of the object +print Animal.to_json() + +# convert the object into a dict +animal_dict = animal_instance.to_dict() +# create an instance of Animal from a dict +animal_form_dict = animal.from_dict(animal_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/AnotherFakeApi.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/AnotherFakeApi.md new file mode 100644 index 00000000000..d3103c7d369 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/AnotherFakeApi.md @@ -0,0 +1,76 @@ +# petstore_api.AnotherFakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**call_123_test_special_tags**](AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags + + +# **call_123_test_special_tags** +> Client call_123_test_special_tags(client) + +To test special tags + +To test special tags and operation ID starting with number + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.client import Client +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.AnotherFakeApi(api_client) + client = petstore_api.Client() # Client | client model + + try: + # To test special tags + api_response = api_instance.call_123_test_special_tags(client) + print("The response of AnotherFakeApi->call_123_test_special_tags:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **client** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/AnyOfColor.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/AnyOfColor.md new file mode 100644 index 00000000000..9b161ccba1c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/AnyOfColor.md @@ -0,0 +1,28 @@ +# AnyOfColor + +Any of RGB array, RGBA array, or hex string. + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Example + +```python +from petstore_api.models.any_of_color import AnyOfColor + +# TODO update the JSON string below +json = "{}" +# create an instance of AnyOfColor from a JSON string +any_of_color_instance = AnyOfColor.from_json(json) +# print the JSON string representation of the object +print AnyOfColor.to_json() + +# convert the object into a dict +any_of_color_dict = any_of_color_instance.to_dict() +# create an instance of AnyOfColor from a dict +any_of_color_form_dict = any_of_color.from_dict(any_of_color_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/AnyOfPig.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/AnyOfPig.md new file mode 100644 index 00000000000..2da7ca6eefe --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/AnyOfPig.md @@ -0,0 +1,30 @@ +# AnyOfPig + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_name** | **str** | | +**color** | **str** | | +**size** | **int** | | + +## Example + +```python +from petstore_api.models.any_of_pig import AnyOfPig + +# TODO update the JSON string below +json = "{}" +# create an instance of AnyOfPig from a JSON string +any_of_pig_instance = AnyOfPig.from_json(json) +# print the JSON string representation of the object +print AnyOfPig.to_json() + +# convert the object into a dict +any_of_pig_dict = any_of_pig_instance.to_dict() +# create an instance of AnyOfPig from a dict +any_of_pig_form_dict = any_of_pig.from_dict(any_of_pig_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/ApiResponse.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ApiResponse.md new file mode 100644 index 00000000000..ba35ea9e2f0 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ApiResponse.md @@ -0,0 +1,30 @@ +# ApiResponse + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | [optional] +**type** | **str** | | [optional] +**message** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.api_response import ApiResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of ApiResponse from a JSON string +api_response_instance = ApiResponse.from_json(json) +# print the JSON string representation of the object +print ApiResponse.to_json() + +# convert the object into a dict +api_response_dict = api_response_instance.to_dict() +# create an instance of ApiResponse from a dict +api_response_form_dict = api_response.from_dict(api_response_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/ArrayOfArrayOfModel.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ArrayOfArrayOfModel.md new file mode 100644 index 00000000000..09406159261 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ArrayOfArrayOfModel.md @@ -0,0 +1,28 @@ +# ArrayOfArrayOfModel + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**another_property** | **List[List[Tag]]** | | [optional] + +## Example + +```python +from petstore_api.models.array_of_array_of_model import ArrayOfArrayOfModel + +# TODO update the JSON string below +json = "{}" +# create an instance of ArrayOfArrayOfModel from a JSON string +array_of_array_of_model_instance = ArrayOfArrayOfModel.from_json(json) +# print the JSON string representation of the object +print ArrayOfArrayOfModel.to_json() + +# convert the object into a dict +array_of_array_of_model_dict = array_of_array_of_model_instance.to_dict() +# create an instance of ArrayOfArrayOfModel from a dict +array_of_array_of_model_form_dict = array_of_array_of_model.from_dict(array_of_array_of_model_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/ArrayOfArrayOfNumberOnly.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 00000000000..3f0c127d4fa --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,28 @@ +# ArrayOfArrayOfNumberOnly + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**array_array_number** | **List[List[float]]** | | [optional] + +## Example + +```python +from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly + +# TODO update the JSON string below +json = "{}" +# create an instance of ArrayOfArrayOfNumberOnly from a JSON string +array_of_array_of_number_only_instance = ArrayOfArrayOfNumberOnly.from_json(json) +# print the JSON string representation of the object +print ArrayOfArrayOfNumberOnly.to_json() + +# convert the object into a dict +array_of_array_of_number_only_dict = array_of_array_of_number_only_instance.to_dict() +# create an instance of ArrayOfArrayOfNumberOnly from a dict +array_of_array_of_number_only_form_dict = array_of_array_of_number_only.from_dict(array_of_array_of_number_only_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/ArrayOfNumberOnly.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ArrayOfNumberOnly.md new file mode 100644 index 00000000000..c10191915a7 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ArrayOfNumberOnly.md @@ -0,0 +1,28 @@ +# ArrayOfNumberOnly + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**array_number** | **List[float]** | | [optional] + +## Example + +```python +from petstore_api.models.array_of_number_only import ArrayOfNumberOnly + +# TODO update the JSON string below +json = "{}" +# create an instance of ArrayOfNumberOnly from a JSON string +array_of_number_only_instance = ArrayOfNumberOnly.from_json(json) +# print the JSON string representation of the object +print ArrayOfNumberOnly.to_json() + +# convert the object into a dict +array_of_number_only_dict = array_of_number_only_instance.to_dict() +# create an instance of ArrayOfNumberOnly from a dict +array_of_number_only_form_dict = array_of_number_only.from_dict(array_of_number_only_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/ArrayTest.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ArrayTest.md new file mode 100644 index 00000000000..0a40fb36d26 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ArrayTest.md @@ -0,0 +1,30 @@ +# ArrayTest + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**array_of_string** | **List[str]** | | [optional] +**array_array_of_integer** | **List[List[int]]** | | [optional] +**array_array_of_model** | **List[List[ReadOnlyFirst]]** | | [optional] + +## Example + +```python +from petstore_api.models.array_test import ArrayTest + +# TODO update the JSON string below +json = "{}" +# create an instance of ArrayTest from a JSON string +array_test_instance = ArrayTest.from_json(json) +# print the JSON string representation of the object +print ArrayTest.to_json() + +# convert the object into a dict +array_test_dict = array_test_instance.to_dict() +# create an instance of ArrayTest from a dict +array_test_form_dict = array_test.from_dict(array_test_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/BasquePig.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/BasquePig.md new file mode 100644 index 00000000000..552b9390c7e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/BasquePig.md @@ -0,0 +1,29 @@ +# BasquePig + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_name** | **str** | | +**color** | **str** | | + +## Example + +```python +from petstore_api.models.basque_pig import BasquePig + +# TODO update the JSON string below +json = "{}" +# create an instance of BasquePig from a JSON string +basque_pig_instance = BasquePig.from_json(json) +# print the JSON string representation of the object +print BasquePig.to_json() + +# convert the object into a dict +basque_pig_dict = basque_pig_instance.to_dict() +# create an instance of BasquePig from a dict +basque_pig_form_dict = basque_pig.from_dict(basque_pig_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/Capitalization.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Capitalization.md new file mode 100644 index 00000000000..99e6fae88fd --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Capitalization.md @@ -0,0 +1,33 @@ +# Capitalization + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**small_camel** | **str** | | [optional] +**capital_camel** | **str** | | [optional] +**small_snake** | **str** | | [optional] +**capital_snake** | **str** | | [optional] +**sca_eth_flow_points** | **str** | | [optional] +**att_name** | **str** | Name of the pet | [optional] + +## Example + +```python +from petstore_api.models.capitalization import Capitalization + +# TODO update the JSON string below +json = "{}" +# create an instance of Capitalization from a JSON string +capitalization_instance = Capitalization.from_json(json) +# print the JSON string representation of the object +print Capitalization.to_json() + +# convert the object into a dict +capitalization_dict = capitalization_instance.to_dict() +# create an instance of Capitalization from a dict +capitalization_form_dict = capitalization.from_dict(capitalization_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/Cat.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Cat.md new file mode 100644 index 00000000000..4b509dda7ea --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Cat.md @@ -0,0 +1,28 @@ +# Cat + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | **bool** | | [optional] + +## Example + +```python +from petstore_api.models.cat import Cat + +# TODO update the JSON string below +json = "{}" +# create an instance of Cat from a JSON string +cat_instance = Cat.from_json(json) +# print the JSON string representation of the object +print Cat.to_json() + +# convert the object into a dict +cat_dict = cat_instance.to_dict() +# create an instance of Cat from a dict +cat_form_dict = cat.from_dict(cat_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/Category.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Category.md new file mode 100644 index 00000000000..c49514ef802 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Category.md @@ -0,0 +1,29 @@ +# Category + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **str** | | [default to 'default-name'] + +## Example + +```python +from petstore_api.models.category import Category + +# TODO update the JSON string below +json = "{}" +# create an instance of Category from a JSON string +category_instance = Category.from_json(json) +# print the JSON string representation of the object +print Category.to_json() + +# convert the object into a dict +category_dict = category_instance.to_dict() +# create an instance of Category from a dict +category_form_dict = category.from_dict(category_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/CircularReferenceModel.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/CircularReferenceModel.md new file mode 100644 index 00000000000..d5e97934d2b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/CircularReferenceModel.md @@ -0,0 +1,29 @@ +# CircularReferenceModel + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | **int** | | [optional] +**nested** | [**FirstRef**](FirstRef.md) | | [optional] + +## Example + +```python +from petstore_api.models.circular_reference_model import CircularReferenceModel + +# TODO update the JSON string below +json = "{}" +# create an instance of CircularReferenceModel from a JSON string +circular_reference_model_instance = CircularReferenceModel.from_json(json) +# print the JSON string representation of the object +print CircularReferenceModel.to_json() + +# convert the object into a dict +circular_reference_model_dict = circular_reference_model_instance.to_dict() +# create an instance of CircularReferenceModel from a dict +circular_reference_model_form_dict = circular_reference_model.from_dict(circular_reference_model_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/ClassModel.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ClassModel.md new file mode 100644 index 00000000000..1b6fb7cfc77 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ClassModel.md @@ -0,0 +1,29 @@ +# ClassModel + +Model for testing model with \"_class\" property + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_class** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.class_model import ClassModel + +# TODO update the JSON string below +json = "{}" +# create an instance of ClassModel from a JSON string +class_model_instance = ClassModel.from_json(json) +# print the JSON string representation of the object +print ClassModel.to_json() + +# convert the object into a dict +class_model_dict = class_model_instance.to_dict() +# create an instance of ClassModel from a dict +class_model_form_dict = class_model.from_dict(class_model_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/Client.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Client.md new file mode 100644 index 00000000000..b0ded10dd76 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Client.md @@ -0,0 +1,28 @@ +# Client + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**client** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.client import Client + +# TODO update the JSON string below +json = "{}" +# create an instance of Client from a JSON string +client_instance = Client.from_json(json) +# print the JSON string representation of the object +print Client.to_json() + +# convert the object into a dict +client_dict = client_instance.to_dict() +# create an instance of Client from a dict +client_form_dict = client.from_dict(client_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/Color.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Color.md new file mode 100644 index 00000000000..07fcd01991a --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Color.md @@ -0,0 +1,28 @@ +# Color + +RGB array, RGBA array, or hex string. + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Example + +```python +from petstore_api.models.color import Color + +# TODO update the JSON string below +json = "{}" +# create an instance of Color from a JSON string +color_instance = Color.from_json(json) +# print the JSON string representation of the object +print Color.to_json() + +# convert the object into a dict +color_dict = color_instance.to_dict() +# create an instance of Color from a dict +color_form_dict = color.from_dict(color_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/Creature.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Creature.md new file mode 100644 index 00000000000..54249d5871e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Creature.md @@ -0,0 +1,29 @@ +# Creature + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**info** | [**CreatureInfo**](CreatureInfo.md) | | +**type** | **str** | | + +## Example + +```python +from petstore_api.models.creature import Creature + +# TODO update the JSON string below +json = "{}" +# create an instance of Creature from a JSON string +creature_instance = Creature.from_json(json) +# print the JSON string representation of the object +print Creature.to_json() + +# convert the object into a dict +creature_dict = creature_instance.to_dict() +# create an instance of Creature from a dict +creature_form_dict = creature.from_dict(creature_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/CreatureInfo.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/CreatureInfo.md new file mode 100644 index 00000000000..5a600b9f337 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/CreatureInfo.md @@ -0,0 +1,28 @@ +# CreatureInfo + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | + +## Example + +```python +from petstore_api.models.creature_info import CreatureInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of CreatureInfo from a JSON string +creature_info_instance = CreatureInfo.from_json(json) +# print the JSON string representation of the object +print CreatureInfo.to_json() + +# convert the object into a dict +creature_info_dict = creature_info_instance.to_dict() +# create an instance of CreatureInfo from a dict +creature_info_form_dict = creature_info.from_dict(creature_info_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/DanishPig.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/DanishPig.md new file mode 100644 index 00000000000..253616c2fc3 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/DanishPig.md @@ -0,0 +1,29 @@ +# DanishPig + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_name** | **str** | | +**size** | **int** | | + +## Example + +```python +from petstore_api.models.danish_pig import DanishPig + +# TODO update the JSON string below +json = "{}" +# create an instance of DanishPig from a JSON string +danish_pig_instance = DanishPig.from_json(json) +# print the JSON string representation of the object +print DanishPig.to_json() + +# convert the object into a dict +danish_pig_dict = danish_pig_instance.to_dict() +# create an instance of DanishPig from a dict +danish_pig_form_dict = danish_pig.from_dict(danish_pig_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/DefaultApi.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/DefaultApi.md new file mode 100644 index 00000000000..a5c2b671f34 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/DefaultApi.md @@ -0,0 +1,69 @@ +# petstore_api.DefaultApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**foo_get**](DefaultApi.md#foo_get) | **GET** /foo | + + +# **foo_get** +> FooGetDefaultResponse foo_get() + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.foo_get_default_response import FooGetDefaultResponse +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.DefaultApi(api_client) + + try: + api_response = api_instance.foo_get() + print("The response of DefaultApi->foo_get:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling DefaultApi->foo_get: %s\n" % e) +``` + + + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**FooGetDefaultResponse**](FooGetDefaultResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**0** | response | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/DeprecatedObject.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/DeprecatedObject.md new file mode 100644 index 00000000000..e6cf5718963 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/DeprecatedObject.md @@ -0,0 +1,28 @@ +# DeprecatedObject + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.deprecated_object import DeprecatedObject + +# TODO update the JSON string below +json = "{}" +# create an instance of DeprecatedObject from a JSON string +deprecated_object_instance = DeprecatedObject.from_json(json) +# print the JSON string representation of the object +print DeprecatedObject.to_json() + +# convert the object into a dict +deprecated_object_dict = deprecated_object_instance.to_dict() +# create an instance of DeprecatedObject from a dict +deprecated_object_form_dict = deprecated_object.from_dict(deprecated_object_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/Dog.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Dog.md new file mode 100644 index 00000000000..3469be73a76 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Dog.md @@ -0,0 +1,28 @@ +# Dog + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.dog import Dog + +# TODO update the JSON string below +json = "{}" +# create an instance of Dog from a JSON string +dog_instance = Dog.from_json(json) +# print the JSON string representation of the object +print Dog.to_json() + +# convert the object into a dict +dog_dict = dog_instance.to_dict() +# create an instance of Dog from a dict +dog_form_dict = dog.from_dict(dog_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/DummyModel.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/DummyModel.md new file mode 100644 index 00000000000..e690a8874f8 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/DummyModel.md @@ -0,0 +1,29 @@ +# DummyModel + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**category** | **str** | | [optional] +**self_ref** | [**SelfReferenceModel**](SelfReferenceModel.md) | | [optional] + +## Example + +```python +from petstore_api.models.dummy_model import DummyModel + +# TODO update the JSON string below +json = "{}" +# create an instance of DummyModel from a JSON string +dummy_model_instance = DummyModel.from_json(json) +# print the JSON string representation of the object +print DummyModel.to_json() + +# convert the object into a dict +dummy_model_dict = dummy_model_instance.to_dict() +# create an instance of DummyModel from a dict +dummy_model_form_dict = dummy_model.from_dict(dummy_model_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumArrays.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumArrays.md new file mode 100644 index 00000000000..d21f58a6608 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumArrays.md @@ -0,0 +1,29 @@ +# EnumArrays + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**just_symbol** | **str** | | [optional] +**array_enum** | **List[str]** | | [optional] + +## Example + +```python +from petstore_api.models.enum_arrays import EnumArrays + +# TODO update the JSON string below +json = "{}" +# create an instance of EnumArrays from a JSON string +enum_arrays_instance = EnumArrays.from_json(json) +# print the JSON string representation of the object +print EnumArrays.to_json() + +# convert the object into a dict +enum_arrays_dict = enum_arrays_instance.to_dict() +# create an instance of EnumArrays from a dict +enum_arrays_form_dict = enum_arrays.from_dict(enum_arrays_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumClass.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumClass.md new file mode 100644 index 00000000000..64830e3d1de --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumClass.md @@ -0,0 +1,10 @@ +# EnumClass + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumString1.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumString1.md new file mode 100644 index 00000000000..194d65b48fa --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumString1.md @@ -0,0 +1,10 @@ +# EnumString1 + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumString2.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumString2.md new file mode 100644 index 00000000000..0d8568bfbef --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumString2.md @@ -0,0 +1,10 @@ +# EnumString2 + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumTest.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumTest.md new file mode 100644 index 00000000000..5bcb8e7027e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/EnumTest.md @@ -0,0 +1,36 @@ +# 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] +**outer_enum** | [**OuterEnum**](OuterEnum.md) | | [optional] +**outer_enum_integer** | [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional] +**outer_enum_default_value** | [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] +**outer_enum_integer_default_value** | [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional] + +## Example + +```python +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_form_dict = enum_test.from_dict(enum_test_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/FakeApi.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/FakeApi.md new file mode 100644 index 00000000000..5bd0489ae55 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/FakeApi.md @@ -0,0 +1,1579 @@ +# petstore_api.FakeApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fake_any_type_request_body**](FakeApi.md#fake_any_type_request_body) | **POST** /fake/any_type_body | test any type request body +[**fake_enum_ref_query_parameter**](FakeApi.md#fake_enum_ref_query_parameter) | **GET** /fake/enum_ref_query_parameter | test enum reference query parameter +[**fake_health_get**](FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint +[**fake_http_signature_test**](FakeApi.md#fake_http_signature_test) | **GET** /fake/http-signature-test | test http signature authentication +[**fake_outer_boolean_serialize**](FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | +[**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | +[**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | +[**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | +[**fake_property_enum_integer_serialize**](FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | +[**fake_return_list_of_objects**](FakeApi.md#fake_return_list_of_objects) | **GET** /fake/return_list_of_object | test returning list of objects +[**fake_uuid_example**](FakeApi.md#fake_uuid_example) | **GET** /fake/uuid_example | test uuid example +[**test_body_with_binary**](FakeApi.md#test_body_with_binary) | **PUT** /fake/body-with-binary | +[**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | +[**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | +[**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model +[**test_date_time_query_parameter**](FakeApi.md#test_date_time_query_parameter) | **PUT** /fake/date-time-query-params | +[**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**test_group_parameters**](FakeApi.md#test_group_parameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +[**test_inline_additional_properties**](FakeApi.md#test_inline_additional_properties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +[**test_inline_freeform_additional_properties**](FakeApi.md#test_inline_freeform_additional_properties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties +[**test_json_form_data**](FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data +[**test_query_parameter_collection_format**](FakeApi.md#test_query_parameter_collection_format) | **PUT** /fake/test-query-parameters | + + +# **fake_any_type_request_body** +> fake_any_type_request_body(body=body) + +test any type request body + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + body = None # object | (optional) + + try: + # test any type request body + api_instance.fake_any_type_request_body(body=body) + except Exception as e: + print("Exception when calling FakeApi->fake_any_type_request_body: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **object**| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_enum_ref_query_parameter** +> fake_enum_ref_query_parameter(enum_ref=enum_ref) + +test enum reference query parameter + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.enum_class import EnumClass +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + enum_ref = petstore_api.EnumClass() # EnumClass | enum reference (optional) + + try: + # test enum reference query parameter + api_instance.fake_enum_ref_query_parameter(enum_ref=enum_ref) + except Exception as e: + print("Exception when calling FakeApi->fake_enum_ref_query_parameter: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enum_ref** | [**EnumClass**](.md)| enum reference | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get successful | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_health_get** +> HealthCheckResult fake_health_get() + +Health check endpoint + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.health_check_result import HealthCheckResult +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + + try: + # Health check endpoint + api_response = api_instance.fake_health_get() + print("The response of FakeApi->fake_health_get:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FakeApi->fake_health_get: %s\n" % e) +``` + + + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**HealthCheckResult**](HealthCheckResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The instance started successfully | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_http_signature_test** +> fake_http_signature_test(pet, query_1=query_1, header_1=header_1) + +test http signature authentication + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.pet import Pet +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure HTTP message signature: http_signature_test +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See petstore_api.signing for a list of all supported parameters. +from petstore_api import signing +import datetime + +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + signing_info = petstore_api.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, + signed_headers = [ + petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store + query_1 = 'query_1_example' # str | query parameter (optional) + header_1 = 'header_1_example' # str | header parameter (optional) + + try: + # test http signature authentication + api_instance.fake_http_signature_test(pet, query_1=query_1, header_1=header_1) + except Exception as e: + print("Exception when calling FakeApi->fake_http_signature_test: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **query_1** | **str**| query parameter | [optional] + **header_1** | **str**| header parameter | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[http_signature_test](../README.md#http_signature_test) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | The instance started successfully | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_outer_boolean_serialize** +> bool fake_outer_boolean_serialize(body=body) + + + +Test serialization of outer boolean types + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + body = True # bool | Input boolean as post body (optional) + + try: + api_response = api_instance.fake_outer_boolean_serialize(body=body) + print("The response of FakeApi->fake_outer_boolean_serialize:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FakeApi->fake_outer_boolean_serialize: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **bool**| Input boolean as post body | [optional] + +### Return type + +**bool** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Output boolean | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_outer_composite_serialize** +> OuterComposite fake_outer_composite_serialize(outer_composite=outer_composite) + + + +Test serialization of object with outer number type + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.outer_composite import OuterComposite +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + outer_composite = petstore_api.OuterComposite() # OuterComposite | Input composite as post body (optional) + + try: + api_response = api_instance.fake_outer_composite_serialize(outer_composite=outer_composite) + print("The response of FakeApi->fake_outer_composite_serialize:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FakeApi->fake_outer_composite_serialize: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **outer_composite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Output composite | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_outer_number_serialize** +> float fake_outer_number_serialize(body=body) + + + +Test serialization of outer number types + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + body = 3.4 # float | Input number as post body (optional) + + try: + api_response = api_instance.fake_outer_number_serialize(body=body) + print("The response of FakeApi->fake_outer_number_serialize:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FakeApi->fake_outer_number_serialize: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **float**| Input number as post body | [optional] + +### Return type + +**float** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Output number | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_outer_string_serialize** +> str fake_outer_string_serialize(body=body) + + + +Test serialization of outer string types + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + body = 'body_example' # str | Input string as post body (optional) + + try: + api_response = api_instance.fake_outer_string_serialize(body=body) + print("The response of FakeApi->fake_outer_string_serialize:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FakeApi->fake_outer_string_serialize: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **str**| Input string as post body | [optional] + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Output string | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_property_enum_integer_serialize** +> OuterObjectWithEnumProperty fake_property_enum_integer_serialize(outer_object_with_enum_property) + + + +Test serialization of enum (int) properties with examples + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + outer_object_with_enum_property = petstore_api.OuterObjectWithEnumProperty() # OuterObjectWithEnumProperty | Input enum (int) as post body + + try: + api_response = api_instance.fake_property_enum_integer_serialize(outer_object_with_enum_property) + print("The response of FakeApi->fake_property_enum_integer_serialize:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FakeApi->fake_property_enum_integer_serialize: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **outer_object_with_enum_property** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)| Input enum (int) as post body | + +### Return type + +[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Output enum (int) | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_return_list_of_objects** +> List[List[Tag]] fake_return_list_of_objects() + +test returning list of objects + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.tag import Tag +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + + try: + # test returning list of objects + api_response = api_instance.fake_return_list_of_objects() + print("The response of FakeApi->fake_return_list_of_objects:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FakeApi->fake_return_list_of_objects: %s\n" % e) +``` + + + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**List[List[Tag]]** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_uuid_example** +> fake_uuid_example(uuid_example) + +test uuid example + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + uuid_example = '84529ad2-2265-4e15-b76b-c17025d848f6' # str | uuid example + + try: + # test uuid example + api_instance.fake_uuid_example(uuid_example) + except Exception as e: + print("Exception when calling FakeApi->fake_uuid_example: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **uuid_example** | **str**| uuid example | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Get successful | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_body_with_binary** +> test_body_with_binary(body) + + + +For this test, the body has to be a binary file. + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + body = None # bytearray | image to upload + + try: + api_instance.test_body_with_binary(body) + except Exception as e: + print("Exception when calling FakeApi->test_body_with_binary: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **bytearray**| image to upload | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: image/png + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_body_with_file_schema** +> test_body_with_file_schema(file_schema_test_class) + + + +For this test, the body for this request must reference a schema named `File`. + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.file_schema_test_class import FileSchemaTestClass +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + file_schema_test_class = petstore_api.FileSchemaTestClass() # FileSchemaTestClass | + + try: + api_instance.test_body_with_file_schema(file_schema_test_class) + except Exception as e: + print("Exception when calling FakeApi->test_body_with_file_schema: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **file_schema_test_class** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_body_with_query_params** +> test_body_with_query_params(query, user) + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.user import User +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + query = 'query_example' # str | + user = petstore_api.User() # User | + + try: + api_instance.test_body_with_query_params(query, user) + except Exception as e: + print("Exception when calling FakeApi->test_body_with_query_params: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query** | **str**| | + **user** | [**User**](User.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_client_model** +> Client test_client_model(client) + +To test \"client\" model + +To test \"client\" model + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.client import Client +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + client = petstore_api.Client() # Client | client model + + try: + # To test \"client\" model + api_response = api_instance.test_client_model(client) + print("The response of FakeApi->test_client_model:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FakeApi->test_client_model: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **client** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_date_time_query_parameter** +> test_date_time_query_parameter(date_time_query, str_query) + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + date_time_query = '2013-10-20T19:20:30+01:00' # datetime | + str_query = 'str_query_example' # str | + + try: + api_instance.test_date_time_query_parameter(date_time_query, str_query) + except Exception as e: + print("Exception when calling FakeApi->test_date_time_query_parameter: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **date_time_query** | **datetime**| | + **str_query** | **str**| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_endpoint_parameters** +> test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, byte_with_max_length=byte_with_max_length, var_date=var_date, date_time=date_time, password=password, param_callback=param_callback) + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example + +* Basic Authentication (http_basic_test): +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure HTTP basic authorization: http_basic_test +configuration = petstore_api.Configuration( + username = os.environ["USERNAME"], + password = os.environ["PASSWORD"] +) + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + number = 3.4 # float | None + double = 3.4 # float | None + pattern_without_delimiter = 'pattern_without_delimiter_example' # str | None + byte = None # bytearray | None + integer = 56 # int | None (optional) + int32 = 56 # int | None (optional) + int64 = 56 # int | None (optional) + float = 3.4 # float | None (optional) + string = 'string_example' # str | None (optional) + binary = None # bytearray | None (optional) + byte_with_max_length = None # bytearray | None (optional) + var_date = '2013-10-20' # date | None (optional) + date_time = '2013-10-20T19:20:30+01:00' # datetime | None (optional) + password = 'password_example' # str | None (optional) + param_callback = 'param_callback_example' # str | None (optional) + + try: + # Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + api_instance.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer=integer, int32=int32, int64=int64, float=float, string=string, binary=binary, byte_with_max_length=byte_with_max_length, var_date=var_date, date_time=date_time, password=password, param_callback=param_callback) + except Exception as e: + print("Exception when calling FakeApi->test_endpoint_parameters: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **float**| None | + **double** | **float**| None | + **pattern_without_delimiter** | **str**| None | + **byte** | **bytearray**| None | + **integer** | **int**| None | [optional] + **int32** | **int**| None | [optional] + **int64** | **int**| None | [optional] + **float** | **float**| None | [optional] + **string** | **str**| None | [optional] + **binary** | **bytearray**| None | [optional] + **byte_with_max_length** | **bytearray**| None | [optional] + **var_date** | **date**| None | [optional] + **date_time** | **datetime**| None | [optional] + **password** | **str**| None | [optional] + **param_callback** | **str**| None | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[http_basic_test](../README.md#http_basic_test) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**400** | Invalid username supplied | - | +**404** | User not found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_group_parameters** +> test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group) + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example + +* Bearer (JWT) Authentication (bearer_test): +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization (JWT): bearer_test +configuration = petstore_api.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + required_string_group = 56 # int | Required String in group parameters + required_boolean_group = True # bool | Required Boolean in group parameters + required_int64_group = 56 # int | Required Integer in group parameters + string_group = 56 # int | String in group parameters (optional) + boolean_group = True # bool | Boolean in group parameters (optional) + int64_group = 56 # int | Integer in group parameters (optional) + + try: + # Fake endpoint to test group parameters (optional) + api_instance.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group=string_group, boolean_group=boolean_group, int64_group=int64_group) + except Exception as e: + print("Exception when calling FakeApi->test_group_parameters: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **required_string_group** | **int**| Required String in group parameters | + **required_boolean_group** | **bool**| Required Boolean in group parameters | + **required_int64_group** | **int**| Required Integer in group parameters | + **string_group** | **int**| String in group parameters | [optional] + **boolean_group** | **bool**| Boolean in group parameters | [optional] + **int64_group** | **int**| Integer in group parameters | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[bearer_test](../README.md#bearer_test) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**400** | Someting wrong | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_inline_additional_properties** +> test_inline_additional_properties(request_body) + +test inline additionalProperties + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + request_body = {'key': 'request_body_example'} # Dict[str, str] | request body + + try: + # test inline additionalProperties + api_instance.test_inline_additional_properties(request_body) + except Exception as e: + print("Exception when calling FakeApi->test_inline_additional_properties: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **request_body** | [**Dict[str, str]**](str.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_inline_freeform_additional_properties** +> test_inline_freeform_additional_properties(test_inline_freeform_additional_properties_request) + +test inline free-form additionalProperties + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + test_inline_freeform_additional_properties_request = petstore_api.TestInlineFreeformAdditionalPropertiesRequest() # TestInlineFreeformAdditionalPropertiesRequest | request body + + try: + # test inline free-form additionalProperties + api_instance.test_inline_freeform_additional_properties(test_inline_freeform_additional_properties_request) + except Exception as e: + print("Exception when calling FakeApi->test_inline_freeform_additional_properties: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **test_inline_freeform_additional_properties_request** | [**TestInlineFreeformAdditionalPropertiesRequest**](TestInlineFreeformAdditionalPropertiesRequest.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_json_form_data** +> test_json_form_data(param, param2) + +test json serialization of form data + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + param = 'param_example' # str | field1 + param2 = 'param2_example' # str | field2 + + try: + # test json serialization of form data + api_instance.test_json_form_data(param, param2) + except Exception as e: + print("Exception when calling FakeApi->test_json_form_data: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | **str**| field1 | + **param2** | **str**| field2 | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **test_query_parameter_collection_format** +> test_query_parameter_collection_format(pipe, ioutil, http, url, context, allow_empty, language=language) + + + +To test the collection format in query parameters + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeApi(api_client) + pipe = ['pipe_example'] # List[str] | + ioutil = ['ioutil_example'] # List[str] | + http = ['http_example'] # List[str] | + url = ['url_example'] # List[str] | + context = ['context_example'] # List[str] | + allow_empty = 'allow_empty_example' # str | + language = {'key': 'language_example'} # Dict[str, str] | (optional) + + try: + api_instance.test_query_parameter_collection_format(pipe, ioutil, http, url, context, allow_empty, language=language) + except Exception as e: + print("Exception when calling FakeApi->test_query_parameter_collection_format: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pipe** | [**List[str]**](str.md)| | + **ioutil** | [**List[str]**](str.md)| | + **http** | [**List[str]**](str.md)| | + **url** | [**List[str]**](str.md)| | + **context** | [**List[str]**](str.md)| | + **allow_empty** | **str**| | + **language** | [**Dict[str, str]**](str.md)| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Success | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/FakeClassnameTags123Api.md new file mode 100644 index 00000000000..0319aac41cf --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/FakeClassnameTags123Api.md @@ -0,0 +1,87 @@ +# petstore_api.FakeClassnameTags123Api + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**test_classname**](FakeClassnameTags123Api.md#test_classname) | **PATCH** /fake_classname_test | To test class name in snake case + + +# **test_classname** +> Client test_classname(client) + +To test class name in snake case + +To test class name in snake case + +### Example + +* Api Key Authentication (api_key_query): +```python +import time +import os +import petstore_api +from petstore_api.models.client import Client +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: api_key_query +configuration.api_key['api_key_query'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['api_key_query'] = 'Bearer' + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.FakeClassnameTags123Api(api_client) + client = petstore_api.Client() # Client | client model + + try: + # To test class name in snake case + api_response = api_instance.test_classname(client) + print("The response of FakeClassnameTags123Api->test_classname:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FakeClassnameTags123Api->test_classname: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **client** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/File.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/File.md new file mode 100644 index 00000000000..586da8e3255 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/File.md @@ -0,0 +1,29 @@ +# File + +Must be named `File` for test. + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**source_uri** | **str** | Test capitalization | [optional] + +## Example + +```python +from petstore_api.models.file import File + +# TODO update the JSON string below +json = "{}" +# create an instance of File from a JSON string +file_instance = File.from_json(json) +# print the JSON string representation of the object +print File.to_json() + +# convert the object into a dict +file_dict = file_instance.to_dict() +# create an instance of File from a dict +file_form_dict = file.from_dict(file_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/FileSchemaTestClass.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/FileSchemaTestClass.md new file mode 100644 index 00000000000..fb967a8d992 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/FileSchemaTestClass.md @@ -0,0 +1,29 @@ +# FileSchemaTestClass + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | [**File**](File.md) | | [optional] +**files** | [**List[File]**](File.md) | | [optional] + +## Example + +```python +from petstore_api.models.file_schema_test_class import FileSchemaTestClass + +# TODO update the JSON string below +json = "{}" +# create an instance of FileSchemaTestClass from a JSON string +file_schema_test_class_instance = FileSchemaTestClass.from_json(json) +# print the JSON string representation of the object +print FileSchemaTestClass.to_json() + +# convert the object into a dict +file_schema_test_class_dict = file_schema_test_class_instance.to_dict() +# create an instance of FileSchemaTestClass from a dict +file_schema_test_class_form_dict = file_schema_test_class.from_dict(file_schema_test_class_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/FirstRef.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/FirstRef.md new file mode 100644 index 00000000000..b5e7ab766b4 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/FirstRef.md @@ -0,0 +1,29 @@ +# FirstRef + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**category** | **str** | | [optional] +**self_ref** | [**SecondRef**](SecondRef.md) | | [optional] + +## Example + +```python +from petstore_api.models.first_ref import FirstRef + +# TODO update the JSON string below +json = "{}" +# create an instance of FirstRef from a JSON string +first_ref_instance = FirstRef.from_json(json) +# print the JSON string representation of the object +print FirstRef.to_json() + +# convert the object into a dict +first_ref_dict = first_ref_instance.to_dict() +# create an instance of FirstRef from a dict +first_ref_form_dict = first_ref.from_dict(first_ref_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/Foo.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Foo.md new file mode 100644 index 00000000000..8062d08df1d --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Foo.md @@ -0,0 +1,28 @@ +# Foo + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **str** | | [optional] [default to 'bar'] + +## Example + +```python +from petstore_api.models.foo import Foo + +# TODO update the JSON string below +json = "{}" +# create an instance of Foo from a JSON string +foo_instance = Foo.from_json(json) +# print the JSON string representation of the object +print Foo.to_json() + +# convert the object into a dict +foo_dict = foo_instance.to_dict() +# create an instance of Foo from a dict +foo_form_dict = foo.from_dict(foo_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/FooGetDefaultResponse.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/FooGetDefaultResponse.md new file mode 100644 index 00000000000..550fbe78fa1 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/FooGetDefaultResponse.md @@ -0,0 +1,28 @@ +# FooGetDefaultResponse + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | [**Foo**](Foo.md) | | [optional] + +## Example + +```python +from petstore_api.models.foo_get_default_response import FooGetDefaultResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of FooGetDefaultResponse from a JSON string +foo_get_default_response_instance = FooGetDefaultResponse.from_json(json) +# print the JSON string representation of the object +print FooGetDefaultResponse.to_json() + +# convert the object into a dict +foo_get_default_response_dict = foo_get_default_response_instance.to_dict() +# create an instance of FooGetDefaultResponse from a dict +foo_get_default_response_form_dict = foo_get_default_response.from_dict(foo_get_default_response_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/FormatTest.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/FormatTest.md new file mode 100644 index 00000000000..aa81e585952 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/FormatTest.md @@ -0,0 +1,44 @@ +# FormatTest + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **int** | | [optional] +**int32** | **int** | | [optional] +**int64** | **int** | | [optional] +**number** | **float** | | +**float** | **float** | | [optional] +**double** | **float** | | [optional] +**decimal** | **decimal.Decimal** | | [optional] +**string** | **str** | | [optional] +**string_with_double_quote_pattern** | **str** | | [optional] +**byte** | **bytearray** | | [optional] +**binary** | **bytearray** | | [optional] +**var_date** | **date** | | +**date_time** | **datetime** | | [optional] +**uuid** | **str** | | [optional] +**password** | **str** | | +**pattern_with_digits** | **str** | A string that is a 10 digit number. Can have leading zeros. | [optional] +**pattern_with_digits_and_delimiter** | **str** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] + +## Example + +```python +from petstore_api.models.format_test import FormatTest + +# TODO update the JSON string below +json = "{}" +# create an instance of FormatTest from a JSON string +format_test_instance = FormatTest.from_json(json) +# print the JSON string representation of the object +print FormatTest.to_json() + +# convert the object into a dict +format_test_dict = format_test_instance.to_dict() +# create an instance of FormatTest from a dict +format_test_form_dict = format_test.from_dict(format_test_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/HasOnlyReadOnly.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/HasOnlyReadOnly.md new file mode 100644 index 00000000000..99573bd28a2 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/HasOnlyReadOnly.md @@ -0,0 +1,29 @@ +# HasOnlyReadOnly + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **str** | | [optional] [readonly] +**foo** | **str** | | [optional] [readonly] + +## Example + +```python +from petstore_api.models.has_only_read_only import HasOnlyReadOnly + +# TODO update the JSON string below +json = "{}" +# create an instance of HasOnlyReadOnly from a JSON string +has_only_read_only_instance = HasOnlyReadOnly.from_json(json) +# print the JSON string representation of the object +print HasOnlyReadOnly.to_json() + +# convert the object into a dict +has_only_read_only_dict = has_only_read_only_instance.to_dict() +# create an instance of HasOnlyReadOnly from a dict +has_only_read_only_form_dict = has_only_read_only.from_dict(has_only_read_only_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/HealthCheckResult.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/HealthCheckResult.md new file mode 100644 index 00000000000..b8723e018aa --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/HealthCheckResult.md @@ -0,0 +1,29 @@ +# HealthCheckResult + +Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nullable_message** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.health_check_result import HealthCheckResult + +# TODO update the JSON string below +json = "{}" +# create an instance of HealthCheckResult from a JSON string +health_check_result_instance = HealthCheckResult.from_json(json) +# print the JSON string representation of the object +print HealthCheckResult.to_json() + +# convert the object into a dict +health_check_result_dict = health_check_result_instance.to_dict() +# create an instance of HealthCheckResult from a dict +health_check_result_form_dict = health_check_result.from_dict(health_check_result_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/InnerDictWithProperty.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/InnerDictWithProperty.md new file mode 100644 index 00000000000..45d76ad458c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/InnerDictWithProperty.md @@ -0,0 +1,28 @@ +# InnerDictWithProperty + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**a_property** | **object** | | [optional] + +## Example + +```python +from petstore_api.models.inner_dict_with_property import InnerDictWithProperty + +# TODO update the JSON string below +json = "{}" +# create an instance of InnerDictWithProperty from a JSON string +inner_dict_with_property_instance = InnerDictWithProperty.from_json(json) +# print the JSON string representation of the object +print InnerDictWithProperty.to_json() + +# convert the object into a dict +inner_dict_with_property_dict = inner_dict_with_property_instance.to_dict() +# create an instance of InnerDictWithProperty from a dict +inner_dict_with_property_form_dict = inner_dict_with_property.from_dict(inner_dict_with_property_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/IntOrString.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/IntOrString.md new file mode 100644 index 00000000000..0a441f186db --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/IntOrString.md @@ -0,0 +1,27 @@ +# IntOrString + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Example + +```python +from petstore_api.models.int_or_string import IntOrString + +# TODO update the JSON string below +json = "{}" +# create an instance of IntOrString from a JSON string +int_or_string_instance = IntOrString.from_json(json) +# print the JSON string representation of the object +print IntOrString.to_json() + +# convert the object into a dict +int_or_string_dict = int_or_string_instance.to_dict() +# create an instance of IntOrString from a dict +int_or_string_form_dict = int_or_string.from_dict(int_or_string_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/List.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/List.md new file mode 100644 index 00000000000..7643e4ea92d --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/List.md @@ -0,0 +1,28 @@ +# List + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_123_list** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.list import List + +# TODO update the JSON string below +json = "{}" +# create an instance of List from a JSON string +list_instance = List.from_json(json) +# print the JSON string representation of the object +print List.to_json() + +# convert the object into a dict +list_dict = list_instance.to_dict() +# create an instance of List from a dict +list_form_dict = list.from_dict(list_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/MapOfArrayOfModel.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/MapOfArrayOfModel.md new file mode 100644 index 00000000000..b97ace0f42c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/MapOfArrayOfModel.md @@ -0,0 +1,28 @@ +# MapOfArrayOfModel + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**shop_id_to_org_online_lip_map** | **Dict[str, List[Tag]]** | | [optional] + +## Example + +```python +from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel + +# TODO update the JSON string below +json = "{}" +# create an instance of MapOfArrayOfModel from a JSON string +map_of_array_of_model_instance = MapOfArrayOfModel.from_json(json) +# print the JSON string representation of the object +print MapOfArrayOfModel.to_json() + +# convert the object into a dict +map_of_array_of_model_dict = map_of_array_of_model_instance.to_dict() +# create an instance of MapOfArrayOfModel from a dict +map_of_array_of_model_form_dict = map_of_array_of_model.from_dict(map_of_array_of_model_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/MapTest.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/MapTest.md new file mode 100644 index 00000000000..ba87758a522 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/MapTest.md @@ -0,0 +1,31 @@ +# MapTest + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**map_map_of_string** | **Dict[str, Dict[str, str]]** | | [optional] +**map_of_enum_string** | **Dict[str, str]** | | [optional] +**direct_map** | **Dict[str, bool]** | | [optional] +**indirect_map** | **Dict[str, bool]** | | [optional] + +## Example + +```python +from petstore_api.models.map_test import MapTest + +# TODO update the JSON string below +json = "{}" +# create an instance of MapTest from a JSON string +map_test_instance = MapTest.from_json(json) +# print the JSON string representation of the object +print MapTest.to_json() + +# convert the object into a dict +map_test_dict = map_test_instance.to_dict() +# create an instance of MapTest from a dict +map_test_form_dict = map_test.from_dict(map_test_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 00000000000..8f628d133ab --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,30 @@ +# MixedPropertiesAndAdditionalPropertiesClass + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **str** | | [optional] +**date_time** | **datetime** | | [optional] +**map** | [**Dict[str, Animal]**](Animal.md) | | [optional] + +## Example + +```python +from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass + +# TODO update the JSON string below +json = "{}" +# create an instance of MixedPropertiesAndAdditionalPropertiesClass from a JSON string +mixed_properties_and_additional_properties_class_instance = MixedPropertiesAndAdditionalPropertiesClass.from_json(json) +# print the JSON string representation of the object +print MixedPropertiesAndAdditionalPropertiesClass.to_json() + +# convert the object into a dict +mixed_properties_and_additional_properties_class_dict = mixed_properties_and_additional_properties_class_instance.to_dict() +# create an instance of MixedPropertiesAndAdditionalPropertiesClass from a dict +mixed_properties_and_additional_properties_class_form_dict = mixed_properties_and_additional_properties_class.from_dict(mixed_properties_and_additional_properties_class_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/Model200Response.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Model200Response.md new file mode 100644 index 00000000000..6a20cefe99c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Model200Response.md @@ -0,0 +1,30 @@ +# Model200Response + +Model for testing model name starting with number + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | [optional] +**var_class** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.model200_response import Model200Response + +# TODO update the JSON string below +json = "{}" +# create an instance of Model200Response from a JSON string +model200_response_instance = Model200Response.from_json(json) +# print the JSON string representation of the object +print Model200Response.to_json() + +# convert the object into a dict +model200_response_dict = model200_response_instance.to_dict() +# create an instance of Model200Response from a dict +model200_response_form_dict = model200_response.from_dict(model200_response_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/ModelReturn.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ModelReturn.md new file mode 100644 index 00000000000..a5b47f423c8 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ModelReturn.md @@ -0,0 +1,29 @@ +# ModelReturn + +Model for testing reserved words + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_return** | **int** | | [optional] + +## Example + +```python +from petstore_api.models.model_return import ModelReturn + +# TODO update the JSON string below +json = "{}" +# create an instance of ModelReturn from a JSON string +model_return_instance = ModelReturn.from_json(json) +# print the JSON string representation of the object +print ModelReturn.to_json() + +# convert the object into a dict +model_return_dict = model_return_instance.to_dict() +# create an instance of ModelReturn from a dict +model_return_form_dict = model_return.from_dict(model_return_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/Name.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Name.md new file mode 100644 index 00000000000..4ccd0ce09aa --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Name.md @@ -0,0 +1,32 @@ +# Name + +Model for testing model name same as property name + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | +**snake_case** | **int** | | [optional] [readonly] +**var_property** | **str** | | [optional] +**var_123_number** | **int** | | [optional] [readonly] + +## Example + +```python +from petstore_api.models.name import Name + +# TODO update the JSON string below +json = "{}" +# create an instance of Name from a JSON string +name_instance = Name.from_json(json) +# print the JSON string representation of the object +print Name.to_json() + +# convert the object into a dict +name_dict = name_instance.to_dict() +# create an instance of Name from a dict +name_form_dict = name.from_dict(name_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/NullableClass.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/NullableClass.md new file mode 100644 index 00000000000..1658756b50e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/NullableClass.md @@ -0,0 +1,40 @@ +# NullableClass + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**required_integer_prop** | **int** | | +**integer_prop** | **int** | | [optional] +**number_prop** | **float** | | [optional] +**boolean_prop** | **bool** | | [optional] +**string_prop** | **str** | | [optional] +**date_prop** | **date** | | [optional] +**datetime_prop** | **datetime** | | [optional] +**array_nullable_prop** | **List[object]** | | [optional] +**array_and_items_nullable_prop** | **List[object]** | | [optional] +**array_items_nullable** | **List[object]** | | [optional] +**object_nullable_prop** | **Dict[str, object]** | | [optional] +**object_and_items_nullable_prop** | **Dict[str, object]** | | [optional] +**object_items_nullable** | **Dict[str, object]** | | [optional] + +## Example + +```python +from petstore_api.models.nullable_class import NullableClass + +# TODO update the JSON string below +json = "{}" +# create an instance of NullableClass from a JSON string +nullable_class_instance = NullableClass.from_json(json) +# print the JSON string representation of the object +print NullableClass.to_json() + +# convert the object into a dict +nullable_class_dict = nullable_class_instance.to_dict() +# create an instance of NullableClass from a dict +nullable_class_form_dict = nullable_class.from_dict(nullable_class_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/NullableProperty.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/NullableProperty.md new file mode 100644 index 00000000000..fd9cbbc51aa --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/NullableProperty.md @@ -0,0 +1,29 @@ +# NullableProperty + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | +**name** | **str** | | + +## Example + +```python +from petstore_api.models.nullable_property import NullableProperty + +# TODO update the JSON string below +json = "{}" +# create an instance of NullableProperty from a JSON string +nullable_property_instance = NullableProperty.from_json(json) +# print the JSON string representation of the object +print NullableProperty.to_json() + +# convert the object into a dict +nullable_property_dict = nullable_property_instance.to_dict() +# create an instance of NullableProperty from a dict +nullable_property_form_dict = nullable_property.from_dict(nullable_property_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/NumberOnly.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/NumberOnly.md new file mode 100644 index 00000000000..f49216ddaa4 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/NumberOnly.md @@ -0,0 +1,28 @@ +# NumberOnly + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**just_number** | **float** | | [optional] + +## Example + +```python +from petstore_api.models.number_only import NumberOnly + +# TODO update the JSON string below +json = "{}" +# create an instance of NumberOnly from a JSON string +number_only_instance = NumberOnly.from_json(json) +# print the JSON string representation of the object +print NumberOnly.to_json() + +# convert the object into a dict +number_only_dict = number_only_instance.to_dict() +# create an instance of NumberOnly from a dict +number_only_form_dict = number_only.from_dict(number_only_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/ObjectToTestAdditionalProperties.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ObjectToTestAdditionalProperties.md new file mode 100644 index 00000000000..c4ba9a95850 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ObjectToTestAdditionalProperties.md @@ -0,0 +1,29 @@ +# ObjectToTestAdditionalProperties + +Minimal object + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_property** | **bool** | Property | [optional] [default to False] + +## Example + +```python +from petstore_api.models.object_to_test_additional_properties import ObjectToTestAdditionalProperties + +# TODO update the JSON string below +json = "{}" +# create an instance of ObjectToTestAdditionalProperties from a JSON string +object_to_test_additional_properties_instance = ObjectToTestAdditionalProperties.from_json(json) +# print the JSON string representation of the object +print ObjectToTestAdditionalProperties.to_json() + +# convert the object into a dict +object_to_test_additional_properties_dict = object_to_test_additional_properties_instance.to_dict() +# create an instance of ObjectToTestAdditionalProperties from a dict +object_to_test_additional_properties_form_dict = object_to_test_additional_properties.from_dict(object_to_test_additional_properties_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/ObjectWithDeprecatedFields.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ObjectWithDeprecatedFields.md new file mode 100644 index 00000000000..8daa55a3916 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ObjectWithDeprecatedFields.md @@ -0,0 +1,31 @@ +# ObjectWithDeprecatedFields + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **str** | | [optional] +**id** | **float** | | [optional] +**deprecated_ref** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional] +**bars** | **List[str]** | | [optional] + +## Example + +```python +from petstore_api.models.object_with_deprecated_fields import ObjectWithDeprecatedFields + +# TODO update the JSON string below +json = "{}" +# create an instance of ObjectWithDeprecatedFields from a JSON string +object_with_deprecated_fields_instance = ObjectWithDeprecatedFields.from_json(json) +# print the JSON string representation of the object +print ObjectWithDeprecatedFields.to_json() + +# convert the object into a dict +object_with_deprecated_fields_dict = object_with_deprecated_fields_instance.to_dict() +# create an instance of ObjectWithDeprecatedFields from a dict +object_with_deprecated_fields_form_dict = object_with_deprecated_fields.from_dict(object_with_deprecated_fields_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/OneOfEnumString.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/OneOfEnumString.md new file mode 100644 index 00000000000..c7c28bc2944 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/OneOfEnumString.md @@ -0,0 +1,28 @@ +# OneOfEnumString + +oneOf enum strings + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Example + +```python +from petstore_api.models.one_of_enum_string import OneOfEnumString + +# TODO update the JSON string below +json = "{}" +# create an instance of OneOfEnumString from a JSON string +one_of_enum_string_instance = OneOfEnumString.from_json(json) +# print the JSON string representation of the object +print OneOfEnumString.to_json() + +# convert the object into a dict +one_of_enum_string_dict = one_of_enum_string_instance.to_dict() +# create an instance of OneOfEnumString from a dict +one_of_enum_string_form_dict = one_of_enum_string.from_dict(one_of_enum_string_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/Order.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Order.md new file mode 100644 index 00000000000..e71e955a11d --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Order.md @@ -0,0 +1,33 @@ +# Order + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**pet_id** | **int** | | [optional] +**quantity** | **int** | | [optional] +**ship_date** | **datetime** | | [optional] +**status** | **str** | Order Status | [optional] +**complete** | **bool** | | [optional] [default to False] + +## Example + +```python +from petstore_api.models.order import Order + +# TODO update the JSON string below +json = "{}" +# create an instance of Order from a JSON string +order_instance = Order.from_json(json) +# print the JSON string representation of the object +print Order.to_json() + +# convert the object into a dict +order_dict = order_instance.to_dict() +# create an instance of Order from a dict +order_form_dict = order.from_dict(order_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterComposite.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterComposite.md new file mode 100644 index 00000000000..504e266f9a1 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterComposite.md @@ -0,0 +1,30 @@ +# OuterComposite + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**my_number** | **float** | | [optional] +**my_string** | **str** | | [optional] +**my_boolean** | **bool** | | [optional] + +## Example + +```python +from petstore_api.models.outer_composite import OuterComposite + +# TODO update the JSON string below +json = "{}" +# create an instance of OuterComposite from a JSON string +outer_composite_instance = OuterComposite.from_json(json) +# print the JSON string representation of the object +print OuterComposite.to_json() + +# convert the object into a dict +outer_composite_dict = outer_composite_instance.to_dict() +# create an instance of OuterComposite from a dict +outer_composite_form_dict = outer_composite.from_dict(outer_composite_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterEnum.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterEnum.md new file mode 100644 index 00000000000..4cb31437c7e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterEnum.md @@ -0,0 +1,10 @@ +# OuterEnum + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterEnumDefaultValue.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterEnumDefaultValue.md new file mode 100644 index 00000000000..4a5ba6428d8 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterEnumDefaultValue.md @@ -0,0 +1,10 @@ +# OuterEnumDefaultValue + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterEnumInteger.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterEnumInteger.md new file mode 100644 index 00000000000..fc84ec36585 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterEnumInteger.md @@ -0,0 +1,10 @@ +# OuterEnumInteger + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterEnumIntegerDefaultValue.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterEnumIntegerDefaultValue.md new file mode 100644 index 00000000000..0de4199a840 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,10 @@ +# OuterEnumIntegerDefaultValue + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterObjectWithEnumProperty.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterObjectWithEnumProperty.md new file mode 100644 index 00000000000..c6a1cdcbc19 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/OuterObjectWithEnumProperty.md @@ -0,0 +1,29 @@ +# OuterObjectWithEnumProperty + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**str_value** | [**OuterEnum**](OuterEnum.md) | | [optional] +**value** | [**OuterEnumInteger**](OuterEnumInteger.md) | | + +## Example + +```python +from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty + +# TODO update the JSON string below +json = "{}" +# create an instance of OuterObjectWithEnumProperty from a JSON string +outer_object_with_enum_property_instance = OuterObjectWithEnumProperty.from_json(json) +# print the JSON string representation of the object +print OuterObjectWithEnumProperty.to_json() + +# convert the object into a dict +outer_object_with_enum_property_dict = outer_object_with_enum_property_instance.to_dict() +# create an instance of OuterObjectWithEnumProperty from a dict +outer_object_with_enum_property_form_dict = outer_object_with_enum_property.from_dict(outer_object_with_enum_property_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/Parent.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Parent.md new file mode 100644 index 00000000000..9a963a6b722 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Parent.md @@ -0,0 +1,28 @@ +# Parent + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**optional_dict** | [**Dict[str, InnerDictWithProperty]**](InnerDictWithProperty.md) | | [optional] + +## Example + +```python +from petstore_api.models.parent import Parent + +# TODO update the JSON string below +json = "{}" +# create an instance of Parent from a JSON string +parent_instance = Parent.from_json(json) +# print the JSON string representation of the object +print Parent.to_json() + +# convert the object into a dict +parent_dict = parent_instance.to_dict() +# create an instance of Parent from a dict +parent_form_dict = parent.from_dict(parent_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/ParentWithOptionalDict.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ParentWithOptionalDict.md new file mode 100644 index 00000000000..04bf9494201 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ParentWithOptionalDict.md @@ -0,0 +1,28 @@ +# ParentWithOptionalDict + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**optional_dict** | [**Dict[str, InnerDictWithProperty]**](InnerDictWithProperty.md) | | [optional] + +## Example + +```python +from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict + +# TODO update the JSON string below +json = "{}" +# create an instance of ParentWithOptionalDict from a JSON string +parent_with_optional_dict_instance = ParentWithOptionalDict.from_json(json) +# print the JSON string representation of the object +print ParentWithOptionalDict.to_json() + +# convert the object into a dict +parent_with_optional_dict_dict = parent_with_optional_dict_instance.to_dict() +# create an instance of ParentWithOptionalDict from a dict +parent_with_optional_dict_form_dict = parent_with_optional_dict.from_dict(parent_with_optional_dict_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/Pet.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Pet.md new file mode 100644 index 00000000000..05a466f880a --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Pet.md @@ -0,0 +1,33 @@ +# Pet + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **str** | | +**photo_urls** | **List[str]** | | +**tags** | [**List[Tag]**](Tag.md) | | [optional] +**status** | **str** | pet status in the store | [optional] + +## Example + +```python +from petstore_api.models.pet import Pet + +# TODO update the JSON string below +json = "{}" +# create an instance of Pet from a JSON string +pet_instance = Pet.from_json(json) +# print the JSON string representation of the object +print Pet.to_json() + +# convert the object into a dict +pet_dict = pet_instance.to_dict() +# create an instance of Pet from a dict +pet_form_dict = pet.from_dict(pet_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/PetApi.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/PetApi.md new file mode 100644 index 00000000000..8a0202f3753 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/PetApi.md @@ -0,0 +1,953 @@ +# petstore_api.PetApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**add_pet**](PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store +[**delete_pet**](PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet +[**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status +[**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags +[**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +[**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet +[**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image +[**upload_file_with_required_file**](PetApi.md#upload_file_with_required_file) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) + + +# **add_pet** +> add_pet(pet) + +Add a new pet to the store + + + +### Example + +* OAuth Authentication (petstore_auth): +```python +import time +import os +import petstore_api +from petstore_api.models.pet import Pet +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Configure HTTP message signature: http_signature_test +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See petstore_api.signing for a list of all supported parameters. +from petstore_api import signing +import datetime + +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + signing_info = petstore_api.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, + signed_headers = [ + petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store + + try: + # Add a new pet to the store + api_instance.add_pet(pet) + except Exception as e: + print("Exception when calling PetApi->add_pet: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | +**405** | Invalid input | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **delete_pet** +> delete_pet(pet_id, api_key=api_key) + +Deletes a pet + + + +### Example + +* OAuth Authentication (petstore_auth): +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + pet_id = 56 # int | Pet id to delete + api_key = 'api_key_example' # str | (optional) + + try: + # Deletes a pet + api_instance.delete_pet(pet_id, api_key=api_key) + except Exception as e: + print("Exception when calling PetApi->delete_pet: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| Pet id to delete | + **api_key** | **str**| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | +**400** | Invalid pet value | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **find_pets_by_status** +> List[Pet] find_pets_by_status(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example + +* OAuth Authentication (petstore_auth): +```python +import time +import os +import petstore_api +from petstore_api.models.pet import Pet +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Configure HTTP message signature: http_signature_test +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See petstore_api.signing for a list of all supported parameters. +from petstore_api import signing +import datetime + +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + signing_info = petstore_api.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, + signed_headers = [ + petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + status = ['status_example'] # List[str] | Status values that need to be considered for filter + + try: + # Finds Pets by status + api_response = api_instance.find_pets_by_status(status) + print("The response of PetApi->find_pets_by_status:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PetApi->find_pets_by_status: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**List[str]**](str.md)| Status values that need to be considered for filter | + +### Return type + +[**List[Pet]**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | +**400** | Invalid status value | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **find_pets_by_tags** +> List[Pet] find_pets_by_tags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example + +* OAuth Authentication (petstore_auth): +```python +import time +import os +import petstore_api +from petstore_api.models.pet import Pet +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Configure HTTP message signature: http_signature_test +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See petstore_api.signing for a list of all supported parameters. +from petstore_api import signing +import datetime + +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + signing_info = petstore_api.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, + signed_headers = [ + petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + tags = ['tags_example'] # List[str] | Tags to filter by + + try: + # Finds Pets by tags + api_response = api_instance.find_pets_by_tags(tags) + print("The response of PetApi->find_pets_by_tags:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**List[str]**](str.md)| Tags to filter by | + +### Return type + +[**List[Pet]**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | +**400** | Invalid tag value | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_pet_by_id** +> Pet get_pet_by_id(pet_id) + +Find pet by ID + +Returns a single pet + +### Example + +* Api Key Authentication (api_key): +```python +import time +import os +import petstore_api +from petstore_api.models.pet import Pet +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: api_key +configuration.api_key['api_key'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['api_key'] = 'Bearer' + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + pet_id = 56 # int | ID of pet to return + + try: + # Find pet by ID + api_response = api_instance.get_pet_by_id(pet_id) + print("The response of PetApi->get_pet_by_id:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PetApi->get_pet_by_id: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet to return | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | +**400** | Invalid ID supplied | - | +**404** | Pet not found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **update_pet** +> update_pet(pet) + +Update an existing pet + + + +### Example + +* OAuth Authentication (petstore_auth): +```python +import time +import os +import petstore_api +from petstore_api.models.pet import Pet +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Configure HTTP message signature: http_signature_test +# The HTTP Signature Header mechanism that can be used by a client to +# authenticate the sender of a message and ensure that particular headers +# have not been modified in transit. +# +# You can specify the signing key-id, private key path, signing scheme, +# signing algorithm, list of signed headers and signature max validity. +# The 'key_id' parameter is an opaque string that the API server can use +# to lookup the client and validate the signature. +# The 'private_key_path' parameter should be the path to a file that +# contains a DER or base-64 encoded private key. +# The 'private_key_passphrase' parameter is optional. Set the passphrase +# if the private key is encrypted. +# The 'signed_headers' parameter is used to specify the list of +# HTTP headers included when generating the signature for the message. +# You can specify HTTP headers that you want to protect with a cryptographic +# signature. Note that proxies may add, modify or remove HTTP headers +# for legitimate reasons, so you should only add headers that you know +# will not be modified. For example, if you want to protect the HTTP request +# body, you can specify the Digest header. In that case, the client calculates +# the digest of the HTTP request body and includes the digest in the message +# signature. +# The 'signature_max_validity' parameter is optional. It is configured as a +# duration to express when the signature ceases to be valid. The client calculates +# the expiration date every time it generates the cryptographic signature +# of an HTTP request. The API server may have its own security policy +# that controls the maximum validity of the signature. The client max validity +# must be lower than the server max validity. +# The time on the client and server must be synchronized, otherwise the +# server may reject the client signature. +# +# The client must use a combination of private key, signing scheme, +# signing algorithm and hash algorithm that matches the security policy of +# the API server. +# +# See petstore_api.signing for a list of all supported parameters. +from petstore_api import signing +import datetime + +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2", + signing_info = petstore_api.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'private_key.pem', + private_key_passphrase = 'YOUR_PASSPHRASE', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_ECDSA_MODE_FIPS_186_3, + hash_algorithm = petstore_api.signing.SCHEME_RSA_SHA256, + signed_headers = [ + petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + pet = petstore_api.Pet() # Pet | Pet object that needs to be added to the store + + try: + # Update an existing pet + api_instance.update_pet(pet) + except Exception as e: + print("Exception when calling PetApi->update_pet: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | +**400** | Invalid ID supplied | - | +**404** | Pet not found | - | +**405** | Validation exception | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **update_pet_with_form** +> update_pet_with_form(pet_id, name=name, status=status) + +Updates a pet in the store with form data + + + +### Example + +* OAuth Authentication (petstore_auth): +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + pet_id = 56 # int | ID of pet that needs to be updated + name = 'name_example' # str | Updated name of the pet (optional) + status = 'status_example' # str | Updated status of the pet (optional) + + try: + # Updates a pet in the store with form data + api_instance.update_pet_with_form(pet_id, name=name, status=status) + except Exception as e: + print("Exception when calling PetApi->update_pet_with_form: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet that needs to be updated | + **name** | **str**| Updated name of the pet | [optional] + **status** | **str**| Updated status of the pet | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Successful operation | - | +**405** | Invalid input | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **upload_file** +> ApiResponse upload_file(pet_id, additional_metadata=additional_metadata, file=file) + +uploads an image + + + +### Example + +* OAuth Authentication (petstore_auth): +```python +import time +import os +import petstore_api +from petstore_api.models.api_response import ApiResponse +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + pet_id = 56 # int | ID of pet to update + additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional) + file = None # bytearray | file to upload (optional) + + try: + # uploads an image + api_response = api_instance.upload_file(pet_id, additional_metadata=additional_metadata, file=file) + print("The response of PetApi->upload_file:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PetApi->upload_file: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet to update | + **additional_metadata** | **str**| Additional data to pass to server | [optional] + **file** | **bytearray**| file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **upload_file_with_required_file** +> ApiResponse upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata) + +uploads an image (required) + + + +### Example + +* OAuth Authentication (petstore_auth): +```python +import time +import os +import petstore_api +from petstore_api.models.api_response import ApiResponse +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +configuration.access_token = os.environ["ACCESS_TOKEN"] + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.PetApi(api_client) + pet_id = 56 # int | ID of pet to update + required_file = None # bytearray | file to upload + additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional) + + try: + # uploads an image (required) + api_response = api_instance.upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata) + print("The response of PetApi->upload_file_with_required_file:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PetApi->upload_file_with_required_file: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet to update | + **required_file** | **bytearray**| file to upload | + **additional_metadata** | **str**| Additional data to pass to server | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/Pig.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Pig.md new file mode 100644 index 00000000000..398d6c6c6e3 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Pig.md @@ -0,0 +1,30 @@ +# Pig + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_name** | **str** | | +**color** | **str** | | +**size** | **int** | | + +## Example + +```python +from petstore_api.models.pig import Pig + +# TODO update the JSON string below +json = "{}" +# create an instance of Pig from a JSON string +pig_instance = Pig.from_json(json) +# print the JSON string representation of the object +print Pig.to_json() + +# convert the object into a dict +pig_dict = pig_instance.to_dict() +# create an instance of Pig from a dict +pig_form_dict = pig.from_dict(pig_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/PropertyNameCollision.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/PropertyNameCollision.md new file mode 100644 index 00000000000..1a9303701b0 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/PropertyNameCollision.md @@ -0,0 +1,30 @@ +# PropertyNameCollision + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**underscore_type** | **str** | | [optional] +**type** | **str** | | [optional] +**type_with_underscore** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.property_name_collision import PropertyNameCollision + +# TODO update the JSON string below +json = "{}" +# create an instance of PropertyNameCollision from a JSON string +property_name_collision_instance = PropertyNameCollision.from_json(json) +# print the JSON string representation of the object +print PropertyNameCollision.to_json() + +# convert the object into a dict +property_name_collision_dict = property_name_collision_instance.to_dict() +# create an instance of PropertyNameCollision from a dict +property_name_collision_form_dict = property_name_collision.from_dict(property_name_collision_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/ReadOnlyFirst.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ReadOnlyFirst.md new file mode 100644 index 00000000000..22b5acca70c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ReadOnlyFirst.md @@ -0,0 +1,29 @@ +# ReadOnlyFirst + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **str** | | [optional] [readonly] +**baz** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.read_only_first import ReadOnlyFirst + +# TODO update the JSON string below +json = "{}" +# create an instance of ReadOnlyFirst from a JSON string +read_only_first_instance = ReadOnlyFirst.from_json(json) +# print the JSON string representation of the object +print ReadOnlyFirst.to_json() + +# convert the object into a dict +read_only_first_dict = read_only_first_instance.to_dict() +# create an instance of ReadOnlyFirst from a dict +read_only_first_form_dict = read_only_first.from_dict(read_only_first_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/SecondRef.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/SecondRef.md new file mode 100644 index 00000000000..e6fb1e2d4f7 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/SecondRef.md @@ -0,0 +1,29 @@ +# SecondRef + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**category** | **str** | | [optional] +**circular_ref** | [**CircularReferenceModel**](CircularReferenceModel.md) | | [optional] + +## Example + +```python +from petstore_api.models.second_ref import SecondRef + +# TODO update the JSON string below +json = "{}" +# create an instance of SecondRef from a JSON string +second_ref_instance = SecondRef.from_json(json) +# print the JSON string representation of the object +print SecondRef.to_json() + +# convert the object into a dict +second_ref_dict = second_ref_instance.to_dict() +# create an instance of SecondRef from a dict +second_ref_form_dict = second_ref.from_dict(second_ref_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/SelfReferenceModel.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/SelfReferenceModel.md new file mode 100644 index 00000000000..dbf9589d576 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/SelfReferenceModel.md @@ -0,0 +1,29 @@ +# SelfReferenceModel + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | **int** | | [optional] +**nested** | [**DummyModel**](DummyModel.md) | | [optional] + +## Example + +```python +from petstore_api.models.self_reference_model import SelfReferenceModel + +# TODO update the JSON string below +json = "{}" +# create an instance of SelfReferenceModel from a JSON string +self_reference_model_instance = SelfReferenceModel.from_json(json) +# print the JSON string representation of the object +print SelfReferenceModel.to_json() + +# convert the object into a dict +self_reference_model_dict = self_reference_model_instance.to_dict() +# create an instance of SelfReferenceModel from a dict +self_reference_model_form_dict = self_reference_model.from_dict(self_reference_model_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/SingleRefType.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/SingleRefType.md new file mode 100644 index 00000000000..4178ac3b505 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/SingleRefType.md @@ -0,0 +1,10 @@ +# SingleRefType + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/SpecialCharacterEnum.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/SpecialCharacterEnum.md new file mode 100644 index 00000000000..801c3b5c845 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/SpecialCharacterEnum.md @@ -0,0 +1,10 @@ +# SpecialCharacterEnum + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/SpecialModelName.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/SpecialModelName.md new file mode 100644 index 00000000000..3d27640abb0 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/SpecialModelName.md @@ -0,0 +1,28 @@ +# SpecialModelName + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**special_property_name** | **int** | | [optional] + +## Example + +```python +from petstore_api.models.special_model_name import SpecialModelName + +# TODO update the JSON string below +json = "{}" +# create an instance of SpecialModelName from a JSON string +special_model_name_instance = SpecialModelName.from_json(json) +# print the JSON string representation of the object +print SpecialModelName.to_json() + +# convert the object into a dict +special_model_name_dict = special_model_name_instance.to_dict() +# create an instance of SpecialModelName from a dict +special_model_name_form_dict = special_model_name.from_dict(special_model_name_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/SpecialName.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/SpecialName.md new file mode 100644 index 00000000000..0b412952597 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/SpecialName.md @@ -0,0 +1,30 @@ +# SpecialName + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_property** | **int** | | [optional] +**var_async** | [**Category**](Category.md) | | [optional] +**var_schema** | **str** | pet status in the store | [optional] + +## Example + +```python +from petstore_api.models.special_name import SpecialName + +# TODO update the JSON string below +json = "{}" +# create an instance of SpecialName from a JSON string +special_name_instance = SpecialName.from_json(json) +# print the JSON string representation of the object +print SpecialName.to_json() + +# convert the object into a dict +special_name_dict = special_name_instance.to_dict() +# create an instance of SpecialName from a dict +special_name_form_dict = special_name.from_dict(special_name_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/StoreApi.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/StoreApi.md new file mode 100644 index 00000000000..9a4c0ec8c00 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/StoreApi.md @@ -0,0 +1,287 @@ +# petstore_api.StoreApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**delete_order**](StoreApi.md#delete_order) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +[**get_inventory**](StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status +[**get_order_by_id**](StoreApi.md#get_order_by_id) | **GET** /store/order/{order_id} | Find purchase order by ID +[**place_order**](StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet + + +# **delete_order** +> delete_order(order_id) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.StoreApi(api_client) + order_id = 'order_id_example' # str | ID of the order that needs to be deleted + + try: + # Delete purchase order by ID + api_instance.delete_order(order_id) + except Exception as e: + print("Exception when calling StoreApi->delete_order: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order_id** | **str**| ID of the order that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**400** | Invalid ID supplied | - | +**404** | Order not found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_inventory** +> Dict[str, int] get_inventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example + +* Api Key Authentication (api_key): +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure API key authorization: api_key +configuration.api_key['api_key'] = os.environ["API_KEY"] + +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['api_key'] = 'Bearer' + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.StoreApi(api_client) + + try: + # Returns pet inventories by status + api_response = api_instance.get_inventory() + print("The response of StoreApi->get_inventory:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling StoreApi->get_inventory: %s\n" % e) +``` + + + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**Dict[str, int]** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_order_by_id** +> Order get_order_by_id(order_id) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.order import Order +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.StoreApi(api_client) + order_id = 56 # int | ID of pet that needs to be fetched + + try: + # Find purchase order by ID + api_response = api_instance.get_order_by_id(order_id) + print("The response of StoreApi->get_order_by_id:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling StoreApi->get_order_by_id: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order_id** | **int**| ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | +**400** | Invalid ID supplied | - | +**404** | Order not found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **place_order** +> Order place_order(order) + +Place an order for a pet + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.order import Order +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.StoreApi(api_client) + order = petstore_api.Order() # Order | order placed for purchasing the pet + + try: + # Place an order for a pet + api_response = api_instance.place_order(order) + print("The response of StoreApi->place_order:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling StoreApi->place_order: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order** | [**Order**](Order.md)| order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | +**400** | Invalid Order | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/Tag.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Tag.md new file mode 100644 index 00000000000..e680c68bedd --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Tag.md @@ -0,0 +1,29 @@ +# Tag + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.tag import Tag + +# TODO update the JSON string below +json = "{}" +# create an instance of Tag from a JSON string +tag_instance = Tag.from_json(json) +# print the JSON string representation of the object +print Tag.to_json() + +# convert the object into a dict +tag_dict = tag_instance.to_dict() +# create an instance of Tag from a dict +tag_form_dict = tag.from_dict(tag_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/TestInlineFreeformAdditionalPropertiesRequest.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/TestInlineFreeformAdditionalPropertiesRequest.md new file mode 100644 index 00000000000..7cf86c5244e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/TestInlineFreeformAdditionalPropertiesRequest.md @@ -0,0 +1,28 @@ +# TestInlineFreeformAdditionalPropertiesRequest + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**some_property** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of TestInlineFreeformAdditionalPropertiesRequest from a JSON string +test_inline_freeform_additional_properties_request_instance = TestInlineFreeformAdditionalPropertiesRequest.from_json(json) +# print the JSON string representation of the object +print TestInlineFreeformAdditionalPropertiesRequest.to_json() + +# convert the object into a dict +test_inline_freeform_additional_properties_request_dict = test_inline_freeform_additional_properties_request_instance.to_dict() +# create an instance of TestInlineFreeformAdditionalPropertiesRequest from a dict +test_inline_freeform_additional_properties_request_form_dict = test_inline_freeform_additional_properties_request.from_dict(test_inline_freeform_additional_properties_request_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/Tiger.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Tiger.md new file mode 100644 index 00000000000..6ce50a31f5a --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Tiger.md @@ -0,0 +1,28 @@ +# Tiger + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**skill** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.tiger import Tiger + +# TODO update the JSON string below +json = "{}" +# create an instance of Tiger from a JSON string +tiger_instance = Tiger.from_json(json) +# print the JSON string representation of the object +print Tiger.to_json() + +# convert the object into a dict +tiger_dict = tiger_instance.to_dict() +# create an instance of Tiger from a dict +tiger_form_dict = tiger.from_dict(tiger_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/User.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/User.md new file mode 100644 index 00000000000..6d7c357ea86 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/User.md @@ -0,0 +1,35 @@ +# User + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**username** | **str** | | [optional] +**first_name** | **str** | | [optional] +**last_name** | **str** | | [optional] +**email** | **str** | | [optional] +**password** | **str** | | [optional] +**phone** | **str** | | [optional] +**user_status** | **int** | User Status | [optional] + +## Example + +```python +from petstore_api.models.user import User + +# TODO update the JSON string below +json = "{}" +# create an instance of User from a JSON string +user_instance = User.from_json(json) +# print the JSON string representation of the object +print User.to_json() + +# convert the object into a dict +user_dict = user_instance.to_dict() +# create an instance of User from a dict +user_form_dict = user.from_dict(user_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/UserApi.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/UserApi.md new file mode 100644 index 00000000000..810e75e1271 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/UserApi.md @@ -0,0 +1,542 @@ +# petstore_api.UserApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_user**](UserApi.md#create_user) | **POST** /user | Create user +[**create_users_with_array_input**](UserApi.md#create_users_with_array_input) | **POST** /user/createWithArray | Creates list of users with given input array +[**create_users_with_list_input**](UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array +[**delete_user**](UserApi.md#delete_user) | **DELETE** /user/{username} | Delete user +[**get_user_by_name**](UserApi.md#get_user_by_name) | **GET** /user/{username} | Get user by user name +[**login_user**](UserApi.md#login_user) | **GET** /user/login | Logs user into the system +[**logout_user**](UserApi.md#logout_user) | **GET** /user/logout | Logs out current logged in user session +[**update_user**](UserApi.md#update_user) | **PUT** /user/{username} | Updated user + + +# **create_user** +> create_user(user) + +Create user + +This can only be done by the logged in user. + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.user import User +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.UserApi(api_client) + user = petstore_api.User() # User | Created user object + + try: + # Create user + api_instance.create_user(user) + except Exception as e: + print("Exception when calling UserApi->create_user: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**User**](User.md)| Created user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**0** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **create_users_with_array_input** +> create_users_with_array_input(user) + +Creates list of users with given input array + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.user import User +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.UserApi(api_client) + user = [petstore_api.User()] # List[User] | List of user object + + try: + # Creates list of users with given input array + api_instance.create_users_with_array_input(user) + except Exception as e: + print("Exception when calling UserApi->create_users_with_array_input: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List[User]**](User.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**0** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **create_users_with_list_input** +> create_users_with_list_input(user) + +Creates list of users with given input array + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.user import User +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.UserApi(api_client) + user = [petstore_api.User()] # List[User] | List of user object + + try: + # Creates list of users with given input array + api_instance.create_users_with_list_input(user) + except Exception as e: + print("Exception when calling UserApi->create_users_with_list_input: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List[User]**](User.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**0** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **delete_user** +> delete_user(username) + +Delete user + +This can only be done by the logged in user. + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.UserApi(api_client) + username = 'username_example' # str | The name that needs to be deleted + + try: + # Delete user + api_instance.delete_user(username) + except Exception as e: + print("Exception when calling UserApi->delete_user: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **str**| The name that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**400** | Invalid username supplied | - | +**404** | User not found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_user_by_name** +> User get_user_by_name(username) + +Get user by user name + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.user import User +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.UserApi(api_client) + username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing. + + try: + # Get user by user name + api_response = api_instance.get_user_by_name(username) + print("The response of UserApi->get_user_by_name:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling UserApi->get_user_by_name: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **str**| The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | - | +**400** | Invalid username supplied | - | +**404** | User not found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **login_user** +> str login_user(username, password) + +Logs user into the system + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.UserApi(api_client) + username = 'username_example' # str | The user name for login + password = 'password_example' # str | The password for login in clear text + + try: + # Logs user into the system + api_response = api_instance.login_user(username, password) + print("The response of UserApi->login_user:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling UserApi->login_user: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **str**| The user name for login | + **password** | **str**| The password for login in clear text | + +### Return type + +**str** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +**400** | Invalid username/password supplied | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **logout_user** +> logout_user() + +Logs out current logged in user session + + + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.UserApi(api_client) + + try: + # Logs out current logged in user session + api_instance.logout_user() + except Exception as e: + print("Exception when calling UserApi->logout_user: %s\n" % e) +``` + + + +### Parameters +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**0** | successful operation | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **update_user** +> update_user(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example + +```python +import time +import os +import petstore_api +from petstore_api.models.user import User +from petstore_api.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2 +# See configuration.py for a list of all supported configuration parameters. +configuration = petstore_api.Configuration( + host = "http://petstore.swagger.io:80/v2" +) + + +# Enter a context with an instance of the API client +with petstore_api.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = petstore_api.UserApi(api_client) + username = 'username_example' # str | name that need to be deleted + user = petstore_api.User() # User | Updated user object + + try: + # Updated user + api_instance.update_user(username, user) + except Exception as e: + print("Exception when calling UserApi->update_user: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **str**| name that need to be deleted | + **user** | [**User**](User.md)| Updated user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**400** | Invalid user supplied | - | +**404** | User not found | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/WithNestedOneOf.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/WithNestedOneOf.md new file mode 100644 index 00000000000..247afcab99d --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/WithNestedOneOf.md @@ -0,0 +1,30 @@ +# WithNestedOneOf + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**size** | **int** | | [optional] +**nested_pig** | [**Pig**](Pig.md) | | [optional] +**nested_oneof_enum_string** | [**OneOfEnumString**](OneOfEnumString.md) | | [optional] + +## Example + +```python +from petstore_api.models.with_nested_one_of import WithNestedOneOf + +# TODO update the JSON string below +json = "{}" +# create an instance of WithNestedOneOf from a JSON string +with_nested_one_of_instance = WithNestedOneOf.from_json(json) +# print the JSON string representation of the object +print WithNestedOneOf.to_json() + +# convert the object into a dict +with_nested_one_of_dict = with_nested_one_of_instance.to_dict() +# create an instance of WithNestedOneOf from a dict +with_nested_one_of_form_dict = with_nested_one_of.from_dict(with_nested_one_of_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) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/git_push.sh b/samples/openapi3/client/petstore/python-pydantic-v1/git_push.sh new file mode 100644 index 00000000000..f53a75d4fab --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/__init__.py new file mode 100644 index 00000000000..2023e72fb35 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/__init__.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +# flake8: noqa + +""" + 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 + + +__version__ = "1.0.0" + +# import apis into sdk package +from petstore_api.api.another_fake_api import AnotherFakeApi +from petstore_api.api.default_api import DefaultApi +from petstore_api.api.fake_api import FakeApi +from petstore_api.api.fake_classname_tags123_api import FakeClassnameTags123Api +from petstore_api.api.pet_api import PetApi +from petstore_api.api.store_api import StoreApi +from petstore_api.api.user_api import UserApi + +# import ApiClient +from petstore_api.api_response import ApiResponse +from petstore_api.api_client import ApiClient +from petstore_api.configuration import Configuration +from petstore_api.exceptions import OpenApiException +from petstore_api.exceptions import ApiTypeError +from petstore_api.exceptions import ApiValueError +from petstore_api.exceptions import ApiKeyError +from petstore_api.exceptions import ApiAttributeError +from petstore_api.exceptions import ApiException +from petstore_api.signing import HttpSigningConfiguration + +# import models into sdk package +from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType +from petstore_api.models.additional_properties_class import AdditionalPropertiesClass +from petstore_api.models.additional_properties_object import AdditionalPropertiesObject +from petstore_api.models.additional_properties_with_description_only import AdditionalPropertiesWithDescriptionOnly +from petstore_api.models.all_of_with_single_ref import AllOfWithSingleRef +from petstore_api.models.animal import Animal +from petstore_api.models.any_of_color import AnyOfColor +from petstore_api.models.any_of_pig import AnyOfPig +from petstore_api.models.api_response import ApiResponse +from petstore_api.models.array_of_array_of_model import ArrayOfArrayOfModel +from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly +from petstore_api.models.array_of_number_only import ArrayOfNumberOnly +from petstore_api.models.array_test import ArrayTest +from petstore_api.models.basque_pig import BasquePig +from petstore_api.models.capitalization import Capitalization +from petstore_api.models.cat import Cat +from petstore_api.models.category import Category +from petstore_api.models.circular_reference_model import CircularReferenceModel +from petstore_api.models.class_model import ClassModel +from petstore_api.models.client import Client +from petstore_api.models.color import Color +from petstore_api.models.creature import Creature +from petstore_api.models.creature_info import CreatureInfo +from petstore_api.models.danish_pig import DanishPig +from petstore_api.models.deprecated_object import DeprecatedObject +from petstore_api.models.dog import Dog +from petstore_api.models.dummy_model import DummyModel +from petstore_api.models.enum_arrays import EnumArrays +from petstore_api.models.enum_class import EnumClass +from petstore_api.models.enum_string1 import EnumString1 +from petstore_api.models.enum_string2 import EnumString2 +from petstore_api.models.enum_test import EnumTest +from petstore_api.models.file import File +from petstore_api.models.file_schema_test_class import FileSchemaTestClass +from petstore_api.models.first_ref import FirstRef +from petstore_api.models.foo import Foo +from petstore_api.models.foo_get_default_response import FooGetDefaultResponse +from petstore_api.models.format_test import FormatTest +from petstore_api.models.has_only_read_only import HasOnlyReadOnly +from petstore_api.models.health_check_result import HealthCheckResult +from petstore_api.models.inner_dict_with_property import InnerDictWithProperty +from petstore_api.models.int_or_string import IntOrString +from petstore_api.models.list import List +from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel +from petstore_api.models.map_test import MapTest +from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass +from petstore_api.models.model200_response import Model200Response +from petstore_api.models.model_return import ModelReturn +from petstore_api.models.name import Name +from petstore_api.models.nullable_class import NullableClass +from petstore_api.models.nullable_property import NullableProperty +from petstore_api.models.number_only import NumberOnly +from petstore_api.models.object_to_test_additional_properties import ObjectToTestAdditionalProperties +from petstore_api.models.object_with_deprecated_fields import ObjectWithDeprecatedFields +from petstore_api.models.one_of_enum_string import OneOfEnumString +from petstore_api.models.order import Order +from petstore_api.models.outer_composite import OuterComposite +from petstore_api.models.outer_enum import OuterEnum +from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue +from petstore_api.models.outer_enum_integer import OuterEnumInteger +from petstore_api.models.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue +from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty +from petstore_api.models.parent import Parent +from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict +from petstore_api.models.pet import Pet +from petstore_api.models.pig import Pig +from petstore_api.models.property_name_collision import PropertyNameCollision +from petstore_api.models.read_only_first import ReadOnlyFirst +from petstore_api.models.second_ref import SecondRef +from petstore_api.models.self_reference_model import SelfReferenceModel +from petstore_api.models.single_ref_type import SingleRefType +from petstore_api.models.special_character_enum import SpecialCharacterEnum +from petstore_api.models.special_model_name import SpecialModelName +from petstore_api.models.special_name import SpecialName +from petstore_api.models.tag import Tag +from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest +from petstore_api.models.tiger import Tiger +from petstore_api.models.user import User +from petstore_api.models.with_nested_one_of import WithNestedOneOf diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/__init__.py new file mode 100644 index 00000000000..7a2616975a2 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/__init__.py @@ -0,0 +1,11 @@ +# flake8: noqa + +# import apis into api package +from petstore_api.api.another_fake_api import AnotherFakeApi +from petstore_api.api.default_api import DefaultApi +from petstore_api.api.fake_api import FakeApi +from petstore_api.api.fake_classname_tags123_api import FakeClassnameTags123Api +from petstore_api.api.pet_api import PetApi +from petstore_api.api.store_api import StoreApi +from petstore_api.api.user_api import UserApi + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/another_fake_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/another_fake_api.py new file mode 100644 index 00000000000..c8ae8d0af13 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/another_fake_api.py @@ -0,0 +1,191 @@ +# 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 re # noqa: F401 +import io +import warnings + +from pydantic import validate_arguments, ValidationError + +from typing_extensions import Annotated +from pydantic import Field + +from petstore_api.models.client import Client + +from petstore_api.api_client import ApiClient +from petstore_api.api_response import ApiResponse +from petstore_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class AnotherFakeApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_arguments + def call_123_test_special_tags(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> Client: # noqa: E501 + """To test special tags # noqa: E501 + + To test special tags and operation ID starting with number # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.call_123_test_special_tags(client, async_req=True) + >>> result = thread.get() + + :param client: client model (required) + :type client: Client + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: Client + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the call_123_test_special_tags_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501 + + @validate_arguments + def call_123_test_special_tags_with_http_info(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> ApiResponse: # noqa: E501 + """To test special tags # noqa: E501 + + To test special tags and operation ID starting with number # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.call_123_test_special_tags_with_http_info(client, async_req=True) + >>> result = thread.get() + + :param client: client model (required) + :type client: Client + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(Client, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'client' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method call_123_test_special_tags" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['client'] is not None: + _body_params = _params['client'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "Client", + } + + return self.api_client.call_api( + '/another-fake/dummy', 'PATCH', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/default_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/default_api.py new file mode 100644 index 00000000000..b5269287737 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/default_api.py @@ -0,0 +1,170 @@ +# 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 re # noqa: F401 +import io +import warnings + +from pydantic import validate_arguments, ValidationError + +from petstore_api.models.foo_get_default_response import FooGetDefaultResponse + +from petstore_api.api_client import ApiClient +from petstore_api.api_response import ApiResponse +from petstore_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class DefaultApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_arguments + def foo_get(self, **kwargs) -> FooGetDefaultResponse: # noqa: E501 + """foo_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.foo_get(async_req=True) + >>> result = thread.get() + + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: FooGetDefaultResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the foo_get_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.foo_get_with_http_info(**kwargs) # noqa: E501 + + @validate_arguments + def foo_get_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 + """foo_get # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.foo_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(FooGetDefaultResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method foo_get" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + } + + return self.api_client.call_api( + '/foo', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/fake_api.py new file mode 100644 index 00000000000..a5c02f94ab7 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/fake_api.py @@ -0,0 +1,3379 @@ +# 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 re # noqa: F401 +import io +import warnings + +from pydantic import validate_arguments, ValidationError + +from typing_extensions import Annotated +from datetime import date, datetime + +from pydantic import Field, StrictBool, StrictBytes, StrictFloat, StrictInt, StrictStr, conbytes, confloat, conint, conlist, constr, validator + +from typing import Any, Dict, List, Optional, Union + +from petstore_api.models.client import Client +from petstore_api.models.enum_class import EnumClass +from petstore_api.models.file_schema_test_class import FileSchemaTestClass +from petstore_api.models.health_check_result import HealthCheckResult +from petstore_api.models.outer_composite import OuterComposite +from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty +from petstore_api.models.pet import Pet +from petstore_api.models.tag import Tag +from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest +from petstore_api.models.user import User + +from petstore_api.api_client import ApiClient +from petstore_api.api_response import ApiResponse +from petstore_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class FakeApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_arguments + def fake_any_type_request_body(self, body : Optional[Dict[str, Any]] = None, **kwargs) -> None: # noqa: E501 + """test any type request body # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fake_any_type_request_body(body, async_req=True) + >>> result = thread.get() + + :param body: + :type body: object + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the fake_any_type_request_body_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.fake_any_type_request_body_with_http_info(body, **kwargs) # noqa: E501 + + @validate_arguments + def fake_any_type_request_body_with_http_info(self, body : Optional[Dict[str, Any]] = None, **kwargs) -> ApiResponse: # noqa: E501 + """test any type request body # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fake_any_type_request_body_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param body: + :type body: object + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'body' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_any_type_request_body" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['body'] is not None: + _body_params = _params['body'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/fake/any_type_body', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def fake_enum_ref_query_parameter(self, enum_ref : Annotated[Optional[EnumClass], Field(description="enum reference")] = None, **kwargs) -> None: # noqa: E501 + """test enum reference query parameter # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fake_enum_ref_query_parameter(enum_ref, async_req=True) + >>> result = thread.get() + + :param enum_ref: enum reference + :type enum_ref: EnumClass + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the fake_enum_ref_query_parameter_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.fake_enum_ref_query_parameter_with_http_info(enum_ref, **kwargs) # noqa: E501 + + @validate_arguments + def fake_enum_ref_query_parameter_with_http_info(self, enum_ref : Annotated[Optional[EnumClass], Field(description="enum reference")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """test enum reference query parameter # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fake_enum_ref_query_parameter_with_http_info(enum_ref, async_req=True) + >>> result = thread.get() + + :param enum_ref: enum reference + :type enum_ref: EnumClass + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'enum_ref' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_enum_ref_query_parameter" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('enum_ref') is not None: # noqa: E501 + _query_params.append(('enum_ref', _params['enum_ref'].value)) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/fake/enum_ref_query_parameter', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def fake_health_get(self, **kwargs) -> HealthCheckResult: # noqa: E501 + """Health check endpoint # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fake_health_get(async_req=True) + >>> result = thread.get() + + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: HealthCheckResult + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the fake_health_get_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.fake_health_get_with_http_info(**kwargs) # noqa: E501 + + @validate_arguments + def fake_health_get_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 + """Health check endpoint # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fake_health_get_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(HealthCheckResult, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_health_get" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "HealthCheckResult", + } + + return self.api_client.call_api( + '/fake/health', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def fake_http_signature_test(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], query_1 : Annotated[Optional[StrictStr], Field(description="query parameter")] = None, header_1 : Annotated[Optional[StrictStr], Field(description="header parameter")] = None, **kwargs) -> None: # noqa: E501 + """test http signature authentication # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fake_http_signature_test(pet, query_1, header_1, async_req=True) + >>> result = thread.get() + + :param pet: Pet object that needs to be added to the store (required) + :type pet: Pet + :param query_1: query parameter + :type query_1: str + :param header_1: header parameter + :type header_1: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the fake_http_signature_test_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.fake_http_signature_test_with_http_info(pet, query_1, header_1, **kwargs) # noqa: E501 + + @validate_arguments + def fake_http_signature_test_with_http_info(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], query_1 : Annotated[Optional[StrictStr], Field(description="query parameter")] = None, header_1 : Annotated[Optional[StrictStr], Field(description="header parameter")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """test http signature authentication # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fake_http_signature_test_with_http_info(pet, query_1, header_1, async_req=True) + >>> result = thread.get() + + :param pet: Pet object that needs to be added to the store (required) + :type pet: Pet + :param query_1: query parameter + :type query_1: str + :param header_1: header parameter + :type header_1: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'pet', + 'query_1', + 'header_1' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_http_signature_test" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('query_1') is not None: # noqa: E501 + _query_params.append(('query_1', _params['query_1'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if _params['header_1'] is not None: + _header_params['header_1'] = _params['header_1'] + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['pet'] is not None: + _body_params = _params['pet'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json', 'application/xml'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['http_signature_test'] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/fake/http-signature-test', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def fake_outer_boolean_serialize(self, body : Annotated[Optional[StrictBool], Field(description="Input boolean as post body")] = None, **kwargs) -> bool: # noqa: E501 + """fake_outer_boolean_serialize # noqa: E501 + + Test serialization of outer boolean types # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fake_outer_boolean_serialize(body, async_req=True) + >>> result = thread.get() + + :param body: Input boolean as post body + :type body: bool + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: bool + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the fake_outer_boolean_serialize_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.fake_outer_boolean_serialize_with_http_info(body, **kwargs) # noqa: E501 + + @validate_arguments + def fake_outer_boolean_serialize_with_http_info(self, body : Annotated[Optional[StrictBool], Field(description="Input boolean as post body")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """fake_outer_boolean_serialize # noqa: E501 + + Test serialization of outer boolean types # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fake_outer_boolean_serialize_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param body: Input boolean as post body + :type body: bool + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(bool, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'body' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_outer_boolean_serialize" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['body'] is not None: + _body_params = _params['body'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "bool", + } + + return self.api_client.call_api( + '/fake/outer/boolean', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def fake_outer_composite_serialize(self, outer_composite : Annotated[Optional[OuterComposite], Field(description="Input composite as post body")] = None, **kwargs) -> OuterComposite: # noqa: E501 + """fake_outer_composite_serialize # noqa: E501 + + Test serialization of object with outer number type # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fake_outer_composite_serialize(outer_composite, async_req=True) + >>> result = thread.get() + + :param outer_composite: Input composite as post body + :type outer_composite: OuterComposite + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: OuterComposite + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the fake_outer_composite_serialize_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.fake_outer_composite_serialize_with_http_info(outer_composite, **kwargs) # noqa: E501 + + @validate_arguments + def fake_outer_composite_serialize_with_http_info(self, outer_composite : Annotated[Optional[OuterComposite], Field(description="Input composite as post body")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """fake_outer_composite_serialize # noqa: E501 + + Test serialization of object with outer number type # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fake_outer_composite_serialize_with_http_info(outer_composite, async_req=True) + >>> result = thread.get() + + :param outer_composite: Input composite as post body + :type outer_composite: OuterComposite + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(OuterComposite, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'outer_composite' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_outer_composite_serialize" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['outer_composite'] is not None: + _body_params = _params['outer_composite'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "OuterComposite", + } + + return self.api_client.call_api( + '/fake/outer/composite', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def fake_outer_number_serialize(self, body : Annotated[Optional[StrictFloat], Field(description="Input number as post body")] = None, **kwargs) -> float: # noqa: E501 + """fake_outer_number_serialize # noqa: E501 + + Test serialization of outer number types # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fake_outer_number_serialize(body, async_req=True) + >>> result = thread.get() + + :param body: Input number as post body + :type body: float + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: float + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the fake_outer_number_serialize_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.fake_outer_number_serialize_with_http_info(body, **kwargs) # noqa: E501 + + @validate_arguments + def fake_outer_number_serialize_with_http_info(self, body : Annotated[Optional[StrictFloat], Field(description="Input number as post body")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """fake_outer_number_serialize # noqa: E501 + + Test serialization of outer number types # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fake_outer_number_serialize_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param body: Input number as post body + :type body: float + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(float, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'body' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_outer_number_serialize" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['body'] is not None: + _body_params = _params['body'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "float", + } + + return self.api_client.call_api( + '/fake/outer/number', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def fake_outer_string_serialize(self, body : Annotated[Optional[StrictStr], Field(description="Input string as post body")] = None, **kwargs) -> str: # noqa: E501 + """fake_outer_string_serialize # noqa: E501 + + Test serialization of outer string types # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fake_outer_string_serialize(body, async_req=True) + >>> result = thread.get() + + :param body: Input string as post body + :type body: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the fake_outer_string_serialize_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.fake_outer_string_serialize_with_http_info(body, **kwargs) # noqa: E501 + + @validate_arguments + def fake_outer_string_serialize_with_http_info(self, body : Annotated[Optional[StrictStr], Field(description="Input string as post body")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """fake_outer_string_serialize # noqa: E501 + + Test serialization of outer string types # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fake_outer_string_serialize_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param body: Input string as post body + :type body: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'body' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_outer_string_serialize" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['body'] is not None: + _body_params = _params['body'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "str", + } + + return self.api_client.call_api( + '/fake/outer/string', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def fake_property_enum_integer_serialize(self, outer_object_with_enum_property : Annotated[OuterObjectWithEnumProperty, Field(..., description="Input enum (int) as post body")], **kwargs) -> OuterObjectWithEnumProperty: # noqa: E501 + """fake_property_enum_integer_serialize # noqa: E501 + + Test serialization of enum (int) properties with examples # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fake_property_enum_integer_serialize(outer_object_with_enum_property, async_req=True) + >>> result = thread.get() + + :param outer_object_with_enum_property: Input enum (int) as post body (required) + :type outer_object_with_enum_property: OuterObjectWithEnumProperty + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: OuterObjectWithEnumProperty + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the fake_property_enum_integer_serialize_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_property, **kwargs) # noqa: E501 + + @validate_arguments + def fake_property_enum_integer_serialize_with_http_info(self, outer_object_with_enum_property : Annotated[OuterObjectWithEnumProperty, Field(..., description="Input enum (int) as post body")], **kwargs) -> ApiResponse: # noqa: E501 + """fake_property_enum_integer_serialize # noqa: E501 + + Test serialization of enum (int) properties with examples # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_property, async_req=True) + >>> result = thread.get() + + :param outer_object_with_enum_property: Input enum (int) as post body (required) + :type outer_object_with_enum_property: OuterObjectWithEnumProperty + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(OuterObjectWithEnumProperty, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'outer_object_with_enum_property' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_property_enum_integer_serialize" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['outer_object_with_enum_property'] is not None: + _body_params = _params['outer_object_with_enum_property'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['*/*']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "OuterObjectWithEnumProperty", + } + + return self.api_client.call_api( + '/fake/property/enum-int', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def fake_return_list_of_objects(self, **kwargs) -> List[List[Tag]]: # noqa: E501 + """test returning list of objects # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fake_return_list_of_objects(async_req=True) + >>> result = thread.get() + + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: List[List[Tag]] + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the fake_return_list_of_objects_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.fake_return_list_of_objects_with_http_info(**kwargs) # noqa: E501 + + @validate_arguments + def fake_return_list_of_objects_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 + """test returning list of objects # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fake_return_list_of_objects_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(List[List[Tag]], status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_return_list_of_objects" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "List[List[Tag]]", + } + + return self.api_client.call_api( + '/fake/return_list_of_object', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def fake_uuid_example(self, uuid_example : Annotated[StrictStr, Field(..., description="uuid example")], **kwargs) -> None: # noqa: E501 + """test uuid example # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fake_uuid_example(uuid_example, async_req=True) + >>> result = thread.get() + + :param uuid_example: uuid example (required) + :type uuid_example: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the fake_uuid_example_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.fake_uuid_example_with_http_info(uuid_example, **kwargs) # noqa: E501 + + @validate_arguments + def fake_uuid_example_with_http_info(self, uuid_example : Annotated[StrictStr, Field(..., description="uuid example")], **kwargs) -> ApiResponse: # noqa: E501 + """test uuid example # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fake_uuid_example_with_http_info(uuid_example, async_req=True) + >>> result = thread.get() + + :param uuid_example: uuid example (required) + :type uuid_example: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'uuid_example' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_uuid_example" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('uuid_example') is not None: # noqa: E501 + _query_params.append(('uuid_example', _params['uuid_example'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/fake/uuid_example', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_body_with_binary(self, body : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(..., description="image to upload")], **kwargs) -> None: # noqa: E501 + """test_body_with_binary # noqa: E501 + + For this test, the body has to be a binary file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_body_with_binary(body, async_req=True) + >>> result = thread.get() + + :param body: image to upload (required) + :type body: bytearray + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_body_with_binary_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_body_with_binary_with_http_info(body, **kwargs) # noqa: E501 + + @validate_arguments + def test_body_with_binary_with_http_info(self, body : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(..., description="image to upload")], **kwargs) -> ApiResponse: # noqa: E501 + """test_body_with_binary # noqa: E501 + + For this test, the body has to be a binary file. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_body_with_binary_with_http_info(body, async_req=True) + >>> result = thread.get() + + :param body: image to upload (required) + :type body: bytearray + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'body' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_body_with_binary" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['body'] is not None: + _body_params = _params['body'] + # convert to byte array if the input is a file name (str) + if isinstance(_body_params, str): + with io.open(_body_params, "rb") as _fp: + _body_params_from_file = _fp.read() + _body_params = _body_params_from_file + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['image/png'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/fake/body-with-binary', 'PUT', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_body_with_file_schema(self, file_schema_test_class : FileSchemaTestClass, **kwargs) -> None: # noqa: E501 + """test_body_with_file_schema # noqa: E501 + + For this test, the body for this request must reference a schema named `File`. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_body_with_file_schema(file_schema_test_class, async_req=True) + >>> result = thread.get() + + :param file_schema_test_class: (required) + :type file_schema_test_class: FileSchemaTestClass + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_body_with_file_schema_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_body_with_file_schema_with_http_info(file_schema_test_class, **kwargs) # noqa: E501 + + @validate_arguments + def test_body_with_file_schema_with_http_info(self, file_schema_test_class : FileSchemaTestClass, **kwargs) -> ApiResponse: # noqa: E501 + """test_body_with_file_schema # noqa: E501 + + For this test, the body for this request must reference a schema named `File`. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_body_with_file_schema_with_http_info(file_schema_test_class, async_req=True) + >>> result = thread.get() + + :param file_schema_test_class: (required) + :type file_schema_test_class: FileSchemaTestClass + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'file_schema_test_class' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_body_with_file_schema" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['file_schema_test_class'] is not None: + _body_params = _params['file_schema_test_class'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/fake/body-with-file-schema', 'PUT', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_body_with_query_params(self, query : StrictStr, user : User, **kwargs) -> None: # noqa: E501 + """test_body_with_query_params # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_body_with_query_params(query, user, async_req=True) + >>> result = thread.get() + + :param query: (required) + :type query: str + :param user: (required) + :type user: User + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_body_with_query_params_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_body_with_query_params_with_http_info(query, user, **kwargs) # noqa: E501 + + @validate_arguments + def test_body_with_query_params_with_http_info(self, query : StrictStr, user : User, **kwargs) -> ApiResponse: # noqa: E501 + """test_body_with_query_params # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_body_with_query_params_with_http_info(query, user, async_req=True) + >>> result = thread.get() + + :param query: (required) + :type query: str + :param user: (required) + :type user: User + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'query', + 'user' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_body_with_query_params" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('query') is not None: # noqa: E501 + _query_params.append(('query', _params['query'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['user'] is not None: + _body_params = _params['user'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/fake/body-with-query-params', 'PUT', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_client_model(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> Client: # noqa: E501 + """To test \"client\" model # noqa: E501 + + To test \"client\" model # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_client_model(client, async_req=True) + >>> result = thread.get() + + :param client: client model (required) + :type client: Client + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: Client + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_client_model_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_client_model_with_http_info(client, **kwargs) # noqa: E501 + + @validate_arguments + def test_client_model_with_http_info(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> ApiResponse: # noqa: E501 + """To test \"client\" model # noqa: E501 + + To test \"client\" model # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_client_model_with_http_info(client, async_req=True) + >>> result = thread.get() + + :param client: client model (required) + :type client: Client + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(Client, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'client' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_client_model" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['client'] is not None: + _body_params = _params['client'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "Client", + } + + return self.api_client.call_api( + '/fake', 'PATCH', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_date_time_query_parameter(self, date_time_query : datetime, str_query : StrictStr, **kwargs) -> None: # noqa: E501 + """test_date_time_query_parameter # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_date_time_query_parameter(date_time_query, str_query, async_req=True) + >>> result = thread.get() + + :param date_time_query: (required) + :type date_time_query: datetime + :param str_query: (required) + :type str_query: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_date_time_query_parameter_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_date_time_query_parameter_with_http_info(date_time_query, str_query, **kwargs) # noqa: E501 + + @validate_arguments + def test_date_time_query_parameter_with_http_info(self, date_time_query : datetime, str_query : StrictStr, **kwargs) -> ApiResponse: # noqa: E501 + """test_date_time_query_parameter # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_date_time_query_parameter_with_http_info(date_time_query, str_query, async_req=True) + >>> result = thread.get() + + :param date_time_query: (required) + :type date_time_query: datetime + :param str_query: (required) + :type str_query: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'date_time_query', + 'str_query' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_date_time_query_parameter" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('date_time_query') is not None: # noqa: E501 + if isinstance(_params['date_time_query'], datetime): + _query_params.append(('date_time_query', _params['date_time_query'].strftime(self.api_client.configuration.datetime_format))) + else: + _query_params.append(('date_time_query', _params['date_time_query'])) + + if _params.get('str_query') is not None: # noqa: E501 + _query_params.append(('str_query', _params['str_query'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/fake/date-time-query-params', 'PUT', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_endpoint_parameters(self, number : Annotated[confloat(le=543.2, ge=32.1, strict=True), Field(..., description="None")], double : Annotated[confloat(le=123.4, ge=67.8, strict=True), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(le=987.6, strict=True)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[conbytes(strict=True, max_length=64), constr(strict=True, max_length=64)]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> None: # noqa: E501 + """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 + + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_endpoint_parameters(number, double, pattern_without_delimiter, byte, integer, int32, int64, float, string, binary, byte_with_max_length, var_date, date_time, password, param_callback, async_req=True) + >>> result = thread.get() + + :param number: None (required) + :type number: float + :param double: None (required) + :type double: float + :param pattern_without_delimiter: None (required) + :type pattern_without_delimiter: str + :param byte: None (required) + :type byte: bytearray + :param integer: None + :type integer: int + :param int32: None + :type int32: int + :param int64: None + :type int64: int + :param float: None + :type float: float + :param string: None + :type string: str + :param binary: None + :type binary: bytearray + :param byte_with_max_length: None + :type byte_with_max_length: bytearray + :param var_date: None + :type var_date: date + :param date_time: None + :type date_time: datetime + :param password: None + :type password: str + :param param_callback: None + :type param_callback: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_endpoint_parameters_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, integer, int32, int64, float, string, binary, byte_with_max_length, var_date, date_time, password, param_callback, **kwargs) # noqa: E501 + + @validate_arguments + def test_endpoint_parameters_with_http_info(self, number : Annotated[confloat(le=543.2, ge=32.1, strict=True), Field(..., description="None")], double : Annotated[confloat(le=123.4, ge=67.8, strict=True), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(le=987.6, strict=True)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[conbytes(strict=True, max_length=64), constr(strict=True, max_length=64)]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 + + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, integer, int32, int64, float, string, binary, byte_with_max_length, var_date, date_time, password, param_callback, async_req=True) + >>> result = thread.get() + + :param number: None (required) + :type number: float + :param double: None (required) + :type double: float + :param pattern_without_delimiter: None (required) + :type pattern_without_delimiter: str + :param byte: None (required) + :type byte: bytearray + :param integer: None + :type integer: int + :param int32: None + :type int32: int + :param int64: None + :type int64: int + :param float: None + :type float: float + :param string: None + :type string: str + :param binary: None + :type binary: bytearray + :param byte_with_max_length: None + :type byte_with_max_length: bytearray + :param var_date: None + :type var_date: date + :param date_time: None + :type date_time: datetime + :param password: None + :type password: str + :param param_callback: None + :type param_callback: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'number', + 'double', + 'pattern_without_delimiter', + 'byte', + 'integer', + 'int32', + 'int64', + 'float', + 'string', + 'binary', + 'byte_with_max_length', + 'var_date', + 'date_time', + 'password', + 'param_callback' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_endpoint_parameters" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + if _params['integer'] is not None: + _form_params.append(('integer', _params['integer'])) + + if _params['int32'] is not None: + _form_params.append(('int32', _params['int32'])) + + if _params['int64'] is not None: + _form_params.append(('int64', _params['int64'])) + + if _params['number'] is not None: + _form_params.append(('number', _params['number'])) + + if _params['float'] is not None: + _form_params.append(('float', _params['float'])) + + if _params['double'] is not None: + _form_params.append(('double', _params['double'])) + + if _params['string'] is not None: + _form_params.append(('string', _params['string'])) + + if _params['pattern_without_delimiter'] is not None: + _form_params.append(('pattern_without_delimiter', _params['pattern_without_delimiter'])) + + if _params['byte'] is not None: + _form_params.append(('byte', _params['byte'])) + + if _params['binary'] is not None: + _files['binary'] = _params['binary'] + + if _params['byte_with_max_length'] is not None: + _form_params.append(('byte_with_max_length', _params['byte_with_max_length'])) + + if _params['var_date'] is not None: + _form_params.append(('date', _params['var_date'])) + + if _params['date_time'] is not None: + _form_params.append(('dateTime', _params['date_time'])) + + if _params['password'] is not None: + _form_params.append(('password', _params['password'])) + + if _params['param_callback'] is not None: + _form_params.append(('callback', _params['param_callback'])) + + # process the body parameter + _body_params = None + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/x-www-form-urlencoded'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['http_basic_test'] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/fake', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_group_parameters(self, required_string_group : Annotated[StrictInt, Field(..., description="Required String in group parameters")], required_boolean_group : Annotated[StrictBool, Field(..., description="Required Boolean in group parameters")], required_int64_group : Annotated[StrictInt, Field(..., description="Required Integer in group parameters")], string_group : Annotated[Optional[StrictInt], Field(description="String in group parameters")] = None, boolean_group : Annotated[Optional[StrictBool], Field(description="Boolean in group parameters")] = None, int64_group : Annotated[Optional[StrictInt], Field(description="Integer in group parameters")] = None, **kwargs) -> None: # noqa: E501 + """Fake endpoint to test group parameters (optional) # noqa: E501 + + Fake endpoint to test group parameters (optional) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_group_parameters(required_string_group, required_boolean_group, required_int64_group, string_group, boolean_group, int64_group, async_req=True) + >>> result = thread.get() + + :param required_string_group: Required String in group parameters (required) + :type required_string_group: int + :param required_boolean_group: Required Boolean in group parameters (required) + :type required_boolean_group: bool + :param required_int64_group: Required Integer in group parameters (required) + :type required_int64_group: int + :param string_group: String in group parameters + :type string_group: int + :param boolean_group: Boolean in group parameters + :type boolean_group: bool + :param int64_group: Integer in group parameters + :type int64_group: int + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_group_parameters_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_group_parameters_with_http_info(required_string_group, required_boolean_group, required_int64_group, string_group, boolean_group, int64_group, **kwargs) # noqa: E501 + + @validate_arguments + def test_group_parameters_with_http_info(self, required_string_group : Annotated[StrictInt, Field(..., description="Required String in group parameters")], required_boolean_group : Annotated[StrictBool, Field(..., description="Required Boolean in group parameters")], required_int64_group : Annotated[StrictInt, Field(..., description="Required Integer in group parameters")], string_group : Annotated[Optional[StrictInt], Field(description="String in group parameters")] = None, boolean_group : Annotated[Optional[StrictBool], Field(description="Boolean in group parameters")] = None, int64_group : Annotated[Optional[StrictInt], Field(description="Integer in group parameters")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Fake endpoint to test group parameters (optional) # noqa: E501 + + Fake endpoint to test group parameters (optional) # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_group_parameters_with_http_info(required_string_group, required_boolean_group, required_int64_group, string_group, boolean_group, int64_group, async_req=True) + >>> result = thread.get() + + :param required_string_group: Required String in group parameters (required) + :type required_string_group: int + :param required_boolean_group: Required Boolean in group parameters (required) + :type required_boolean_group: bool + :param required_int64_group: Required Integer in group parameters (required) + :type required_int64_group: int + :param string_group: String in group parameters + :type string_group: int + :param boolean_group: Boolean in group parameters + :type boolean_group: bool + :param int64_group: Integer in group parameters + :type int64_group: int + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'required_string_group', + 'required_boolean_group', + 'required_int64_group', + 'string_group', + 'boolean_group', + 'int64_group' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_group_parameters" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('required_string_group') is not None: # noqa: E501 + _query_params.append(('required_string_group', _params['required_string_group'])) + + if _params.get('required_int64_group') is not None: # noqa: E501 + _query_params.append(('required_int64_group', _params['required_int64_group'])) + + if _params.get('string_group') is not None: # noqa: E501 + _query_params.append(('string_group', _params['string_group'])) + + if _params.get('int64_group') is not None: # noqa: E501 + _query_params.append(('int64_group', _params['int64_group'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if _params['required_boolean_group'] is not None: + _header_params['required_boolean_group'] = _params['required_boolean_group'] + + if _params['boolean_group'] is not None: + _header_params['boolean_group'] = _params['boolean_group'] + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # authentication setting + _auth_settings = ['bearer_test'] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/fake', 'DELETE', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_inline_additional_properties(self, request_body : Annotated[Dict[str, StrictStr], Field(..., description="request body")], **kwargs) -> None: # noqa: E501 + """test inline additionalProperties # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_inline_additional_properties(request_body, async_req=True) + >>> result = thread.get() + + :param request_body: request body (required) + :type request_body: Dict[str, str] + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_inline_additional_properties_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_inline_additional_properties_with_http_info(request_body, **kwargs) # noqa: E501 + + @validate_arguments + def test_inline_additional_properties_with_http_info(self, request_body : Annotated[Dict[str, StrictStr], Field(..., description="request body")], **kwargs) -> ApiResponse: # noqa: E501 + """test inline additionalProperties # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_inline_additional_properties_with_http_info(request_body, async_req=True) + >>> result = thread.get() + + :param request_body: request body (required) + :type request_body: Dict[str, str] + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'request_body' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_inline_additional_properties" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['request_body'] is not None: + _body_params = _params['request_body'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/fake/inline-additionalProperties', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_inline_freeform_additional_properties(self, test_inline_freeform_additional_properties_request : Annotated[TestInlineFreeformAdditionalPropertiesRequest, Field(..., description="request body")], **kwargs) -> None: # noqa: E501 + """test inline free-form additionalProperties # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_inline_freeform_additional_properties(test_inline_freeform_additional_properties_request, async_req=True) + >>> result = thread.get() + + :param test_inline_freeform_additional_properties_request: request body (required) + :type test_inline_freeform_additional_properties_request: TestInlineFreeformAdditionalPropertiesRequest + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_inline_freeform_additional_properties_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_inline_freeform_additional_properties_with_http_info(test_inline_freeform_additional_properties_request, **kwargs) # noqa: E501 + + @validate_arguments + def test_inline_freeform_additional_properties_with_http_info(self, test_inline_freeform_additional_properties_request : Annotated[TestInlineFreeformAdditionalPropertiesRequest, Field(..., description="request body")], **kwargs) -> ApiResponse: # noqa: E501 + """test inline free-form additionalProperties # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_inline_freeform_additional_properties_with_http_info(test_inline_freeform_additional_properties_request, async_req=True) + >>> result = thread.get() + + :param test_inline_freeform_additional_properties_request: request body (required) + :type test_inline_freeform_additional_properties_request: TestInlineFreeformAdditionalPropertiesRequest + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'test_inline_freeform_additional_properties_request' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_inline_freeform_additional_properties" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['test_inline_freeform_additional_properties_request'] is not None: + _body_params = _params['test_inline_freeform_additional_properties_request'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/fake/inline-freeform-additionalProperties', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_json_form_data(self, param : Annotated[StrictStr, Field(..., description="field1")], param2 : Annotated[StrictStr, Field(..., description="field2")], **kwargs) -> None: # noqa: E501 + """test json serialization of form data # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_json_form_data(param, param2, async_req=True) + >>> result = thread.get() + + :param param: field1 (required) + :type param: str + :param param2: field2 (required) + :type param2: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_json_form_data_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_json_form_data_with_http_info(param, param2, **kwargs) # noqa: E501 + + @validate_arguments + def test_json_form_data_with_http_info(self, param : Annotated[StrictStr, Field(..., description="field1")], param2 : Annotated[StrictStr, Field(..., description="field2")], **kwargs) -> ApiResponse: # noqa: E501 + """test json serialization of form data # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_json_form_data_with_http_info(param, param2, async_req=True) + >>> result = thread.get() + + :param param: field1 (required) + :type param: str + :param param2: field2 (required) + :type param2: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'param', + 'param2' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_json_form_data" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + if _params['param'] is not None: + _form_params.append(('param', _params['param'])) + + if _params['param2'] is not None: + _form_params.append(('param2', _params['param2'])) + + # process the body parameter + _body_params = None + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/x-www-form-urlencoded'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/fake/jsonFormData', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def test_query_parameter_collection_format(self, pipe : conlist(StrictStr), ioutil : conlist(StrictStr), http : conlist(StrictStr), url : conlist(StrictStr), context : conlist(StrictStr), allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs) -> None: # noqa: E501 + """test_query_parameter_collection_format # noqa: E501 + + To test the collection format in query parameters # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_query_parameter_collection_format(pipe, ioutil, http, url, context, allow_empty, language, async_req=True) + >>> result = thread.get() + + :param pipe: (required) + :type pipe: List[str] + :param ioutil: (required) + :type ioutil: List[str] + :param http: (required) + :type http: List[str] + :param url: (required) + :type url: List[str] + :param context: (required) + :type context: List[str] + :param allow_empty: (required) + :type allow_empty: str + :param language: + :type language: Dict[str, str] + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_query_parameter_collection_format_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_query_parameter_collection_format_with_http_info(pipe, ioutil, http, url, context, allow_empty, language, **kwargs) # noqa: E501 + + @validate_arguments + def test_query_parameter_collection_format_with_http_info(self, pipe : conlist(StrictStr), ioutil : conlist(StrictStr), http : conlist(StrictStr), url : conlist(StrictStr), context : conlist(StrictStr), allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs) -> ApiResponse: # noqa: E501 + """test_query_parameter_collection_format # noqa: E501 + + To test the collection format in query parameters # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_query_parameter_collection_format_with_http_info(pipe, ioutil, http, url, context, allow_empty, language, async_req=True) + >>> result = thread.get() + + :param pipe: (required) + :type pipe: List[str] + :param ioutil: (required) + :type ioutil: List[str] + :param http: (required) + :type http: List[str] + :param url: (required) + :type url: List[str] + :param context: (required) + :type context: List[str] + :param allow_empty: (required) + :type allow_empty: str + :param language: + :type language: Dict[str, str] + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'pipe', + 'ioutil', + 'http', + 'url', + 'context', + 'allow_empty', + 'language' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_query_parameter_collection_format" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('pipe') is not None: # noqa: E501 + _query_params.append(('pipe', _params['pipe'])) + _collection_formats['pipe'] = 'pipes' + + if _params.get('ioutil') is not None: # noqa: E501 + _query_params.append(('ioutil', _params['ioutil'])) + _collection_formats['ioutil'] = 'csv' + + if _params.get('http') is not None: # noqa: E501 + _query_params.append(('http', _params['http'])) + _collection_formats['http'] = 'ssv' + + if _params.get('url') is not None: # noqa: E501 + _query_params.append(('url', _params['url'])) + _collection_formats['url'] = 'csv' + + if _params.get('context') is not None: # noqa: E501 + _query_params.append(('context', _params['context'])) + _collection_formats['context'] = 'multi' + + if _params.get('language') is not None: # noqa: E501 + _query_params.append(('language', _params['language'])) + + if _params.get('allow_empty') is not None: # noqa: E501 + _query_params.append(('allowEmpty', _params['allow_empty'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/fake/test-query-parameters', 'PUT', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/fake_classname_tags123_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/fake_classname_tags123_api.py new file mode 100644 index 00000000000..acfe8c01a94 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/fake_classname_tags123_api.py @@ -0,0 +1,191 @@ +# 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 re # noqa: F401 +import io +import warnings + +from pydantic import validate_arguments, ValidationError + +from typing_extensions import Annotated +from pydantic import Field + +from petstore_api.models.client import Client + +from petstore_api.api_client import ApiClient +from petstore_api.api_response import ApiResponse +from petstore_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class FakeClassnameTags123Api: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_arguments + def test_classname(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> Client: # noqa: E501 + """To test class name in snake case # noqa: E501 + + To test class name in snake case # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_classname(client, async_req=True) + >>> result = thread.get() + + :param client: client model (required) + :type client: Client + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: Client + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the test_classname_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.test_classname_with_http_info(client, **kwargs) # noqa: E501 + + @validate_arguments + def test_classname_with_http_info(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> ApiResponse: # noqa: E501 + """To test class name in snake case # noqa: E501 + + To test class name in snake case # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.test_classname_with_http_info(client, async_req=True) + >>> result = thread.get() + + :param client: client model (required) + :type client: Client + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(Client, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'client' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method test_classname" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['client'] is not None: + _body_params = _params['client'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['api_key_query'] # noqa: E501 + + _response_types_map = { + '200': "Client", + } + + return self.api_client.call_api( + '/fake_classname_test', 'PATCH', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/pet_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/pet_api.py new file mode 100644 index 00000000000..44df5ee2660 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/pet_api.py @@ -0,0 +1,1382 @@ +# 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 re # noqa: F401 +import io +import warnings + +from pydantic import validate_arguments, ValidationError + +from typing_extensions import Annotated +from pydantic import Field, StrictBytes, StrictInt, StrictStr, conlist, validator + +from typing import List, Optional, Union + +from petstore_api.models.api_response import ApiResponse +from petstore_api.models.pet import Pet + +from petstore_api.api_client import ApiClient +from petstore_api.api_response import ApiResponse +from petstore_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class PetApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_arguments + def add_pet(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], **kwargs) -> None: # noqa: E501 + """Add a new pet to the store # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.add_pet(pet, async_req=True) + >>> result = thread.get() + + :param pet: Pet object that needs to be added to the store (required) + :type pet: Pet + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the add_pet_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.add_pet_with_http_info(pet, **kwargs) # noqa: E501 + + @validate_arguments + def add_pet_with_http_info(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], **kwargs) -> ApiResponse: # noqa: E501 + """Add a new pet to the store # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.add_pet_with_http_info(pet, async_req=True) + >>> result = thread.get() + + :param pet: Pet object that needs to be added to the store (required) + :type pet: Pet + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'pet' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method add_pet" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['pet'] is not None: + _body_params = _params['pet'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json', 'application/xml'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['petstore_auth', 'http_signature_test'] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/pet', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def delete_pet(self, pet_id : Annotated[StrictInt, Field(..., description="Pet id to delete")], api_key : Optional[StrictStr] = None, **kwargs) -> None: # noqa: E501 + """Deletes a pet # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.delete_pet(pet_id, api_key, async_req=True) + >>> result = thread.get() + + :param pet_id: Pet id to delete (required) + :type pet_id: int + :param api_key: + :type api_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the delete_pet_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.delete_pet_with_http_info(pet_id, api_key, **kwargs) # noqa: E501 + + @validate_arguments + def delete_pet_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="Pet id to delete")], api_key : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Deletes a pet # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.delete_pet_with_http_info(pet_id, api_key, async_req=True) + >>> result = thread.get() + + :param pet_id: Pet id to delete (required) + :type pet_id: int + :param api_key: + :type api_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'pet_id', + 'api_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_pet" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['pet_id'] is not None: + _path_params['petId'] = _params['pet_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if _params['api_key'] is not None: + _header_params['api_key'] = _params['api_key'] + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # authentication setting + _auth_settings = ['petstore_auth'] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/pet/{petId}', 'DELETE', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def find_pets_by_status(self, status : Annotated[conlist(StrictStr), Field(..., description="Status values that need to be considered for filter")], **kwargs) -> List[Pet]: # noqa: E501 + """Finds Pets by status # noqa: E501 + + Multiple status values can be provided with comma separated strings # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.find_pets_by_status(status, async_req=True) + >>> result = thread.get() + + :param status: Status values that need to be considered for filter (required) + :type status: List[str] + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: List[Pet] + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the find_pets_by_status_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.find_pets_by_status_with_http_info(status, **kwargs) # noqa: E501 + + @validate_arguments + def find_pets_by_status_with_http_info(self, status : Annotated[conlist(StrictStr), Field(..., description="Status values that need to be considered for filter")], **kwargs) -> ApiResponse: # noqa: E501 + """Finds Pets by status # noqa: E501 + + Multiple status values can be provided with comma separated strings # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.find_pets_by_status_with_http_info(status, async_req=True) + >>> result = thread.get() + + :param status: Status values that need to be considered for filter (required) + :type status: List[str] + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(List[Pet], status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'status' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method find_pets_by_status" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('status') is not None: # noqa: E501 + _query_params.append(('status', _params['status'])) + _collection_formats['status'] = 'csv' + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/xml', 'application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['petstore_auth', 'http_signature_test'] # noqa: E501 + + _response_types_map = { + '200': "List[Pet]", + '400': None, + } + + return self.api_client.call_api( + '/pet/findByStatus', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def find_pets_by_tags(self, tags : Annotated[conlist(StrictStr, unique_items=True), Field(..., description="Tags to filter by")], **kwargs) -> List[Pet]: # noqa: E501 + """(Deprecated) Finds Pets by tags # noqa: E501 + + Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.find_pets_by_tags(tags, async_req=True) + >>> result = thread.get() + + :param tags: Tags to filter by (required) + :type tags: List[str] + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: List[Pet] + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the find_pets_by_tags_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.find_pets_by_tags_with_http_info(tags, **kwargs) # noqa: E501 + + @validate_arguments + def find_pets_by_tags_with_http_info(self, tags : Annotated[conlist(StrictStr, unique_items=True), Field(..., description="Tags to filter by")], **kwargs) -> ApiResponse: # noqa: E501 + """(Deprecated) Finds Pets by tags # noqa: E501 + + Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.find_pets_by_tags_with_http_info(tags, async_req=True) + >>> result = thread.get() + + :param tags: Tags to filter by (required) + :type tags: List[str] + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(List[Pet], status_code(int), headers(HTTPHeaderDict)) + """ + + warnings.warn("GET /pet/findByTags is deprecated.", DeprecationWarning) + + _params = locals() + + _all_params = [ + 'tags' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method find_pets_by_tags" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('tags') is not None: # noqa: E501 + _query_params.append(('tags', _params['tags'])) + _collection_formats['tags'] = 'csv' + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/xml', 'application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['petstore_auth', 'http_signature_test'] # noqa: E501 + + _response_types_map = { + '200': "List[Pet]", + '400': None, + } + + return self.api_client.call_api( + '/pet/findByTags', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def get_pet_by_id(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to return")], **kwargs) -> Pet: # noqa: E501 + """Find pet by ID # noqa: E501 + + Returns a single pet # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_pet_by_id(pet_id, async_req=True) + >>> result = thread.get() + + :param pet_id: ID of pet to return (required) + :type pet_id: int + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: Pet + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the get_pet_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.get_pet_by_id_with_http_info(pet_id, **kwargs) # noqa: E501 + + @validate_arguments + def get_pet_by_id_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to return")], **kwargs) -> ApiResponse: # noqa: E501 + """Find pet by ID # noqa: E501 + + Returns a single pet # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_pet_by_id_with_http_info(pet_id, async_req=True) + >>> result = thread.get() + + :param pet_id: ID of pet to return (required) + :type pet_id: int + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(Pet, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'pet_id' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method get_pet_by_id" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['pet_id'] is not None: + _path_params['petId'] = _params['pet_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/xml', 'application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['api_key'] # noqa: E501 + + _response_types_map = { + '200': "Pet", + '400': None, + '404': None, + } + + return self.api_client.call_api( + '/pet/{petId}', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def update_pet(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], **kwargs) -> None: # noqa: E501 + """Update an existing pet # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.update_pet(pet, async_req=True) + >>> result = thread.get() + + :param pet: Pet object that needs to be added to the store (required) + :type pet: Pet + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the update_pet_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.update_pet_with_http_info(pet, **kwargs) # noqa: E501 + + @validate_arguments + def update_pet_with_http_info(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], **kwargs) -> ApiResponse: # noqa: E501 + """Update an existing pet # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.update_pet_with_http_info(pet, async_req=True) + >>> result = thread.get() + + :param pet: Pet object that needs to be added to the store (required) + :type pet: Pet + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'pet' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method update_pet" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['pet'] is not None: + _body_params = _params['pet'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json', 'application/xml'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['petstore_auth', 'http_signature_test'] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/pet', 'PUT', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def update_pet_with_form(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet that needs to be updated")], name : Annotated[Optional[StrictStr], Field(description="Updated name of the pet")] = None, status : Annotated[Optional[StrictStr], Field(description="Updated status of the pet")] = None, **kwargs) -> None: # noqa: E501 + """Updates a pet in the store with form data # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.update_pet_with_form(pet_id, name, status, async_req=True) + >>> result = thread.get() + + :param pet_id: ID of pet that needs to be updated (required) + :type pet_id: int + :param name: Updated name of the pet + :type name: str + :param status: Updated status of the pet + :type status: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the update_pet_with_form_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.update_pet_with_form_with_http_info(pet_id, name, status, **kwargs) # noqa: E501 + + @validate_arguments + def update_pet_with_form_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet that needs to be updated")], name : Annotated[Optional[StrictStr], Field(description="Updated name of the pet")] = None, status : Annotated[Optional[StrictStr], Field(description="Updated status of the pet")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Updates a pet in the store with form data # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.update_pet_with_form_with_http_info(pet_id, name, status, async_req=True) + >>> result = thread.get() + + :param pet_id: ID of pet that needs to be updated (required) + :type pet_id: int + :param name: Updated name of the pet + :type name: str + :param status: Updated status of the pet + :type status: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'pet_id', + 'name', + 'status' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method update_pet_with_form" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['pet_id'] is not None: + _path_params['petId'] = _params['pet_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + if _params['name'] is not None: + _form_params.append(('name', _params['name'])) + + if _params['status'] is not None: + _form_params.append(('status', _params['status'])) + + # process the body parameter + _body_params = None + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/x-www-form-urlencoded'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['petstore_auth'] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/pet/{petId}', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def upload_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="file to upload")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """uploads an image # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.upload_file(pet_id, additional_metadata, file, async_req=True) + >>> result = thread.get() + + :param pet_id: ID of pet to update (required) + :type pet_id: int + :param additional_metadata: Additional data to pass to server + :type additional_metadata: str + :param file: file to upload + :type file: bytearray + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: ApiResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the upload_file_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.upload_file_with_http_info(pet_id, additional_metadata, file, **kwargs) # noqa: E501 + + @validate_arguments + def upload_file_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="file to upload")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """uploads an image # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.upload_file_with_http_info(pet_id, additional_metadata, file, async_req=True) + >>> result = thread.get() + + :param pet_id: ID of pet to update (required) + :type pet_id: int + :param additional_metadata: Additional data to pass to server + :type additional_metadata: str + :param file: file to upload + :type file: bytearray + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(ApiResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'pet_id', + 'additional_metadata', + 'file' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method upload_file" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['pet_id'] is not None: + _path_params['petId'] = _params['pet_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + if _params['additional_metadata'] is not None: + _form_params.append(('additionalMetadata', _params['additional_metadata'])) + + if _params['file'] is not None: + _files['file'] = _params['file'] + + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['multipart/form-data'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['petstore_auth'] # noqa: E501 + + _response_types_map = { + '200': "ApiResponse", + } + + return self.api_client.call_api( + '/pet/{petId}/uploadImage', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def upload_file_with_required_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], required_file : Annotated[Union[StrictBytes, StrictStr], Field(..., description="file to upload")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """uploads an image (required) # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.upload_file_with_required_file(pet_id, required_file, additional_metadata, async_req=True) + >>> result = thread.get() + + :param pet_id: ID of pet to update (required) + :type pet_id: int + :param required_file: file to upload (required) + :type required_file: bytearray + :param additional_metadata: Additional data to pass to server + :type additional_metadata: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: ApiResponse + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the upload_file_with_required_file_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.upload_file_with_required_file_with_http_info(pet_id, required_file, additional_metadata, **kwargs) # noqa: E501 + + @validate_arguments + def upload_file_with_required_file_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], required_file : Annotated[Union[StrictBytes, StrictStr], Field(..., description="file to upload")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """uploads an image (required) # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.upload_file_with_required_file_with_http_info(pet_id, required_file, additional_metadata, async_req=True) + >>> result = thread.get() + + :param pet_id: ID of pet to update (required) + :type pet_id: int + :param required_file: file to upload (required) + :type required_file: bytearray + :param additional_metadata: Additional data to pass to server + :type additional_metadata: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(ApiResponse, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'pet_id', + 'required_file', + 'additional_metadata' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method upload_file_with_required_file" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['pet_id'] is not None: + _path_params['petId'] = _params['pet_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + if _params['additional_metadata'] is not None: + _form_params.append(('additionalMetadata', _params['additional_metadata'])) + + if _params['required_file'] is not None: + _files['requiredFile'] = _params['required_file'] + + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['multipart/form-data'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['petstore_auth'] # noqa: E501 + + _response_types_map = { + '200': "ApiResponse", + } + + return self.api_client.call_api( + '/fake/{petId}/uploadImageWithRequiredFile', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/store_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/store_api.py new file mode 100644 index 00000000000..ad1fc048da5 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/store_api.py @@ -0,0 +1,602 @@ +# 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 re # noqa: F401 +import io +import warnings + +from pydantic import validate_arguments, ValidationError + +from typing_extensions import Annotated +from pydantic import Field, StrictStr, conint + +from typing import Dict + +from petstore_api.models.order import Order + +from petstore_api.api_client import ApiClient +from petstore_api.api_response import ApiResponse +from petstore_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class StoreApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_arguments + def delete_order(self, order_id : Annotated[StrictStr, Field(..., description="ID of the order that needs to be deleted")], **kwargs) -> None: # noqa: E501 + """Delete purchase order by ID # noqa: E501 + + For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.delete_order(order_id, async_req=True) + >>> result = thread.get() + + :param order_id: ID of the order that needs to be deleted (required) + :type order_id: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the delete_order_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.delete_order_with_http_info(order_id, **kwargs) # noqa: E501 + + @validate_arguments + def delete_order_with_http_info(self, order_id : Annotated[StrictStr, Field(..., description="ID of the order that needs to be deleted")], **kwargs) -> ApiResponse: # noqa: E501 + """Delete purchase order by ID # noqa: E501 + + For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.delete_order_with_http_info(order_id, async_req=True) + >>> result = thread.get() + + :param order_id: ID of the order that needs to be deleted (required) + :type order_id: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'order_id' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_order" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['order_id'] is not None: + _path_params['order_id'] = _params['order_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/store/order/{order_id}', 'DELETE', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def get_inventory(self, **kwargs) -> Dict[str, int]: # noqa: E501 + """Returns pet inventories by status # noqa: E501 + + Returns a map of status codes to quantities # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_inventory(async_req=True) + >>> result = thread.get() + + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: Dict[str, int] + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the get_inventory_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.get_inventory_with_http_info(**kwargs) # noqa: E501 + + @validate_arguments + def get_inventory_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 + """Returns pet inventories by status # noqa: E501 + + Returns a map of status codes to quantities # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_inventory_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(Dict[str, int], status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method get_inventory" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['api_key'] # noqa: E501 + + _response_types_map = { + '200': "Dict[str, int]", + } + + return self.api_client.call_api( + '/store/inventory', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def get_order_by_id(self, order_id : Annotated[conint(strict=True, le=5, ge=1), Field(..., description="ID of pet that needs to be fetched")], **kwargs) -> Order: # noqa: E501 + """Find purchase order by ID # noqa: E501 + + For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_order_by_id(order_id, async_req=True) + >>> result = thread.get() + + :param order_id: ID of pet that needs to be fetched (required) + :type order_id: int + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: Order + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the get_order_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.get_order_by_id_with_http_info(order_id, **kwargs) # noqa: E501 + + @validate_arguments + def get_order_by_id_with_http_info(self, order_id : Annotated[conint(strict=True, le=5, ge=1), Field(..., description="ID of pet that needs to be fetched")], **kwargs) -> ApiResponse: # noqa: E501 + """Find purchase order by ID # noqa: E501 + + For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_order_by_id_with_http_info(order_id, async_req=True) + >>> result = thread.get() + + :param order_id: ID of pet that needs to be fetched (required) + :type order_id: int + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(Order, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'order_id' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method get_order_by_id" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['order_id'] is not None: + _path_params['order_id'] = _params['order_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/xml', 'application/json']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "Order", + '400': None, + '404': None, + } + + return self.api_client.call_api( + '/store/order/{order_id}', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def place_order(self, order : Annotated[Order, Field(..., description="order placed for purchasing the pet")], **kwargs) -> Order: # noqa: E501 + """Place an order for a pet # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.place_order(order, async_req=True) + >>> result = thread.get() + + :param order: order placed for purchasing the pet (required) + :type order: Order + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: Order + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the place_order_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.place_order_with_http_info(order, **kwargs) # noqa: E501 + + @validate_arguments + def place_order_with_http_info(self, order : Annotated[Order, Field(..., description="order placed for purchasing the pet")], **kwargs) -> ApiResponse: # noqa: E501 + """Place an order for a pet # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.place_order_with_http_info(order, async_req=True) + >>> result = thread.get() + + :param order: order placed for purchasing the pet (required) + :type order: Order + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(Order, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'order' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method place_order" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['order'] is not None: + _body_params = _params['order'] + + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/xml', 'application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "Order", + '400': None, + } + + return self.api_client.call_api( + '/store/order', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/user_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/user_api.py new file mode 100644 index 00000000000..41ccd560153 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api/user_api.py @@ -0,0 +1,1182 @@ +# 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 re # noqa: F401 +import io +import warnings + +from pydantic import validate_arguments, ValidationError + +from typing_extensions import Annotated +from pydantic import Field, StrictStr, conlist + +from petstore_api.models.user import User + +from petstore_api.api_client import ApiClient +from petstore_api.api_response import ApiResponse +from petstore_api.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + + +class UserApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_arguments + def create_user(self, user : Annotated[User, Field(..., description="Created user object")], **kwargs) -> None: # noqa: E501 + """Create user # noqa: E501 + + This can only be done by the logged in user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.create_user(user, async_req=True) + >>> result = thread.get() + + :param user: Created user object (required) + :type user: User + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the create_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.create_user_with_http_info(user, **kwargs) # noqa: E501 + + @validate_arguments + def create_user_with_http_info(self, user : Annotated[User, Field(..., description="Created user object")], **kwargs) -> ApiResponse: # noqa: E501 + """Create user # noqa: E501 + + This can only be done by the logged in user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.create_user_with_http_info(user, async_req=True) + >>> result = thread.get() + + :param user: Created user object (required) + :type user: User + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _hosts = [ + 'http://petstore.swagger.io/v2', + 'http://path-server-test.petstore.local/v2', + 'http://{server}.swagger.io:{port}/v2' + ] + _host = _hosts[0] + if kwargs.get('_host_index'): + _host_index = int(kwargs.get('_host_index')) + if _host_index < 0 or _host_index >= len(_hosts): + raise ApiValueError( + "Invalid host index. Must be 0 <= index < %s" + % len(_host) + ) + _host = _hosts[_host_index] + _params = locals() + + _all_params = [ + 'user' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params and _key != "_host_index": + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method create_user" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['user'] is not None: + _body_params = _params['user'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/user', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + _host=_host, + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def create_users_with_array_input(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501 + """Creates list of users with given input array # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.create_users_with_array_input(user, async_req=True) + >>> result = thread.get() + + :param user: List of user object (required) + :type user: List[User] + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the create_users_with_array_input_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.create_users_with_array_input_with_http_info(user, **kwargs) # noqa: E501 + + @validate_arguments + def create_users_with_array_input_with_http_info(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> ApiResponse: # noqa: E501 + """Creates list of users with given input array # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.create_users_with_array_input_with_http_info(user, async_req=True) + >>> result = thread.get() + + :param user: List of user object (required) + :type user: List[User] + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'user' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method create_users_with_array_input" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['user'] is not None: + _body_params = _params['user'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/user/createWithArray', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def create_users_with_list_input(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501 + """Creates list of users with given input array # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.create_users_with_list_input(user, async_req=True) + >>> result = thread.get() + + :param user: List of user object (required) + :type user: List[User] + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the create_users_with_list_input_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.create_users_with_list_input_with_http_info(user, **kwargs) # noqa: E501 + + @validate_arguments + def create_users_with_list_input_with_http_info(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> ApiResponse: # noqa: E501 + """Creates list of users with given input array # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.create_users_with_list_input_with_http_info(user, async_req=True) + >>> result = thread.get() + + :param user: List of user object (required) + :type user: List[User] + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'user' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method create_users_with_list_input" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['user'] is not None: + _body_params = _params['user'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/user/createWithList', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def delete_user(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be deleted")], **kwargs) -> None: # noqa: E501 + """Delete user # noqa: E501 + + This can only be done by the logged in user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.delete_user(username, async_req=True) + >>> result = thread.get() + + :param username: The name that needs to be deleted (required) + :type username: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the delete_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.delete_user_with_http_info(username, **kwargs) # noqa: E501 + + @validate_arguments + def delete_user_with_http_info(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be deleted")], **kwargs) -> ApiResponse: # noqa: E501 + """Delete user # noqa: E501 + + This can only be done by the logged in user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.delete_user_with_http_info(username, async_req=True) + >>> result = thread.get() + + :param username: The name that needs to be deleted (required) + :type username: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'username' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_user" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['username'] is not None: + _path_params['username'] = _params['username'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/user/{username}', 'DELETE', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def get_user_by_name(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be fetched. Use user1 for testing.")], **kwargs) -> User: # noqa: E501 + """Get user by user name # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_user_by_name(username, async_req=True) + >>> result = thread.get() + + :param username: The name that needs to be fetched. Use user1 for testing. (required) + :type username: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: User + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the get_user_by_name_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.get_user_by_name_with_http_info(username, **kwargs) # noqa: E501 + + @validate_arguments + def get_user_by_name_with_http_info(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be fetched. Use user1 for testing.")], **kwargs) -> ApiResponse: # noqa: E501 + """Get user by user name # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.get_user_by_name_with_http_info(username, async_req=True) + >>> result = thread.get() + + :param username: The name that needs to be fetched. Use user1 for testing. (required) + :type username: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(User, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'username' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_by_name" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['username'] is not None: + _path_params['username'] = _params['username'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/xml', 'application/json']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "User", + '400': None, + '404': None, + } + + return self.api_client.call_api( + '/user/{username}', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def login_user(self, username : Annotated[StrictStr, Field(..., description="The user name for login")], password : Annotated[StrictStr, Field(..., description="The password for login in clear text")], **kwargs) -> str: # noqa: E501 + """Logs user into the system # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.login_user(username, password, async_req=True) + >>> result = thread.get() + + :param username: The user name for login (required) + :type username: str + :param password: The password for login in clear text (required) + :type password: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: str + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the login_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.login_user_with_http_info(username, password, **kwargs) # noqa: E501 + + @validate_arguments + def login_user_with_http_info(self, username : Annotated[StrictStr, Field(..., description="The user name for login")], password : Annotated[StrictStr, Field(..., description="The password for login in clear text")], **kwargs) -> ApiResponse: # noqa: E501 + """Logs user into the system # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.login_user_with_http_info(username, password, async_req=True) + >>> result = thread.get() + + :param username: The user name for login (required) + :type username: str + :param password: The password for login in clear text (required) + :type password: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) + """ + + _params = locals() + + _all_params = [ + 'username', + 'password' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method login_user" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('username') is not None: # noqa: E501 + _query_params.append(('username', _params['username'])) + + if _params.get('password') is not None: # noqa: E501 + _query_params.append(('password', _params['password'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = self.api_client.select_header_accept( + ['application/xml', 'application/json']) # noqa: E501 + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "str", + '400': None, + } + + return self.api_client.call_api( + '/user/login', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def logout_user(self, **kwargs) -> None: # noqa: E501 + """Logs out current logged in user session # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.logout_user(async_req=True) + >>> result = thread.get() + + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the logout_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.logout_user_with_http_info(**kwargs) # noqa: E501 + + @validate_arguments + def logout_user_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 + """Logs out current logged in user session # noqa: E501 + + # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.logout_user_with_http_info(async_req=True) + >>> result = thread.get() + + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method logout_user" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/user/logout', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def update_user(self, username : Annotated[StrictStr, Field(..., description="name that need to be deleted")], user : Annotated[User, Field(..., description="Updated user object")], **kwargs) -> None: # noqa: E501 + """Updated user # noqa: E501 + + This can only be done by the logged in user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.update_user(username, user, async_req=True) + >>> result = thread.get() + + :param username: name that need to be deleted (required) + :type username: str + :param user: Updated user object (required) + :type user: User + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _request_timeout: timeout setting for this request. + If one number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + message = "Error! Please call the update_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + raise ValueError(message) + return self.update_user_with_http_info(username, user, **kwargs) # noqa: E501 + + @validate_arguments + def update_user_with_http_info(self, username : Annotated[StrictStr, Field(..., description="name that need to be deleted")], user : Annotated[User, Field(..., description="Updated user object")], **kwargs) -> ApiResponse: # noqa: E501 + """Updated user # noqa: E501 + + This can only be done by the logged in user. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.update_user_with_http_info(username, user, async_req=True) + >>> result = thread.get() + + :param username: name that need to be deleted (required) + :type username: str + :param user: Updated user object (required) + :type user: User + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: None + """ + + _params = locals() + + _all_params = [ + 'username', + 'user' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method update_user" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['username'] is not None: + _path_params['username'] = _params['username'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['user'] is not None: + _body_params = _params['user'] + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + self.api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = {} + + return self.api_client.call_api( + '/user/{username}', 'PUT', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api_client.py new file mode 100644 index 00000000000..9579cce1349 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api_client.py @@ -0,0 +1,766 @@ +# 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 atexit +import datetime +from dateutil.parser import parse +import json +import mimetypes +from multiprocessing.pool import ThreadPool +import os +import re +import tempfile + +from urllib.parse import quote + +from petstore_api.configuration import Configuration +from petstore_api.api_response import ApiResponse +import petstore_api.models +from petstore_api import rest +from petstore_api.exceptions import ApiValueError, ApiException + + +class ApiClient: + """Generic API client for OpenAPI client library builds. + + OpenAPI generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the OpenAPI + templates. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API + :param pool_threads: The number of threads to use for async requests + to the API. More threads means more concurrent API requests. + """ + + PRIMITIVE_TYPES = (float, bool, bytes, str, int) + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int, # TODO remove as only py3 is supported? + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'object': object, + } + _pool = None + + def __init__(self, configuration=None, header_name=None, header_value=None, + cookie=None, pool_threads=1) -> None: + # use default configuration if none is provided + if configuration is None: + configuration = Configuration.get_default() + self.configuration = configuration + self.pool_threads = pool_threads + + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'OpenAPI-Generator/1.0.0/python' + self.client_side_validation = configuration.client_side_validation + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + self.close() + + def close(self): + if self._pool: + self._pool.close() + self._pool.join() + self._pool = None + if hasattr(atexit, 'unregister'): + atexit.unregister(self.close) + + @property + def pool(self): + """Create thread pool on first request + avoids instantiating unused threadpool for blocking clients. + """ + if self._pool is None: + atexit.register(self.close) + self._pool = ThreadPool(self.pool_threads) + return self._pool + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + + _default = None + + @classmethod + def get_default(cls): + """Return new instance of ApiClient. + + This method returns newly created, based on default constructor, + object of ApiClient class or returns a copy of default + ApiClient. + + :return: The ApiClient object. + """ + if cls._default is None: + cls._default = ApiClient() + return cls._default + + @classmethod + def set_default(cls, default): + """Set default instance of ApiClient. + + It stores default ApiClient. + + :param default: object of ApiClient. + """ + cls._default = default + + def __call_api( + self, resource_path, method, path_params=None, + query_params=None, header_params=None, body=None, post_params=None, + files=None, response_types_map=None, auth_settings=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None, _host=None, + _request_auth=None): + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict(self.parameters_to_tuples(header_params, + collection_formats)) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples(path_params, + collection_formats) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # post parameters + if post_params or files: + post_params = post_params if post_params else [] + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples(post_params, + collection_formats) + post_params.extend(self.files_parameters(files)) + + # auth setting + self.update_params_for_auth( + header_params, query_params, auth_settings, + resource_path, method, body, + request_auth=_request_auth) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + if _host is None: + url = self.configuration.host + resource_path + else: + # use server/host defined in path or operation instead + url = _host + resource_path + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + url_query = self.parameters_to_url_query(query_params, + collection_formats) + url += "?" + url_query + + try: + # perform request and return response + response_data = self.request( + method, url, + query_params=query_params, + headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + except ApiException as e: + if e.body: + e.body = e.body.decode('utf-8') + raise e + + self.last_response = response_data + + return_data = None # assuming deserialization is not needed + # data needs deserialization or returns HTTP data (deserialized) only + if _preload_content or _return_http_data_only: + response_type = response_types_map.get(str(response_data.status), None) + if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) + + if response_type == "bytearray": + response_data.data = response_data.data + else: + match = None + content_type = response_data.getheader('content-type') + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_data.data = response_data.data.decode(encoding) + + # deserialize response data + if response_type == "bytearray": + return_data = response_data.data + elif response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None + + if _return_http_data_only: + return return_data + else: + return ApiResponse(status_code = response_data.status, + data = return_data, + headers = response_data.getheaders(), + raw_data = response_data.data) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is OpenAPI model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, list): + return [self.sanitize_for_serialization(sub_obj) + for sub_obj in obj] + elif isinstance(obj, tuple): + return tuple(self.sanitize_for_serialization(sub_obj) + for sub_obj in obj) + elif isinstance(obj, (datetime.datetime, datetime.date)): + return obj.isoformat() + + if isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + obj_dict = obj.to_dict() + + return {key: self.sanitize_for_serialization(val) + for key, val in obj_dict.items()} + + def deserialize(self, response, response_type): + """Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + + :return: deserialized object. + """ + # handle file downloading + # save response body into a tmp file and return the instance + if response_type == "file": + return self.__deserialize_file(response) + + # fetch data from response object + try: + data = json.loads(response.data) + except ValueError: + data = response.data + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if isinstance(klass, str): + if klass.startswith('List['): + sub_kls = re.match(r'List\[(.*)]', klass).group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('Dict['): + sub_kls = re.match(r'Dict\[([^,]*), (.*)]', klass).group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in data.items()} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(petstore_api.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass == object: + return self.__deserialize_object(data) + elif klass == datetime.date: + return self.__deserialize_date(data) + elif klass == datetime.datetime: + return self.__deserialize_datetime(data) + else: + return self.__deserialize_model(data, klass) + + def call_api(self, resource_path, method, + path_params=None, query_params=None, header_params=None, + body=None, post_params=None, files=None, + response_types_map=None, auth_settings=None, + async_req=None, _return_http_data_only=None, + collection_formats=None, _preload_content=True, + _request_timeout=None, _host=None, _request_auth=None): + """Makes the HTTP request (synchronous) and returns deserialized data. + + To make an async_req request, set the async_req parameter. + + :param resource_path: Path to method endpoint. + :param method: Method to call. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param response: Response data type. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param async_req bool: execute request asynchronously + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_token: dict, optional + :return: + If async_req parameter is True, + the request will be called asynchronously. + The method will return the request thread. + If parameter async_req is False or missing, + then the method will return the response directly. + """ + args = ( + resource_path, + method, + path_params, + query_params, + header_params, + body, + post_params, + files, + response_types_map, + auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + _host, + _request_auth, + ) + if not async_req: + return self.__call_api(*args) + + return self.pool.apply_async(self.__call_api, args) + + def request(self, method, url, query_params=None, headers=None, + post_params=None, body=None, _preload_content=True, + _request_timeout=None): + """Makes the HTTP request using RESTClient.""" + if method == "GET": + return self.rest_client.get_request(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "HEAD": + return self.rest_client.head_request(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "OPTIONS": + return self.rest_client.options_request(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + elif method == "POST": + return self.rest_client.post_request(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PUT": + return self.rest_client.put_request(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PATCH": + return self.rest_client.patch_request(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "DELETE": + return self.rest_client.delete_request(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + else: + raise ApiValueError( + "http method must be `GET`, `HEAD`, `OPTIONS`," + " `POST`, `PATCH`, `PUT` or `DELETE`." + ) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501 + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def parameters_to_url_query(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: URL query string (e.g. a=Hello%20World&b=123) + """ + new_params = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501 + if isinstance(v, (int, float)): + v = str(v) + if isinstance(v, bool): + v = str(v).lower() + if isinstance(v, dict): + v = json.dumps(v) + + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(quote(str(value)) for value in v))) + else: + new_params.append((k, quote(str(v)))) + + return "&".join(["=".join(item) for item in new_params]) + + def files_parameters(self, files=None): + """Builds form parameters. + + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + + if files: + for k, v in files.items(): + if not v: + continue + file_names = v if type(v) is list else [v] + for n in file_names: + with open(n, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + mimetype = (mimetypes.guess_type(filename)[0] or + 'application/octet-stream') + params.append( + tuple([k, tuple([filename, filedata, mimetype])])) + + return params + + def select_header_accept(self, accepts): + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return + + for accept in accepts: + if re.search('json', accept, re.IGNORECASE): + return accept + + return accepts[0] + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return None + + for content_type in content_types: + if re.search('json', content_type, re.IGNORECASE): + return content_type + + return content_types[0] + + def update_params_for_auth(self, headers, queries, auth_settings, + resource_path, method, body, + request_auth=None): + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param request_auth: if set, the provided settings will + override the token in the configuration. + """ + if not auth_settings: + return + + if request_auth: + self._apply_auth_params(headers, queries, + resource_path, method, body, + request_auth) + return + + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + self._apply_auth_params(headers, queries, + resource_path, method, body, + auth_setting) + + def _apply_auth_params(self, headers, queries, + resource_path, method, body, + auth_setting): + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + else: + # The HTTP signature scheme requires multiple HTTP headers + # that are calculated dynamically. + signing_info = self.configuration.signing_info + auth_headers = signing_info.get_http_signature_headers( + resource_path, method, headers, body, queries) + headers.update(auth_headers) + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.getheader("Content-Disposition") + if content_disposition: + filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition).group(1) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return str(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return an original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datetime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + return klass.from_dict(data) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api_response.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api_response.py new file mode 100644 index 00000000000..a0b62b95246 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/api_response.py @@ -0,0 +1,25 @@ +"""API response object.""" + +from __future__ import annotations +from typing import Any, Dict, Optional +from pydantic import Field, StrictInt, StrictStr + +class ApiResponse: + """ + API response object + """ + + status_code: Optional[StrictInt] = Field(None, description="HTTP status code") + headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") + data: Optional[Any] = Field(None, description="Deserialized data given the data type") + raw_data: Optional[Any] = Field(None, description="Raw data (HTTP response body)") + + def __init__(self, + status_code=None, + headers=None, + data=None, + raw_data=None) -> None: + self.status_code = status_code + self.headers = headers + self.data = data + self.raw_data = raw_data diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/configuration.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/configuration.py new file mode 100644 index 00000000000..8bca6dc7ab0 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/configuration.py @@ -0,0 +1,605 @@ +# 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 copy +import logging +import multiprocessing +import sys +import urllib3 + +import http.client as httplib + +JSON_SCHEMA_VALIDATION_KEYWORDS = { + 'multipleOf', 'maximum', 'exclusiveMaximum', + 'minimum', 'exclusiveMinimum', 'maxLength', + 'minLength', 'pattern', 'maxItems', 'minItems' +} + +class Configuration: + """This class contains various settings of the API client. + + :param host: Base url. + :param api_key: Dict to store API key(s). + Each entry in the dict specifies an API key. + The dict key is the name of the security scheme in the OAS specification. + The dict value is the API key secret. + :param api_key_prefix: Dict to store API prefix (e.g. Bearer). + The dict key is the name of the security scheme in the OAS specification. + The dict value is an API key prefix when generating the auth data. + :param username: Username for HTTP basic authentication. + :param password: Password for HTTP basic authentication. + :param access_token: Access token. + :param signing_info: Configuration parameters for the HTTP signature security scheme. + Must be an instance of petstore_api.signing.HttpSigningConfiguration + :param server_index: Index to servers configuration. + :param server_variables: Mapping with string values to replace variables in + templated server configuration. The validation of enums is performed for + variables with defined enum values before. + :param server_operation_index: Mapping from operation ID to an index to server + configuration. + :param server_operation_variables: Mapping from operation ID to a mapping with + string values to replace variables in templated server configuration. + The validation of enums is performed for variables with defined enum + values before. + :param ssl_ca_cert: str - the path to a file of concatenated CA certificates + in PEM format. + + :Example: + + API Key Authentication Example. + Given the following security scheme in the OpenAPI specification: + components: + securitySchemes: + cookieAuth: # name for the security scheme + type: apiKey + in: cookie + name: JSESSIONID # cookie name + + You can programmatically set the cookie: + +conf = petstore_api.Configuration( + api_key={'cookieAuth': 'abc123'} + api_key_prefix={'cookieAuth': 'JSESSIONID'} +) + + The following cookie will be added to the HTTP request: + Cookie: JSESSIONID abc123 + + HTTP Basic Authentication Example. + Given the following security scheme in the OpenAPI specification: + components: + securitySchemes: + http_basic_auth: + type: http + scheme: basic + + Configure API client with HTTP basic authentication: + +conf = petstore_api.Configuration( + username='the-user', + password='the-password', +) + + + HTTP Signature Authentication Example. + Given the following security scheme in the OpenAPI specification: + components: + securitySchemes: + http_basic_auth: + type: http + scheme: signature + + Configure API client with HTTP signature authentication. Use the 'hs2019' signature scheme, + sign the HTTP requests with the RSA-SSA-PSS signature algorithm, and set the expiration time + of the signature to 5 minutes after the signature has been created. + Note you can use the constants defined in the petstore_api.signing module, and you can + also specify arbitrary HTTP headers to be included in the HTTP signature, except for the + 'Authorization' header, which is used to carry the signature. + + One may be tempted to sign all headers by default, but in practice it rarely works. + This is because explicit proxies, transparent proxies, TLS termination endpoints or + load balancers may add/modify/remove headers. Include the HTTP headers that you know + are not going to be modified in transit. + +conf = petstore_api.Configuration( + signing_info = petstore_api.signing.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'rsa.pem', + signing_scheme = petstore_api.signing.SCHEME_HS2019, + signing_algorithm = petstore_api.signing.ALGORITHM_RSASSA_PSS, + signed_headers = [petstore_api.signing.HEADER_REQUEST_TARGET, + petstore_api.signing.HEADER_CREATED, + petstore_api.signing.HEADER_EXPIRES, + petstore_api.signing.HEADER_HOST, + petstore_api.signing.HEADER_DATE, + petstore_api.signing.HEADER_DIGEST, + 'Content-Type', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) +) + """ + + _default = None + + def __init__(self, host=None, + api_key=None, api_key_prefix=None, + username=None, password=None, + access_token=None, + signing_info=None, + server_index=None, server_variables=None, + server_operation_index=None, server_operation_variables=None, + ssl_ca_cert=None, + ) -> None: + """Constructor + """ + self._base_path = "http://petstore.swagger.io:80/v2" if host is None else host + """Default Base url + """ + self.server_index = 0 if server_index is None and host is None else server_index + self.server_operation_index = server_operation_index or {} + """Default server index + """ + self.server_variables = server_variables or {} + self.server_operation_variables = server_operation_variables or {} + """Default server variables + """ + self.temp_folder_path = None + """Temp file folder for downloading files + """ + # Authentication Settings + self.api_key = {} + if api_key: + self.api_key = api_key + """dict to store API key(s) + """ + self.api_key_prefix = {} + if api_key_prefix: + self.api_key_prefix = api_key_prefix + """dict to store API prefix (e.g. Bearer) + """ + self.refresh_api_key_hook = None + """function hook to refresh API key if expired + """ + self.username = username + """Username for HTTP basic authentication + """ + self.password = password + """Password for HTTP basic authentication + """ + self.access_token = access_token + """Access token + """ + if signing_info is not None: + signing_info.host = host + self.signing_info = signing_info + """The HTTP signing configuration + """ + self.logger = {} + """Logging Settings + """ + self.logger["package_logger"] = logging.getLogger("petstore_api") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + """Log format + """ + self.logger_stream_handler = None + """Log stream handler + """ + self.logger_file_handler = None + """Log file handler + """ + self.logger_file = None + """Debug file location + """ + self.debug = False + """Debug switch + """ + + self.verify_ssl = True + """SSL/TLS verification + Set this to false to skip verifying SSL certificate when calling API + from https server. + """ + self.ssl_ca_cert = ssl_ca_cert + """Set this to customize the certificate file to verify the peer. + """ + self.cert_file = None + """client certificate file + """ + self.key_file = None + """client key file + """ + self.assert_hostname = None + """Set this to True/False to enable/disable SSL hostname verification. + """ + self.tls_server_name = None + """SSL/TLS Server Name Indication (SNI) + Set this to the SNI value expected by the server. + """ + + self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 + """urllib3 connection pool's maximum number of connections saved + per pool. urllib3 uses 1 connection as default value, but this is + not the best value when you are making a lot of possibly parallel + requests to the same host, which is often the case here. + cpu_count * 5 is used as default value to increase performance. + """ + + self.proxy = None + """Proxy URL + """ + self.proxy_headers = None + """Proxy headers + """ + self.safe_chars_for_path_param = '' + """Safe chars for path_param + """ + self.retries = None + """Adding retries to override urllib3 default value 3 + """ + # Enable client side validation + self.client_side_validation = True + + self.socket_options = None + """Options to pass down to the underlying urllib3 socket + """ + + self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z" + """datetime format + """ + + self.date_format = "%Y-%m-%d" + """date format + """ + + def __deepcopy__(self, memo): + cls = self.__class__ + result = cls.__new__(cls) + memo[id(self)] = result + for k, v in self.__dict__.items(): + if k not in ('logger', 'logger_file_handler'): + setattr(result, k, copy.deepcopy(v, memo)) + # shallow copy of loggers + result.logger = copy.copy(self.logger) + # use setters to configure loggers + result.logger_file = self.logger_file + result.debug = self.debug + return result + + def __setattr__(self, name, value): + object.__setattr__(self, name, value) + if name == "signing_info" and value is not None: + # Ensure the host parameter from signing info is the same as + # Configuration.host. + value.host = self.host + + @classmethod + def set_default(cls, default): + """Set default instance of configuration. + + It stores default configuration, which can be + returned by get_default_copy method. + + :param default: object of Configuration + """ + cls._default = default + + @classmethod + def get_default_copy(cls): + """Deprecated. Please use `get_default` instead. + + Deprecated. Please use `get_default` instead. + + :return: The configuration object. + """ + return cls.get_default() + + @classmethod + def get_default(cls): + """Return the default configuration. + + This method returns newly created, based on default constructor, + object of Configuration class or returns a copy of default + configuration. + + :return: The configuration object. + """ + if cls._default is None: + cls._default = Configuration() + return cls._default + + @property + def logger_file(self): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in self.logger.items(): + logger.addHandler(self.logger_file_handler) + + @property + def debug(self): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in self.logger.items(): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in self.logger.items(): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier, alias=None): + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :param alias: The alternative identifier of apiKey. + :return: The token for api key authentication. + """ + if self.refresh_api_key_hook is not None: + self.refresh_api_key_hook(self) + key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) + if key: + prefix = self.api_key_prefix.get(identifier) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + def get_basic_auth_token(self): + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + username = "" + if self.username is not None: + username = self.username + password = "" + if self.password is not None: + password = self.password + return urllib3.util.make_headers( + basic_auth=username + ':' + password + ).get('authorization') + + def auth_settings(self): + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + auth = {} + if self.access_token is not None: + auth['petstore_auth'] = { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } + if 'api_key' in self.api_key: + auth['api_key'] = { + 'type': 'api_key', + 'in': 'header', + 'key': 'api_key', + 'value': self.get_api_key_with_prefix( + 'api_key', + ), + } + if 'api_key_query' in self.api_key: + auth['api_key_query'] = { + 'type': 'api_key', + 'in': 'query', + 'key': 'api_key_query', + 'value': self.get_api_key_with_prefix( + 'api_key_query', + ), + } + if self.username is not None and self.password is not None: + auth['http_basic_test'] = { + 'type': 'basic', + 'in': 'header', + 'key': 'Authorization', + 'value': self.get_basic_auth_token() + } + if self.access_token is not None: + auth['bearer_test'] = { + 'type': 'bearer', + 'in': 'header', + 'format': 'JWT', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + } + if self.signing_info is not None: + auth['http_signature_test'] = { + 'type': 'http-signature', + 'in': 'header', + 'key': 'Authorization', + 'value': None # Signature headers are calculated for every HTTP request + } + return auth + + def to_debug_report(self): + """Gets the essential information for debugging. + + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: 1.0.0\n"\ + "SDK Package Version: 1.0.0".\ + format(env=sys.platform, pyversion=sys.version) + + def get_host_settings(self): + """Gets an array of host settings + + :return: An array of host settings + """ + return [ + { + 'url': "http://{server}.swagger.io:{port}/v2", + 'description': "petstore server", + 'variables': { + 'server': { + 'description': "No description provided", + 'default_value': "petstore", + 'enum_values': [ + "petstore", + "qa-petstore", + "dev-petstore" + ] + }, + 'port': { + 'description': "No description provided", + 'default_value': "80", + 'enum_values': [ + "80", + "8080" + ] + } + } + }, + { + 'url': "https://localhost:8080/{version}", + 'description': "The local server", + 'variables': { + 'version': { + 'description': "No description provided", + 'default_value': "v2", + 'enum_values': [ + "v1", + "v2" + ] + } + } + }, + { + 'url': "https://127.0.0.1/no_varaible", + 'description': "The local server without variables", + } + ] + + def get_host_from_settings(self, index, variables=None, servers=None): + """Gets host URL based on the index and variables + :param index: array index of the host settings + :param variables: hash of variable and the corresponding value + :param servers: an array of host settings or None + :return: URL based on host settings + """ + if index is None: + return self._base_path + + variables = {} if variables is None else variables + servers = self.get_host_settings() if servers is None else servers + + try: + server = servers[index] + except IndexError: + raise ValueError( + "Invalid index {0} when selecting the host settings. " + "Must be less than {1}".format(index, len(servers))) + + url = server['url'] + + # go through variables and replace placeholders + for variable_name, variable in server.get('variables', {}).items(): + used_value = variables.get( + variable_name, variable['default_value']) + + if 'enum_values' in variable \ + and used_value not in variable['enum_values']: + raise ValueError( + "The variable `{0}` in the host URL has invalid value " + "{1}. Must be {2}.".format( + variable_name, variables[variable_name], + variable['enum_values'])) + + url = url.replace("{" + variable_name + "}", used_value) + + return url + + @property + def host(self): + """Return generated host.""" + return self.get_host_from_settings(self.server_index, variables=self.server_variables) + + @host.setter + def host(self, value): + """Fix base path.""" + self._base_path = value + self.server_index = None diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/exceptions.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/exceptions.py new file mode 100644 index 00000000000..6c4ae9c4e02 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/exceptions.py @@ -0,0 +1,166 @@ +# 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 + + +class OpenApiException(Exception): + """The base exception class for all OpenAPIExceptions""" + + +class ApiTypeError(OpenApiException, TypeError): + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None) -> None: + """ Raises an exception for TypeErrors + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list): a list of keys an indices to get to the + current_item + None if unset + valid_classes (tuple): the primitive classes that current item + should be an instance of + None if unset + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + None if unset + """ + self.path_to_item = path_to_item + self.valid_classes = valid_classes + self.key_type = key_type + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiTypeError, self).__init__(full_msg) + + +class ApiValueError(OpenApiException, ValueError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list) the path to the exception in the + received_data dict. None if unset + """ + + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiValueError, self).__init__(full_msg) + + +class ApiAttributeError(OpenApiException, AttributeError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Raised when an attribute reference or assignment fails. + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiAttributeError, self).__init__(full_msg) + + +class ApiKeyError(OpenApiException, KeyError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiKeyError, self).__init__(full_msg) + + +class ApiException(OpenApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + if http_resp: + self.status = http_resp.status + self.reason = http_resp.reason + self.body = http_resp.data + self.headers = http_resp.getheaders() + else: + self.status = status + self.reason = reason + self.body = None + self.headers = None + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + return error_message + +class BadRequestException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + super(BadRequestException, self).__init__(status, reason, http_resp) + +class NotFoundException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + super(NotFoundException, self).__init__(status, reason, http_resp) + + +class UnauthorizedException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + super(UnauthorizedException, self).__init__(status, reason, http_resp) + + +class ForbiddenException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + super(ForbiddenException, self).__init__(status, reason, http_resp) + + +class ServiceException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None) -> None: + super(ServiceException, self).__init__(status, reason, http_resp) + + +def render_path(path_to_item): + """Returns a string representation of a path""" + result = "" + for pth in path_to_item: + if isinstance(pth, int): + result += "[{0}]".format(pth) + else: + result += "['{0}']".format(pth) + return result diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/__init__.py new file mode 100644 index 00000000000..e3ce5fa5538 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/__init__.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +# flake8: noqa +""" + 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 models into model package +from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType +from petstore_api.models.additional_properties_class import AdditionalPropertiesClass +from petstore_api.models.additional_properties_object import AdditionalPropertiesObject +from petstore_api.models.additional_properties_with_description_only import AdditionalPropertiesWithDescriptionOnly +from petstore_api.models.all_of_with_single_ref import AllOfWithSingleRef +from petstore_api.models.animal import Animal +from petstore_api.models.any_of_color import AnyOfColor +from petstore_api.models.any_of_pig import AnyOfPig +from petstore_api.models.api_response import ApiResponse +from petstore_api.models.array_of_array_of_model import ArrayOfArrayOfModel +from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly +from petstore_api.models.array_of_number_only import ArrayOfNumberOnly +from petstore_api.models.array_test import ArrayTest +from petstore_api.models.basque_pig import BasquePig +from petstore_api.models.capitalization import Capitalization +from petstore_api.models.cat import Cat +from petstore_api.models.category import Category +from petstore_api.models.circular_reference_model import CircularReferenceModel +from petstore_api.models.class_model import ClassModel +from petstore_api.models.client import Client +from petstore_api.models.color import Color +from petstore_api.models.creature import Creature +from petstore_api.models.creature_info import CreatureInfo +from petstore_api.models.danish_pig import DanishPig +from petstore_api.models.deprecated_object import DeprecatedObject +from petstore_api.models.dog import Dog +from petstore_api.models.dummy_model import DummyModel +from petstore_api.models.enum_arrays import EnumArrays +from petstore_api.models.enum_class import EnumClass +from petstore_api.models.enum_string1 import EnumString1 +from petstore_api.models.enum_string2 import EnumString2 +from petstore_api.models.enum_test import EnumTest +from petstore_api.models.file import File +from petstore_api.models.file_schema_test_class import FileSchemaTestClass +from petstore_api.models.first_ref import FirstRef +from petstore_api.models.foo import Foo +from petstore_api.models.foo_get_default_response import FooGetDefaultResponse +from petstore_api.models.format_test import FormatTest +from petstore_api.models.has_only_read_only import HasOnlyReadOnly +from petstore_api.models.health_check_result import HealthCheckResult +from petstore_api.models.inner_dict_with_property import InnerDictWithProperty +from petstore_api.models.int_or_string import IntOrString +from petstore_api.models.list import List +from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel +from petstore_api.models.map_test import MapTest +from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass +from petstore_api.models.model200_response import Model200Response +from petstore_api.models.model_return import ModelReturn +from petstore_api.models.name import Name +from petstore_api.models.nullable_class import NullableClass +from petstore_api.models.nullable_property import NullableProperty +from petstore_api.models.number_only import NumberOnly +from petstore_api.models.object_to_test_additional_properties import ObjectToTestAdditionalProperties +from petstore_api.models.object_with_deprecated_fields import ObjectWithDeprecatedFields +from petstore_api.models.one_of_enum_string import OneOfEnumString +from petstore_api.models.order import Order +from petstore_api.models.outer_composite import OuterComposite +from petstore_api.models.outer_enum import OuterEnum +from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue +from petstore_api.models.outer_enum_integer import OuterEnumInteger +from petstore_api.models.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue +from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty +from petstore_api.models.parent import Parent +from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict +from petstore_api.models.pet import Pet +from petstore_api.models.pig import Pig +from petstore_api.models.property_name_collision import PropertyNameCollision +from petstore_api.models.read_only_first import ReadOnlyFirst +from petstore_api.models.second_ref import SecondRef +from petstore_api.models.self_reference_model import SelfReferenceModel +from petstore_api.models.single_ref_type import SingleRefType +from petstore_api.models.special_character_enum import SpecialCharacterEnum +from petstore_api.models.special_model_name import SpecialModelName +from petstore_api.models.special_name import SpecialName +from petstore_api.models.tag import Tag +from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest +from petstore_api.models.tiger import Tiger +from petstore_api.models.user import User +from petstore_api.models.with_nested_one_of import WithNestedOneOf diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/additional_properties_any_type.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/additional_properties_any_type.py new file mode 100644 index 00000000000..a0f5848057e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/additional_properties_any_type.py @@ -0,0 +1,83 @@ +# 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, Optional +from pydantic import BaseModel, StrictStr + +class AdditionalPropertiesAnyType(BaseModel): + """ + AdditionalPropertiesAnyType + """ + name: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties = ["name"] + + 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) -> AdditionalPropertiesAnyType: + """Create an instance of AdditionalPropertiesAnyType 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) -> AdditionalPropertiesAnyType: + """Create an instance of AdditionalPropertiesAnyType from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return AdditionalPropertiesAnyType.parse_obj(obj) + + _obj = AdditionalPropertiesAnyType.parse_obj({ + "name": obj.get("name") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/additional_properties_class.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/additional_properties_class.py new file mode 100644 index 00000000000..06c924e21f9 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/additional_properties_class.py @@ -0,0 +1,85 @@ +# 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, Optional +from pydantic import BaseModel, StrictStr + +class AdditionalPropertiesClass(BaseModel): + """ + AdditionalPropertiesClass + """ + map_property: Optional[Dict[str, StrictStr]] = None + map_of_map_property: Optional[Dict[str, Dict[str, StrictStr]]] = None + additional_properties: Dict[str, Any] = {} + __properties = ["map_property", "map_of_map_property"] + + 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) -> AdditionalPropertiesClass: + """Create an instance of AdditionalPropertiesClass 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) -> AdditionalPropertiesClass: + """Create an instance of AdditionalPropertiesClass from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return AdditionalPropertiesClass.parse_obj(obj) + + _obj = AdditionalPropertiesClass.parse_obj({ + "map_property": obj.get("map_property"), + "map_of_map_property": obj.get("map_of_map_property") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/additional_properties_object.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/additional_properties_object.py new file mode 100644 index 00000000000..022aa9c286a --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/additional_properties_object.py @@ -0,0 +1,83 @@ +# 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, Optional +from pydantic import BaseModel, StrictStr + +class AdditionalPropertiesObject(BaseModel): + """ + AdditionalPropertiesObject + """ + name: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties = ["name"] + + 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) -> AdditionalPropertiesObject: + """Create an instance of AdditionalPropertiesObject 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) -> AdditionalPropertiesObject: + """Create an instance of AdditionalPropertiesObject from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return AdditionalPropertiesObject.parse_obj(obj) + + _obj = AdditionalPropertiesObject.parse_obj({ + "name": obj.get("name") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/additional_properties_with_description_only.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/additional_properties_with_description_only.py new file mode 100644 index 00000000000..ab7281d0dc4 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/additional_properties_with_description_only.py @@ -0,0 +1,83 @@ +# 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, Optional +from pydantic import BaseModel, StrictStr + +class AdditionalPropertiesWithDescriptionOnly(BaseModel): + """ + AdditionalPropertiesWithDescriptionOnly + """ + name: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties = ["name"] + + 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) -> AdditionalPropertiesWithDescriptionOnly: + """Create an instance of AdditionalPropertiesWithDescriptionOnly 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) -> AdditionalPropertiesWithDescriptionOnly: + """Create an instance of AdditionalPropertiesWithDescriptionOnly from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return AdditionalPropertiesWithDescriptionOnly.parse_obj(obj) + + _obj = AdditionalPropertiesWithDescriptionOnly.parse_obj({ + "name": obj.get("name") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/all_of_with_single_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/all_of_with_single_ref.py new file mode 100644 index 00000000000..f0fba038642 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/all_of_with_single_ref.py @@ -0,0 +1,86 @@ +# 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, Optional +from pydantic import BaseModel, Field, StrictStr +from petstore_api.models.single_ref_type import SingleRefType + +class AllOfWithSingleRef(BaseModel): + """ + AllOfWithSingleRef + """ + username: Optional[StrictStr] = None + single_ref_type: Optional[SingleRefType] = Field(None, alias="SingleRefType") + additional_properties: Dict[str, Any] = {} + __properties = ["username", "SingleRefType"] + + 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) -> AllOfWithSingleRef: + """Create an instance of AllOfWithSingleRef 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) -> AllOfWithSingleRef: + """Create an instance of AllOfWithSingleRef from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return AllOfWithSingleRef.parse_obj(obj) + + _obj = AllOfWithSingleRef.parse_obj({ + "username": obj.get("username"), + "single_ref_type": obj.get("SingleRefType") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/animal.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/animal.py new file mode 100644 index 00000000000..08c51a32b43 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/animal.py @@ -0,0 +1,99 @@ +# 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, Optional, Union +from pydantic import BaseModel, Field, StrictStr + +class Animal(BaseModel): + """ + Animal + """ + class_name: StrictStr = Field(..., alias="className") + color: Optional[StrictStr] = 'red' + additional_properties: Dict[str, Any] = {} + __properties = ["className", "color"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + # JSON field name that stores the object type + __discriminator_property_name = 'className' + + # discriminator mappings + __discriminator_value_class_map = { + 'Cat': 'Cat', + 'Dog': 'Dog' + } + + @classmethod + def get_discriminator_value(cls, obj: dict) -> str: + """Returns the discriminator value (object type) of the data""" + discriminator_value = obj[cls.__discriminator_property_name] + if discriminator_value: + return cls.__discriminator_value_class_map.get(discriminator_value) + else: + return None + + 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) -> Union(Cat, Dog): + """Create an instance of Animal 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) -> Union(Cat, Dog): + """Create an instance of Animal from a dict""" + # look up the object type based on discriminator mapping + object_type = cls.get_discriminator_value(obj) + if object_type: + klass = globals()[object_type] + return klass.from_dict(obj) + else: + raise ValueError("Animal failed to lookup discriminator value from " + + json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name + + ", mapping: " + json.dumps(cls.__discriminator_value_class_map)) + +from petstore_api.models.cat import Cat +from petstore_api.models.dog import Dog +Animal.update_forward_refs() + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/any_of_color.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/any_of_color.py new file mode 100644 index 00000000000..b422650686f --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/any_of_color.py @@ -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 List, Optional +from pydantic import BaseModel, Field, StrictStr, ValidationError, conint, conlist, constr, validator +from typing import Union, Any, List, TYPE_CHECKING +from pydantic import StrictStr, Field + +ANYOFCOLOR_ANY_OF_SCHEMAS = ["List[int]", "str"] + +class AnyOfColor(BaseModel): + """ + Any of RGB array, RGBA array, or hex string. + """ + + # data type: List[int] + anyof_schema_1_validator: Optional[conlist(conint(strict=True, le=255, ge=0), max_items=3, min_items=3)] = Field(None, description="RGB three element array with values 0-255.") + # data type: List[int] + anyof_schema_2_validator: Optional[conlist(conint(strict=True, le=255, ge=0), max_items=4, min_items=4)] = Field(None, description="RGBA four element array with values 0-255.") + # data type: str + anyof_schema_3_validator: Optional[constr(strict=True, max_length=7, min_length=7)] = Field(None, description="Hex color string, such as #00FF00.") + if TYPE_CHECKING: + actual_instance: Union[List[int], str] + else: + actual_instance: Any + any_of_schemas: List[str] = Field(ANYOFCOLOR_ANY_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_anyof(cls, v): + instance = AnyOfColor.construct() + error_messages = [] + # validate data type: List[int] + try: + instance.anyof_schema_1_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: List[int] + try: + instance.anyof_schema_2_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: str + try: + instance.anyof_schema_3_validator = v + return v + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in AnyOfColor with anyOf schemas: List[int], str. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: dict) -> AnyOfColor: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> AnyOfColor: + """Returns the object represented by the json string""" + instance = AnyOfColor.construct() + error_messages = [] + # deserialize data into List[int] + try: + # validation + instance.anyof_schema_1_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_1_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into List[int] + try: + # validation + instance.anyof_schema_2_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_2_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into str + try: + # validation + instance.anyof_schema_3_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.anyof_schema_3_validator + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into AnyOfColor with anyOf schemas: List[int], str. 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 "null" + + to_json = getattr(self.actual_instance, "to_json", None) + if callable(to_json): + return self.actual_instance.to_dict() + else: + return json.dumps(self.actual_instance) + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.dict()) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/any_of_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/any_of_pig.py new file mode 100644 index 00000000000..1254f6789a8 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/any_of_pig.py @@ -0,0 +1,134 @@ +# 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 Optional +from pydantic import BaseModel, Field, StrictStr, ValidationError, validator +from petstore_api.models.basque_pig import BasquePig +from petstore_api.models.danish_pig import DanishPig +from typing import Union, Any, List, TYPE_CHECKING +from pydantic import StrictStr, Field + +ANYOFPIG_ANY_OF_SCHEMAS = ["BasquePig", "DanishPig"] + +class AnyOfPig(BaseModel): + """ + AnyOfPig + """ + + # data type: BasquePig + anyof_schema_1_validator: Optional[BasquePig] = None + # data type: DanishPig + anyof_schema_2_validator: Optional[DanishPig] = None + if TYPE_CHECKING: + actual_instance: Union[BasquePig, DanishPig] + else: + actual_instance: Any + any_of_schemas: List[str] = Field(ANYOFPIG_ANY_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_anyof(cls, v): + instance = AnyOfPig.construct() + error_messages = [] + # validate data type: BasquePig + if not isinstance(v, BasquePig): + error_messages.append(f"Error! Input type `{type(v)}` is not `BasquePig`") + else: + return v + + # validate data type: DanishPig + if not isinstance(v, DanishPig): + error_messages.append(f"Error! Input type `{type(v)}` is not `DanishPig`") + else: + return v + + if error_messages: + # no match + raise ValueError("No match found when setting the actual_instance in AnyOfPig with anyOf schemas: BasquePig, DanishPig. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: dict) -> AnyOfPig: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> AnyOfPig: + """Returns the object represented by the json string""" + instance = AnyOfPig.construct() + error_messages = [] + # anyof_schema_1_validator: Optional[BasquePig] = None + try: + instance.actual_instance = BasquePig.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # anyof_schema_2_validator: Optional[DanishPig] = None + try: + instance.actual_instance = DanishPig.from_json(json_str) + return instance + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if error_messages: + # no match + raise ValueError("No match found when deserializing the JSON string into AnyOfPig with anyOf schemas: BasquePig, DanishPig. 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 "null" + + to_json = getattr(self.actual_instance, "to_json", None) + if callable(to_json): + return self.actual_instance.to_dict() + else: + return json.dumps(self.actual_instance) + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.dict()) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/api_response.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/api_response.py new file mode 100644 index 00000000000..6224b7b9564 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/api_response.py @@ -0,0 +1,87 @@ +# 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, Optional +from pydantic import BaseModel, StrictInt, StrictStr + +class ApiResponse(BaseModel): + """ + ApiResponse + """ + code: Optional[StrictInt] = None + type: Optional[StrictStr] = None + message: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties = ["code", "type", "message"] + + 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) -> ApiResponse: + """Create an instance of ApiResponse 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) -> ApiResponse: + """Create an instance of ApiResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ApiResponse.parse_obj(obj) + + _obj = ApiResponse.parse_obj({ + "code": obj.get("code"), + "type": obj.get("type"), + "message": obj.get("message") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/array_of_array_of_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/array_of_array_of_model.py new file mode 100644 index 00000000000..0f444a85a29 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/array_of_array_of_model.py @@ -0,0 +1,96 @@ +# 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, List, Optional +from pydantic import BaseModel, conlist +from petstore_api.models.tag import Tag + +class ArrayOfArrayOfModel(BaseModel): + """ + ArrayOfArrayOfModel + """ + another_property: Optional[conlist(conlist(Tag))] = None + additional_properties: Dict[str, Any] = {} + __properties = ["another_property"] + + 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) -> ArrayOfArrayOfModel: + """Create an instance of ArrayOfArrayOfModel 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 each item in another_property (list of list) + _items = [] + if self.another_property: + for _item in self.another_property: + if _item: + _items.append( + [_inner_item.to_dict() for _inner_item in _item if _inner_item is not None] + ) + _dict['another_property'] = _items + # 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) -> ArrayOfArrayOfModel: + """Create an instance of ArrayOfArrayOfModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ArrayOfArrayOfModel.parse_obj(obj) + + _obj = ArrayOfArrayOfModel.parse_obj({ + "another_property": [ + [Tag.from_dict(_inner_item) for _inner_item in _item] + for _item in obj.get("another_property") + ] if obj.get("another_property") 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/array_of_array_of_number_only.py new file mode 100644 index 00000000000..45ffc93e2bb --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/array_of_array_of_number_only.py @@ -0,0 +1,83 @@ +# 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, List, Optional +from pydantic import BaseModel, Field, StrictFloat, conlist + +class ArrayOfArrayOfNumberOnly(BaseModel): + """ + ArrayOfArrayOfNumberOnly + """ + array_array_number: Optional[conlist(conlist(StrictFloat))] = Field(None, alias="ArrayArrayNumber") + additional_properties: Dict[str, Any] = {} + __properties = ["ArrayArrayNumber"] + + 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) -> ArrayOfArrayOfNumberOnly: + """Create an instance of ArrayOfArrayOfNumberOnly 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) -> ArrayOfArrayOfNumberOnly: + """Create an instance of ArrayOfArrayOfNumberOnly from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ArrayOfArrayOfNumberOnly.parse_obj(obj) + + _obj = ArrayOfArrayOfNumberOnly.parse_obj({ + "array_array_number": obj.get("ArrayArrayNumber") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/array_of_number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/array_of_number_only.py new file mode 100644 index 00000000000..ff06726b621 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/array_of_number_only.py @@ -0,0 +1,83 @@ +# 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, List, Optional +from pydantic import BaseModel, Field, StrictFloat, conlist + +class ArrayOfNumberOnly(BaseModel): + """ + ArrayOfNumberOnly + """ + array_number: Optional[conlist(StrictFloat)] = Field(None, alias="ArrayNumber") + additional_properties: Dict[str, Any] = {} + __properties = ["ArrayNumber"] + + 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) -> ArrayOfNumberOnly: + """Create an instance of ArrayOfNumberOnly 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) -> ArrayOfNumberOnly: + """Create an instance of ArrayOfNumberOnly from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ArrayOfNumberOnly.parse_obj(obj) + + _obj = ArrayOfNumberOnly.parse_obj({ + "array_number": obj.get("ArrayNumber") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/array_test.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/array_test.py new file mode 100644 index 00000000000..5e266148eb4 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/array_test.py @@ -0,0 +1,100 @@ +# 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, List, Optional +from pydantic import BaseModel, StrictInt, StrictStr, conlist +from petstore_api.models.read_only_first import ReadOnlyFirst + +class ArrayTest(BaseModel): + """ + ArrayTest + """ + array_of_string: Optional[conlist(StrictStr, max_items=3, min_items=0)] = None + array_array_of_integer: Optional[conlist(conlist(StrictInt))] = None + array_array_of_model: Optional[conlist(conlist(ReadOnlyFirst))] = None + additional_properties: Dict[str, Any] = {} + __properties = ["array_of_string", "array_array_of_integer", "array_array_of_model"] + + 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) -> ArrayTest: + """Create an instance of ArrayTest 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 each item in array_array_of_model (list of list) + _items = [] + if self.array_array_of_model: + for _item in self.array_array_of_model: + if _item: + _items.append( + [_inner_item.to_dict() for _inner_item in _item if _inner_item is not None] + ) + _dict['array_array_of_model'] = _items + # 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) -> ArrayTest: + """Create an instance of ArrayTest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ArrayTest.parse_obj(obj) + + _obj = ArrayTest.parse_obj({ + "array_of_string": obj.get("array_of_string"), + "array_array_of_integer": obj.get("array_array_of_integer"), + "array_array_of_model": [ + [ReadOnlyFirst.from_dict(_inner_item) for _inner_item in _item] + for _item in obj.get("array_array_of_model") + ] if obj.get("array_array_of_model") 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/basque_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/basque_pig.py new file mode 100644 index 00000000000..c9f6603166f --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/basque_pig.py @@ -0,0 +1,85 @@ +# 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 + +class BasquePig(BaseModel): + """ + BasquePig + """ + class_name: StrictStr = Field(..., alias="className") + color: StrictStr = Field(...) + additional_properties: Dict[str, Any] = {} + __properties = ["className", "color"] + + 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) -> BasquePig: + """Create an instance of BasquePig 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) -> BasquePig: + """Create an instance of BasquePig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return BasquePig.parse_obj(obj) + + _obj = BasquePig.parse_obj({ + "class_name": obj.get("className"), + "color": obj.get("color") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/capitalization.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/capitalization.py new file mode 100644 index 00000000000..3685da0822c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/capitalization.py @@ -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 typing import Any, Dict, Optional +from pydantic import BaseModel, Field, StrictStr + +class Capitalization(BaseModel): + """ + Capitalization + """ + small_camel: Optional[StrictStr] = Field(None, alias="smallCamel") + capital_camel: Optional[StrictStr] = Field(None, alias="CapitalCamel") + small_snake: Optional[StrictStr] = Field(None, alias="small_Snake") + capital_snake: Optional[StrictStr] = Field(None, alias="Capital_Snake") + sca_eth_flow_points: Optional[StrictStr] = Field(None, alias="SCA_ETH_Flow_Points") + att_name: Optional[StrictStr] = Field(None, alias="ATT_NAME", description="Name of the pet ") + additional_properties: Dict[str, Any] = {} + __properties = ["smallCamel", "CapitalCamel", "small_Snake", "Capital_Snake", "SCA_ETH_Flow_Points", "ATT_NAME"] + + 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) -> Capitalization: + """Create an instance of Capitalization 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) -> Capitalization: + """Create an instance of Capitalization from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Capitalization.parse_obj(obj) + + _obj = Capitalization.parse_obj({ + "small_camel": obj.get("smallCamel"), + "capital_camel": obj.get("CapitalCamel"), + "small_snake": obj.get("small_Snake"), + "capital_snake": obj.get("Capital_Snake"), + "sca_eth_flow_points": obj.get("SCA_ETH_Flow_Points"), + "att_name": obj.get("ATT_NAME") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/cat.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/cat.py new file mode 100644 index 00000000000..b5dd4c4b08d --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/cat.py @@ -0,0 +1,86 @@ +# 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, Optional +from pydantic import StrictBool +from petstore_api.models.animal import Animal + +class Cat(Animal): + """ + Cat + """ + declawed: Optional[StrictBool] = None + additional_properties: Dict[str, Any] = {} + __properties = ["className", "color", "declawed"] + + 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) -> Cat: + """Create an instance of Cat 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) -> Cat: + """Create an instance of Cat from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Cat.parse_obj(obj) + + _obj = Cat.parse_obj({ + "class_name": obj.get("className"), + "color": obj.get("color") if obj.get("color") is not None else 'red', + "declawed": obj.get("declawed") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/category.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/category.py new file mode 100644 index 00000000000..068827c3878 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/category.py @@ -0,0 +1,85 @@ +# 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, Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr + +class Category(BaseModel): + """ + Category + """ + id: Optional[StrictInt] = None + name: StrictStr = Field(...) + additional_properties: Dict[str, Any] = {} + __properties = ["id", "name"] + + 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) -> Category: + """Create an instance of Category 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) -> Category: + """Create an instance of Category from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Category.parse_obj(obj) + + _obj = Category.parse_obj({ + "id": obj.get("id"), + "name": obj.get("name") if obj.get("name") is not None else 'default-name' + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/circular_reference_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/circular_reference_model.py new file mode 100644 index 00000000000..68a202082b2 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/circular_reference_model.py @@ -0,0 +1,90 @@ +# 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, Optional +from pydantic import BaseModel, StrictInt + +class CircularReferenceModel(BaseModel): + """ + CircularReferenceModel + """ + size: Optional[StrictInt] = None + nested: Optional[FirstRef] = None + additional_properties: Dict[str, Any] = {} + __properties = ["size", "nested"] + + 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) -> CircularReferenceModel: + """Create an instance of CircularReferenceModel 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 nested + if self.nested: + _dict['nested'] = self.nested.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) -> CircularReferenceModel: + """Create an instance of CircularReferenceModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CircularReferenceModel.parse_obj(obj) + + _obj = CircularReferenceModel.parse_obj({ + "size": obj.get("size"), + "nested": FirstRef.from_dict(obj.get("nested")) if obj.get("nested") 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 + +from petstore_api.models.first_ref import FirstRef +CircularReferenceModel.update_forward_refs() + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/class_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/class_model.py new file mode 100644 index 00000000000..f9464aa8562 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/class_model.py @@ -0,0 +1,83 @@ +# 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, Optional +from pydantic import BaseModel, Field, StrictStr + +class ClassModel(BaseModel): + """ + Model for testing model with \"_class\" property # noqa: E501 + """ + var_class: Optional[StrictStr] = Field(None, alias="_class") + additional_properties: Dict[str, Any] = {} + __properties = ["_class"] + + 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) -> ClassModel: + """Create an instance of ClassModel 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) -> ClassModel: + """Create an instance of ClassModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ClassModel.parse_obj(obj) + + _obj = ClassModel.parse_obj({ + "var_class": obj.get("_class") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/client.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/client.py new file mode 100644 index 00000000000..b527c6e6aee --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/client.py @@ -0,0 +1,83 @@ +# 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, Optional +from pydantic import BaseModel, StrictStr + +class Client(BaseModel): + """ + Client + """ + client: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties = ["client"] + + 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) -> Client: + """Create an instance of Client 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) -> Client: + """Create an instance of Client from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Client.parse_obj(obj) + + _obj = Client.parse_obj({ + "client": obj.get("client") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/color.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/color.py new file mode 100644 index 00000000000..4dee9419ab7 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/color.py @@ -0,0 +1,170 @@ +# 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, conint, conlist, constr, validator +from typing import Union, Any, List, TYPE_CHECKING +from pydantic import StrictStr, Field + +COLOR_ONE_OF_SCHEMAS = ["List[int]", "str"] + +class Color(BaseModel): + """ + RGB array, RGBA array, or hex string. + """ + # data type: List[int] + oneof_schema_1_validator: Optional[conlist(conint(strict=True, le=255, ge=0), max_items=3, min_items=3)] = Field(None, description="RGB three element array with values 0-255.") + # data type: List[int] + oneof_schema_2_validator: Optional[conlist(conint(strict=True, le=255, ge=0), max_items=4, min_items=4)] = Field(None, description="RGBA four element array with values 0-255.") + # data type: str + oneof_schema_3_validator: Optional[constr(strict=True, max_length=7, min_length=7)] = Field(None, description="Hex color string, such as #00FF00.") + if TYPE_CHECKING: + actual_instance: Union[List[int], str] + else: + actual_instance: Any + one_of_schemas: List[str] = Field(COLOR_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): + if v is None: + return v + + instance = Color.construct() + error_messages = [] + match = 0 + # validate data type: List[int] + try: + instance.oneof_schema_1_validator = v + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: List[int] + try: + instance.oneof_schema_2_validator = v + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: str + try: + instance.oneof_schema_3_validator = v + 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 setting `actual_instance` in Color with oneOf schemas: List[int], str. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in Color with oneOf schemas: List[int], str. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: dict) -> Color: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Color: + """Returns the object represented by the json string""" + instance = Color.construct() + if json_str is None: + return instance + + error_messages = [] + match = 0 + + # deserialize data into List[int] + try: + # validation + instance.oneof_schema_1_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.oneof_schema_1_validator + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into List[int] + try: + # validation + instance.oneof_schema_2_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.oneof_schema_2_validator + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into str + try: + # validation + instance.oneof_schema_3_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.oneof_schema_3_validator + 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 Color with oneOf schemas: List[int], str. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into Color with oneOf schemas: List[int], str. 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()) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/creature.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/creature.py new file mode 100644 index 00000000000..ade10d2236a --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/creature.py @@ -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.creature_info import CreatureInfo + +class Creature(BaseModel): + """ + Creature + """ + info: CreatureInfo = Field(...) + type: StrictStr = Field(...) + additional_properties: Dict[str, Any] = {} + __properties = ["info", "type"] + + 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) -> Creature: + """Create an instance of Creature 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 info + if self.info: + _dict['info'] = self.info.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) -> Creature: + """Create an instance of Creature from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Creature.parse_obj(obj) + + _obj = Creature.parse_obj({ + "info": CreatureInfo.from_dict(obj.get("info")) if obj.get("info") is not None else None, + "type": obj.get("type") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/creature_info.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/creature_info.py new file mode 100644 index 00000000000..bdc45b05b77 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/creature_info.py @@ -0,0 +1,83 @@ +# 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 + +class CreatureInfo(BaseModel): + """ + CreatureInfo + """ + name: StrictStr = Field(...) + additional_properties: Dict[str, Any] = {} + __properties = ["name"] + + 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) -> CreatureInfo: + """Create an instance of CreatureInfo 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) -> CreatureInfo: + """Create an instance of CreatureInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CreatureInfo.parse_obj(obj) + + _obj = CreatureInfo.parse_obj({ + "name": obj.get("name") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/danish_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/danish_pig.py new file mode 100644 index 00000000000..206f5855046 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/danish_pig.py @@ -0,0 +1,85 @@ +# 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, StrictInt, StrictStr + +class DanishPig(BaseModel): + """ + DanishPig + """ + class_name: StrictStr = Field(..., alias="className") + size: StrictInt = Field(...) + additional_properties: Dict[str, Any] = {} + __properties = ["className", "size"] + + 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) -> DanishPig: + """Create an instance of DanishPig 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) -> DanishPig: + """Create an instance of DanishPig from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return DanishPig.parse_obj(obj) + + _obj = DanishPig.parse_obj({ + "class_name": obj.get("className"), + "size": obj.get("size") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/deprecated_object.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/deprecated_object.py new file mode 100644 index 00000000000..4e9dc9ddf75 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/deprecated_object.py @@ -0,0 +1,83 @@ +# 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, Optional +from pydantic import BaseModel, StrictStr + +class DeprecatedObject(BaseModel): + """ + DeprecatedObject + """ + name: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties = ["name"] + + 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) -> DeprecatedObject: + """Create an instance of DeprecatedObject 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) -> DeprecatedObject: + """Create an instance of DeprecatedObject from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return DeprecatedObject.parse_obj(obj) + + _obj = DeprecatedObject.parse_obj({ + "name": obj.get("name") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/dog.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/dog.py new file mode 100644 index 00000000000..6317e1fe32a --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/dog.py @@ -0,0 +1,86 @@ +# 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, Optional +from pydantic import StrictStr +from petstore_api.models.animal import Animal + +class Dog(Animal): + """ + Dog + """ + breed: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties = ["className", "color", "breed"] + + 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) -> Dog: + """Create an instance of Dog 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) -> Dog: + """Create an instance of Dog from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Dog.parse_obj(obj) + + _obj = Dog.parse_obj({ + "class_name": obj.get("className"), + "color": obj.get("color") if obj.get("color") is not None else 'red', + "breed": obj.get("breed") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/dummy_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/dummy_model.py new file mode 100644 index 00000000000..951906fd28e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/dummy_model.py @@ -0,0 +1,90 @@ +# 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, Optional +from pydantic import BaseModel, StrictStr + +class DummyModel(BaseModel): + """ + DummyModel + """ + category: Optional[StrictStr] = None + self_ref: Optional[SelfReferenceModel] = None + additional_properties: Dict[str, Any] = {} + __properties = ["category", "self_ref"] + + 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) -> DummyModel: + """Create an instance of DummyModel 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 self_ref + if self.self_ref: + _dict['self_ref'] = self.self_ref.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) -> DummyModel: + """Create an instance of DummyModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return DummyModel.parse_obj(obj) + + _obj = DummyModel.parse_obj({ + "category": obj.get("category"), + "self_ref": SelfReferenceModel.from_dict(obj.get("self_ref")) if obj.get("self_ref") 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 + +from petstore_api.models.self_reference_model import SelfReferenceModel +DummyModel.update_forward_refs() + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_arrays.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_arrays.py new file mode 100644 index 00000000000..f804f117c9b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_arrays.py @@ -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 typing import Any, Dict, List, Optional +from pydantic import BaseModel, StrictStr, conlist, validator + +class EnumArrays(BaseModel): + """ + EnumArrays + """ + just_symbol: Optional[StrictStr] = None + array_enum: Optional[conlist(StrictStr)] = None + additional_properties: Dict[str, Any] = {} + __properties = ["just_symbol", "array_enum"] + + @validator('just_symbol') + def just_symbol_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('>=', '$'): + raise ValueError("must be one of enum values ('>=', '$')") + return value + + @validator('array_enum') + def array_enum_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in ('fish', 'crab'): + raise ValueError("each list item must be one of ('fish', 'crab')") + 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) -> EnumArrays: + """Create an instance of EnumArrays 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) -> EnumArrays: + """Create an instance of EnumArrays from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return EnumArrays.parse_obj(obj) + + _obj = EnumArrays.parse_obj({ + "just_symbol": obj.get("just_symbol"), + "array_enum": obj.get("array_enum") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_class.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_class.py new file mode 100644 index 00000000000..f3037885ed6 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_class.py @@ -0,0 +1,41 @@ +# 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 json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class EnumClass(str, Enum): + """ + EnumClass + """ + + """ + allowed enum values + """ + ABC = '_abc' + MINUS_EFG = '-efg' + LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS = '(xyz)' + + @classmethod + def from_json(cls, json_str: str) -> EnumClass: + """Create an instance of EnumClass from a JSON string""" + return EnumClass(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_string1.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_string1.py new file mode 100644 index 00000000000..8ced7d15629 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_string1.py @@ -0,0 +1,40 @@ +# 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 json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class EnumString1(str, Enum): + """ + EnumString1 + """ + + """ + allowed enum values + """ + A = 'a' + B = 'b' + + @classmethod + def from_json(cls, json_str: str) -> EnumString1: + """Create an instance of EnumString1 from a JSON string""" + return EnumString1(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_string2.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_string2.py new file mode 100644 index 00000000000..1ee33810910 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_string2.py @@ -0,0 +1,40 @@ +# 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 json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class EnumString2(str, Enum): + """ + EnumString2 + """ + + """ + allowed enum values + """ + C = 'c' + D = 'd' + + @classmethod + def from_json(cls, json_str: str) -> EnumString2: + """Create an instance of EnumString2 from a JSON string""" + return EnumString2(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_test.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_test.py new file mode 100644 index 00000000000..8a06dc2f0cf --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/enum_test.py @@ -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 +import pprint +import re # noqa: F401 +import json + + +from typing import Any, Dict, Optional +from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr, validator +from petstore_api.models.outer_enum import OuterEnum +from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue +from petstore_api.models.outer_enum_integer import OuterEnumInteger +from petstore_api.models.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue + +class EnumTest(BaseModel): + """ + EnumTest + """ + enum_string: Optional[StrictStr] = None + enum_string_required: StrictStr = Field(...) + enum_integer_default: Optional[StrictInt] = 5 + enum_integer: Optional[StrictInt] = None + enum_number: Optional[StrictFloat] = None + outer_enum: Optional[OuterEnum] = Field(None, alias="outerEnum") + outer_enum_integer: Optional[OuterEnumInteger] = Field(None, alias="outerEnumInteger") + outer_enum_default_value: Optional[OuterEnumDefaultValue] = Field(None, alias="outerEnumDefaultValue") + outer_enum_integer_default_value: Optional[OuterEnumIntegerDefaultValue] = Field(None, alias="outerEnumIntegerDefaultValue") + additional_properties: Dict[str, Any] = {} + __properties = ["enum_string", "enum_string_required", "enum_integer_default", "enum_integer", "enum_number", "outerEnum", "outerEnumInteger", "outerEnumDefaultValue", "outerEnumIntegerDefaultValue"] + + @validator('enum_string') + def enum_string_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('UPPER', 'lower', ''): + raise ValueError("must be one of enum values ('UPPER', 'lower', '')") + return value + + @validator('enum_string_required') + def enum_string_required_validate_enum(cls, value): + """Validates the enum""" + if value not in ('UPPER', 'lower', ''): + raise ValueError("must be one of enum values ('UPPER', 'lower', '')") + return value + + @validator('enum_integer_default') + def enum_integer_default_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in (1, 5, 14): + raise ValueError("must be one of enum values (1, 5, 14)") + return value + + @validator('enum_integer') + def enum_integer_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in (1, -1): + raise ValueError("must be one of enum values (1, -1)") + return value + + @validator('enum_number') + def enum_number_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in (1.1, -1.2): + raise ValueError("must be one of enum values (1.1, -1.2)") + 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) -> EnumTest: + """Create an instance of EnumTest 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 + + # set to None if outer_enum (nullable) is None + # and __fields_set__ contains the field + if self.outer_enum is None and "outer_enum" in self.__fields_set__: + _dict['outerEnum'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> EnumTest: + """Create an instance of EnumTest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return EnumTest.parse_obj(obj) + + _obj = EnumTest.parse_obj({ + "enum_string": obj.get("enum_string"), + "enum_string_required": obj.get("enum_string_required"), + "enum_integer_default": obj.get("enum_integer_default") if obj.get("enum_integer_default") is not None else 5, + "enum_integer": obj.get("enum_integer"), + "enum_number": obj.get("enum_number"), + "outer_enum": obj.get("outerEnum"), + "outer_enum_integer": obj.get("outerEnumInteger"), + "outer_enum_default_value": obj.get("outerEnumDefaultValue"), + "outer_enum_integer_default_value": obj.get("outerEnumIntegerDefaultValue") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/file.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/file.py new file mode 100644 index 00000000000..f45b5114f2c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/file.py @@ -0,0 +1,83 @@ +# 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, Optional +from pydantic import BaseModel, Field, StrictStr + +class File(BaseModel): + """ + Must be named `File` for test. # noqa: E501 + """ + source_uri: Optional[StrictStr] = Field(None, alias="sourceURI", description="Test capitalization") + additional_properties: Dict[str, Any] = {} + __properties = ["sourceURI"] + + 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) -> File: + """Create an instance of File 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) -> File: + """Create an instance of File from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return File.parse_obj(obj) + + _obj = File.parse_obj({ + "source_uri": obj.get("sourceURI") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/file_schema_test_class.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/file_schema_test_class.py new file mode 100644 index 00000000000..efbb7d95f03 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/file_schema_test_class.py @@ -0,0 +1,96 @@ +# 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, List, Optional +from pydantic import BaseModel, conlist +from petstore_api.models.file import File + +class FileSchemaTestClass(BaseModel): + """ + FileSchemaTestClass + """ + file: Optional[File] = None + files: Optional[conlist(File)] = None + additional_properties: Dict[str, Any] = {} + __properties = ["file", "files"] + + 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) -> FileSchemaTestClass: + """Create an instance of FileSchemaTestClass 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 file + if self.file: + _dict['file'] = self.file.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in files (list) + _items = [] + if self.files: + for _item in self.files: + if _item: + _items.append(_item.to_dict()) + _dict['files'] = _items + # 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) -> FileSchemaTestClass: + """Create an instance of FileSchemaTestClass from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return FileSchemaTestClass.parse_obj(obj) + + _obj = FileSchemaTestClass.parse_obj({ + "file": File.from_dict(obj.get("file")) if obj.get("file") is not None else None, + "files": [File.from_dict(_item) for _item in obj.get("files")] if obj.get("files") 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/first_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/first_ref.py new file mode 100644 index 00000000000..5a44cd22c7e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/first_ref.py @@ -0,0 +1,90 @@ +# 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, Optional +from pydantic import BaseModel, StrictStr + +class FirstRef(BaseModel): + """ + FirstRef + """ + category: Optional[StrictStr] = None + self_ref: Optional[SecondRef] = None + additional_properties: Dict[str, Any] = {} + __properties = ["category", "self_ref"] + + 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) -> FirstRef: + """Create an instance of FirstRef 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 self_ref + if self.self_ref: + _dict['self_ref'] = self.self_ref.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) -> FirstRef: + """Create an instance of FirstRef from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return FirstRef.parse_obj(obj) + + _obj = FirstRef.parse_obj({ + "category": obj.get("category"), + "self_ref": SecondRef.from_dict(obj.get("self_ref")) if obj.get("self_ref") 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 + +from petstore_api.models.second_ref import SecondRef +FirstRef.update_forward_refs() + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/foo.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/foo.py new file mode 100644 index 00000000000..77f2ef9a359 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/foo.py @@ -0,0 +1,83 @@ +# 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, Optional +from pydantic import BaseModel, StrictStr + +class Foo(BaseModel): + """ + Foo + """ + bar: Optional[StrictStr] = 'bar' + additional_properties: Dict[str, Any] = {} + __properties = ["bar"] + + 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) -> Foo: + """Create an instance of Foo 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) -> Foo: + """Create an instance of Foo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Foo.parse_obj(obj) + + _obj = Foo.parse_obj({ + "bar": obj.get("bar") if obj.get("bar") is not None else 'bar' + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/foo_get_default_response.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/foo_get_default_response.py new file mode 100644 index 00000000000..3eb736a411e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/foo_get_default_response.py @@ -0,0 +1,87 @@ +# 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, Optional +from pydantic import BaseModel +from petstore_api.models.foo import Foo + +class FooGetDefaultResponse(BaseModel): + """ + FooGetDefaultResponse + """ + string: Optional[Foo] = None + additional_properties: Dict[str, Any] = {} + __properties = ["string"] + + 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) -> FooGetDefaultResponse: + """Create an instance of FooGetDefaultResponse 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 string + if self.string: + _dict['string'] = self.string.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) -> FooGetDefaultResponse: + """Create an instance of FooGetDefaultResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return FooGetDefaultResponse.parse_obj(obj) + + _obj = FooGetDefaultResponse.parse_obj({ + "string": Foo.from_dict(obj.get("string")) if obj.get("string") 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/format_test.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/format_test.py new file mode 100644 index 00000000000..5363f631196 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/format_test.py @@ -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 +import pprint +import re # noqa: F401 +import json + +from datetime import date, datetime +from typing import Any, Dict, Optional, Union +from pydantic import BaseModel, Field, StrictBytes, StrictInt, StrictStr, condecimal, confloat, conint, constr, validator + +class FormatTest(BaseModel): + """ + FormatTest + """ + integer: Optional[conint(strict=True, le=100, ge=10)] = None + int32: Optional[conint(strict=True, le=200, ge=20)] = None + int64: Optional[StrictInt] = None + number: confloat(le=543.2, ge=32.1, strict=True) = Field(...) + float: Optional[confloat(le=987.6, ge=54.3, strict=True)] = None + double: Optional[confloat(le=123.4, ge=67.8, strict=True)] = None + decimal: Optional[condecimal()] = None + string: Optional[constr(strict=True)] = None + string_with_double_quote_pattern: Optional[constr(strict=True)] = None + byte: Optional[Union[StrictBytes, StrictStr]] = None + binary: Optional[Union[StrictBytes, StrictStr]] = None + var_date: date = Field(..., alias="date") + date_time: Optional[datetime] = Field(None, alias="dateTime") + uuid: Optional[StrictStr] = None + password: constr(strict=True, max_length=64, min_length=10) = Field(...) + pattern_with_digits: Optional[constr(strict=True)] = Field(None, description="A string that is a 10 digit number. Can have leading zeros.") + pattern_with_digits_and_delimiter: Optional[constr(strict=True)] = Field(None, description="A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.") + additional_properties: Dict[str, Any] = {} + __properties = ["integer", "int32", "int64", "number", "float", "double", "decimal", "string", "string_with_double_quote_pattern", "byte", "binary", "date", "dateTime", "uuid", "password", "pattern_with_digits", "pattern_with_digits_and_delimiter"] + + @validator('string') + def string_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"[a-z]", value ,re.IGNORECASE): + raise ValueError(r"must validate the regular expression /[a-z]/i") + return value + + @validator('string_with_double_quote_pattern') + def string_with_double_quote_pattern_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"this is \"something\"", value): + raise ValueError(r"must validate the regular expression /this is \"something\"/") + return value + + @validator('pattern_with_digits') + def pattern_with_digits_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^\d{10}$", value): + raise ValueError(r"must validate the regular expression /^\d{10}$/") + return value + + @validator('pattern_with_digits_and_delimiter') + def pattern_with_digits_and_delimiter_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^image_\d{1,3}$", value ,re.IGNORECASE): + raise ValueError(r"must validate the regular expression /^image_\d{1,3}$/i") + 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) -> FormatTest: + """Create an instance of FormatTest 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) -> FormatTest: + """Create an instance of FormatTest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return FormatTest.parse_obj(obj) + + _obj = FormatTest.parse_obj({ + "integer": obj.get("integer"), + "int32": obj.get("int32"), + "int64": obj.get("int64"), + "number": obj.get("number"), + "float": obj.get("float"), + "double": obj.get("double"), + "decimal": obj.get("decimal"), + "string": obj.get("string"), + "string_with_double_quote_pattern": obj.get("string_with_double_quote_pattern"), + "byte": obj.get("byte"), + "binary": obj.get("binary"), + "var_date": obj.get("date"), + "date_time": obj.get("dateTime"), + "uuid": obj.get("uuid"), + "password": obj.get("password"), + "pattern_with_digits": obj.get("pattern_with_digits"), + "pattern_with_digits_and_delimiter": obj.get("pattern_with_digits_and_delimiter") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/has_only_read_only.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/has_only_read_only.py new file mode 100644 index 00000000000..be7b0eb636b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/has_only_read_only.py @@ -0,0 +1,87 @@ +# 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, Optional +from pydantic import BaseModel, StrictStr + +class HasOnlyReadOnly(BaseModel): + """ + HasOnlyReadOnly + """ + bar: Optional[StrictStr] = None + foo: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties = ["bar", "foo"] + + 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) -> HasOnlyReadOnly: + """Create an instance of HasOnlyReadOnly 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={ + "bar", + "foo", + "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) -> HasOnlyReadOnly: + """Create an instance of HasOnlyReadOnly from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return HasOnlyReadOnly.parse_obj(obj) + + _obj = HasOnlyReadOnly.parse_obj({ + "bar": obj.get("bar"), + "foo": obj.get("foo") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/health_check_result.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/health_check_result.py new file mode 100644 index 00000000000..ec2c401c363 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/health_check_result.py @@ -0,0 +1,88 @@ +# 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, Optional +from pydantic import BaseModel, Field, StrictStr + +class HealthCheckResult(BaseModel): + """ + Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. # noqa: E501 + """ + nullable_message: Optional[StrictStr] = Field(None, alias="NullableMessage") + additional_properties: Dict[str, Any] = {} + __properties = ["NullableMessage"] + + 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) -> HealthCheckResult: + """Create an instance of HealthCheckResult 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 + + # set to None if nullable_message (nullable) is None + # and __fields_set__ contains the field + if self.nullable_message is None and "nullable_message" in self.__fields_set__: + _dict['NullableMessage'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> HealthCheckResult: + """Create an instance of HealthCheckResult from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return HealthCheckResult.parse_obj(obj) + + _obj = HealthCheckResult.parse_obj({ + "nullable_message": obj.get("NullableMessage") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/inner_dict_with_property.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/inner_dict_with_property.py new file mode 100644 index 00000000000..f3a50b0851b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/inner_dict_with_property.py @@ -0,0 +1,83 @@ +# 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, Optional +from pydantic import BaseModel, Field + +class InnerDictWithProperty(BaseModel): + """ + InnerDictWithProperty + """ + a_property: Optional[Dict[str, Any]] = Field(None, alias="aProperty") + additional_properties: Dict[str, Any] = {} + __properties = ["aProperty"] + + 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) -> InnerDictWithProperty: + """Create an instance of InnerDictWithProperty 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) -> InnerDictWithProperty: + """Create an instance of InnerDictWithProperty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return InnerDictWithProperty.parse_obj(obj) + + _obj = InnerDictWithProperty.parse_obj({ + "a_property": obj.get("aProperty") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/int_or_string.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/int_or_string.py new file mode 100644 index 00000000000..5d5de47e305 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/int_or_string.py @@ -0,0 +1,147 @@ +# 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, conint, validator +from typing import Union, Any, List, TYPE_CHECKING +from pydantic import StrictStr, Field + +INTORSTRING_ONE_OF_SCHEMAS = ["int", "str"] + +class IntOrString(BaseModel): + """ + IntOrString + """ + # data type: int + oneof_schema_1_validator: Optional[conint(strict=True, ge=10)] = None + # data type: str + oneof_schema_2_validator: Optional[StrictStr] = None + if TYPE_CHECKING: + actual_instance: Union[int, str] + else: + actual_instance: Any + one_of_schemas: List[str] = Field(INTORSTRING_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 = IntOrString.construct() + error_messages = [] + match = 0 + # validate data type: int + try: + instance.oneof_schema_1_validator = v + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # validate data type: str + try: + instance.oneof_schema_2_validator = v + 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 setting `actual_instance` in IntOrString with oneOf schemas: int, str. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in IntOrString with oneOf schemas: int, str. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: dict) -> IntOrString: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> IntOrString: + """Returns the object represented by the json string""" + instance = IntOrString.construct() + error_messages = [] + match = 0 + + # deserialize data into int + try: + # validation + instance.oneof_schema_1_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.oneof_schema_1_validator + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into str + try: + # validation + instance.oneof_schema_2_validator = json.loads(json_str) + # assign value to actual_instance + instance.actual_instance = instance.oneof_schema_2_validator + 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 IntOrString with oneOf schemas: int, str. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into IntOrString with oneOf schemas: int, str. 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()) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/list.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/list.py new file mode 100644 index 00000000000..d4381879ccb --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/list.py @@ -0,0 +1,83 @@ +# 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, Optional +from pydantic import BaseModel, Field, StrictStr + +class List(BaseModel): + """ + List + """ + var_123_list: Optional[StrictStr] = Field(None, alias="123-list") + additional_properties: Dict[str, Any] = {} + __properties = ["123-list"] + + 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) -> List: + """Create an instance of List 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) -> List: + """Create an instance of List from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return List.parse_obj(obj) + + _obj = List.parse_obj({ + "var_123_list": obj.get("123-list") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/map_of_array_of_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/map_of_array_of_model.py new file mode 100644 index 00000000000..0f0bf902f30 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/map_of_array_of_model.py @@ -0,0 +1,100 @@ +# 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, List, Optional +from pydantic import BaseModel, Field, conlist +from petstore_api.models.tag import Tag + +class MapOfArrayOfModel(BaseModel): + """ + MapOfArrayOfModel + """ + shop_id_to_org_online_lip_map: Optional[Dict[str, conlist(Tag)]] = Field(None, alias="shopIdToOrgOnlineLipMap") + additional_properties: Dict[str, Any] = {} + __properties = ["shopIdToOrgOnlineLipMap"] + + 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) -> MapOfArrayOfModel: + """Create an instance of MapOfArrayOfModel 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 each value in shop_id_to_org_online_lip_map (dict of array) + _field_dict_of_array = {} + if self.shop_id_to_org_online_lip_map: + for _key in self.shop_id_to_org_online_lip_map: + if self.shop_id_to_org_online_lip_map[_key]: + _field_dict_of_array[_key] = [ + _item.to_dict() for _item in self.shop_id_to_org_online_lip_map[_key] + ] + _dict['shopIdToOrgOnlineLipMap'] = _field_dict_of_array + # 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) -> MapOfArrayOfModel: + """Create an instance of MapOfArrayOfModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return MapOfArrayOfModel.parse_obj(obj) + + _obj = MapOfArrayOfModel.parse_obj({ + "shop_id_to_org_online_lip_map": dict( + (_k, + [Tag.from_dict(_item) for _item in _v] + if _v is not None + else None + ) + for _k, _v in obj.get("shopIdToOrgOnlineLipMap").items() + ) + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/map_test.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/map_test.py new file mode 100644 index 00000000000..4270158fd4d --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/map_test.py @@ -0,0 +1,99 @@ +# 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, Optional +from pydantic import BaseModel, StrictBool, StrictStr, validator + +class MapTest(BaseModel): + """ + MapTest + """ + map_map_of_string: Optional[Dict[str, Dict[str, StrictStr]]] = None + map_of_enum_string: Optional[Dict[str, StrictStr]] = None + direct_map: Optional[Dict[str, StrictBool]] = None + indirect_map: Optional[Dict[str, StrictBool]] = None + additional_properties: Dict[str, Any] = {} + __properties = ["map_map_of_string", "map_of_enum_string", "direct_map", "indirect_map"] + + @validator('map_of_enum_string') + def map_of_enum_string_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('UPPER', 'lower'): + raise ValueError("must be one of enum values ('UPPER', 'lower')") + 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) -> MapTest: + """Create an instance of MapTest 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) -> MapTest: + """Create an instance of MapTest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return MapTest.parse_obj(obj) + + _obj = MapTest.parse_obj({ + "map_map_of_string": obj.get("map_map_of_string"), + "map_of_enum_string": obj.get("map_of_enum_string"), + "direct_map": obj.get("direct_map"), + "indirect_map": obj.get("indirect_map") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/mixed_properties_and_additional_properties_class.py new file mode 100644 index 00000000000..9345c5b2ab6 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/mixed_properties_and_additional_properties_class.py @@ -0,0 +1,100 @@ +# 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 datetime import datetime +from typing import Any, Dict, Optional +from pydantic import BaseModel, Field, StrictStr +from petstore_api.models.animal import Animal + +class MixedPropertiesAndAdditionalPropertiesClass(BaseModel): + """ + MixedPropertiesAndAdditionalPropertiesClass + """ + uuid: Optional[StrictStr] = None + date_time: Optional[datetime] = Field(None, alias="dateTime") + map: Optional[Dict[str, Animal]] = None + additional_properties: Dict[str, Any] = {} + __properties = ["uuid", "dateTime", "map"] + + 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) -> MixedPropertiesAndAdditionalPropertiesClass: + """Create an instance of MixedPropertiesAndAdditionalPropertiesClass 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 each value in map (dict) + _field_dict = {} + if self.map: + for _key in self.map: + if self.map[_key]: + _field_dict[_key] = self.map[_key].to_dict() + _dict['map'] = _field_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) -> MixedPropertiesAndAdditionalPropertiesClass: + """Create an instance of MixedPropertiesAndAdditionalPropertiesClass from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return MixedPropertiesAndAdditionalPropertiesClass.parse_obj(obj) + + _obj = MixedPropertiesAndAdditionalPropertiesClass.parse_obj({ + "uuid": obj.get("uuid"), + "date_time": obj.get("dateTime"), + "map": dict( + (_k, Animal.from_dict(_v)) + for _k, _v in obj.get("map").items() + ) + if obj.get("map") 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/model200_response.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/model200_response.py new file mode 100644 index 00000000000..63c69743338 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/model200_response.py @@ -0,0 +1,85 @@ +# 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, Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr + +class Model200Response(BaseModel): + """ + Model for testing model name starting with number # noqa: E501 + """ + name: Optional[StrictInt] = None + var_class: Optional[StrictStr] = Field(None, alias="class") + additional_properties: Dict[str, Any] = {} + __properties = ["name", "class"] + + 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) -> Model200Response: + """Create an instance of Model200Response 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) -> Model200Response: + """Create an instance of Model200Response from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Model200Response.parse_obj(obj) + + _obj = Model200Response.parse_obj({ + "name": obj.get("name"), + "var_class": obj.get("class") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/model_return.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/model_return.py new file mode 100644 index 00000000000..a7212e506b6 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/model_return.py @@ -0,0 +1,83 @@ +# 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, Optional +from pydantic import BaseModel, Field, StrictInt + +class ModelReturn(BaseModel): + """ + Model for testing reserved words # noqa: E501 + """ + var_return: Optional[StrictInt] = Field(None, alias="return") + additional_properties: Dict[str, Any] = {} + __properties = ["return"] + + 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) -> ModelReturn: + """Create an instance of ModelReturn 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) -> ModelReturn: + """Create an instance of ModelReturn from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ModelReturn.parse_obj(obj) + + _obj = ModelReturn.parse_obj({ + "var_return": obj.get("return") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/name.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/name.py new file mode 100644 index 00000000000..180e06e24c5 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/name.py @@ -0,0 +1,91 @@ +# 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, Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr + +class Name(BaseModel): + """ + Model for testing model name same as property name # noqa: E501 + """ + name: StrictInt = Field(...) + snake_case: Optional[StrictInt] = None + var_property: Optional[StrictStr] = Field(None, alias="property") + var_123_number: Optional[StrictInt] = Field(None, alias="123Number") + additional_properties: Dict[str, Any] = {} + __properties = ["name", "snake_case", "property", "123Number"] + + 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) -> Name: + """Create an instance of Name 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={ + "snake_case", + "var_123_number", + "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) -> Name: + """Create an instance of Name from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Name.parse_obj(obj) + + _obj = Name.parse_obj({ + "name": obj.get("name"), + "snake_case": obj.get("snake_case"), + "var_property": obj.get("property"), + "var_123_number": obj.get("123Number") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/nullable_class.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/nullable_class.py new file mode 100644 index 00000000000..57857988844 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/nullable_class.py @@ -0,0 +1,162 @@ +# 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 datetime import date, datetime +from typing import Any, Dict, List, Optional +from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr, conlist + +class NullableClass(BaseModel): + """ + NullableClass + """ + required_integer_prop: Optional[StrictInt] = Field(...) + integer_prop: Optional[StrictInt] = None + number_prop: Optional[StrictFloat] = None + boolean_prop: Optional[StrictBool] = None + string_prop: Optional[StrictStr] = None + date_prop: Optional[date] = None + datetime_prop: Optional[datetime] = None + array_nullable_prop: Optional[conlist(Dict[str, Any])] = None + array_and_items_nullable_prop: Optional[conlist(Dict[str, Any])] = None + array_items_nullable: Optional[conlist(Dict[str, Any])] = None + object_nullable_prop: Optional[Dict[str, Dict[str, Any]]] = None + object_and_items_nullable_prop: Optional[Dict[str, Dict[str, Any]]] = None + object_items_nullable: Optional[Dict[str, Dict[str, Any]]] = None + additional_properties: Dict[str, Any] = {} + __properties = ["required_integer_prop", "integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable"] + + 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) -> NullableClass: + """Create an instance of NullableClass 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 + + # set to None if required_integer_prop (nullable) is None + # and __fields_set__ contains the field + if self.required_integer_prop is None and "required_integer_prop" in self.__fields_set__: + _dict['required_integer_prop'] = None + + # set to None if integer_prop (nullable) is None + # and __fields_set__ contains the field + if self.integer_prop is None and "integer_prop" in self.__fields_set__: + _dict['integer_prop'] = None + + # set to None if number_prop (nullable) is None + # and __fields_set__ contains the field + if self.number_prop is None and "number_prop" in self.__fields_set__: + _dict['number_prop'] = None + + # set to None if boolean_prop (nullable) is None + # and __fields_set__ contains the field + if self.boolean_prop is None and "boolean_prop" in self.__fields_set__: + _dict['boolean_prop'] = None + + # set to None if string_prop (nullable) is None + # and __fields_set__ contains the field + if self.string_prop is None and "string_prop" in self.__fields_set__: + _dict['string_prop'] = None + + # set to None if date_prop (nullable) is None + # and __fields_set__ contains the field + if self.date_prop is None and "date_prop" in self.__fields_set__: + _dict['date_prop'] = None + + # set to None if datetime_prop (nullable) is None + # and __fields_set__ contains the field + if self.datetime_prop is None and "datetime_prop" in self.__fields_set__: + _dict['datetime_prop'] = None + + # set to None if array_nullable_prop (nullable) is None + # and __fields_set__ contains the field + if self.array_nullable_prop is None and "array_nullable_prop" in self.__fields_set__: + _dict['array_nullable_prop'] = None + + # set to None if array_and_items_nullable_prop (nullable) is None + # and __fields_set__ contains the field + if self.array_and_items_nullable_prop is None and "array_and_items_nullable_prop" in self.__fields_set__: + _dict['array_and_items_nullable_prop'] = None + + # set to None if object_nullable_prop (nullable) is None + # and __fields_set__ contains the field + if self.object_nullable_prop is None and "object_nullable_prop" in self.__fields_set__: + _dict['object_nullable_prop'] = None + + # set to None if object_and_items_nullable_prop (nullable) is None + # and __fields_set__ contains the field + if self.object_and_items_nullable_prop is None and "object_and_items_nullable_prop" in self.__fields_set__: + _dict['object_and_items_nullable_prop'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> NullableClass: + """Create an instance of NullableClass from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return NullableClass.parse_obj(obj) + + _obj = NullableClass.parse_obj({ + "required_integer_prop": obj.get("required_integer_prop"), + "integer_prop": obj.get("integer_prop"), + "number_prop": obj.get("number_prop"), + "boolean_prop": obj.get("boolean_prop"), + "string_prop": obj.get("string_prop"), + "date_prop": obj.get("date_prop"), + "datetime_prop": obj.get("datetime_prop"), + "array_nullable_prop": obj.get("array_nullable_prop"), + "array_and_items_nullable_prop": obj.get("array_and_items_nullable_prop"), + "array_items_nullable": obj.get("array_items_nullable"), + "object_nullable_prop": obj.get("object_nullable_prop"), + "object_and_items_nullable_prop": obj.get("object_and_items_nullable_prop"), + "object_items_nullable": obj.get("object_items_nullable") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/nullable_property.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/nullable_property.py new file mode 100644 index 00000000000..059cbdc577c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/nullable_property.py @@ -0,0 +1,100 @@ +# 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, Optional +from pydantic import BaseModel, Field, StrictInt, constr, validator + +class NullableProperty(BaseModel): + """ + NullableProperty + """ + id: StrictInt = Field(...) + name: Optional[constr(strict=True)] = Field(...) + additional_properties: Dict[str, Any] = {} + __properties = ["id", "name"] + + @validator('name') + def name_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^[A-Z].*", value): + raise ValueError(r"must validate the regular expression /^[A-Z].*/") + 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) -> NullableProperty: + """Create an instance of NullableProperty 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 + + # set to None if name (nullable) is None + # and __fields_set__ contains the field + if self.name is None and "name" in self.__fields_set__: + _dict['name'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> NullableProperty: + """Create an instance of NullableProperty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return NullableProperty.parse_obj(obj) + + _obj = NullableProperty.parse_obj({ + "id": obj.get("id"), + "name": obj.get("name") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/number_only.py new file mode 100644 index 00000000000..78a00af5654 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/number_only.py @@ -0,0 +1,83 @@ +# 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, Optional +from pydantic import BaseModel, Field, StrictFloat + +class NumberOnly(BaseModel): + """ + NumberOnly + """ + just_number: Optional[StrictFloat] = Field(None, alias="JustNumber") + additional_properties: Dict[str, Any] = {} + __properties = ["JustNumber"] + + 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) -> NumberOnly: + """Create an instance of NumberOnly 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) -> NumberOnly: + """Create an instance of NumberOnly from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return NumberOnly.parse_obj(obj) + + _obj = NumberOnly.parse_obj({ + "just_number": obj.get("JustNumber") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/object_to_test_additional_properties.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/object_to_test_additional_properties.py new file mode 100644 index 00000000000..21e9a30d7df --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/object_to_test_additional_properties.py @@ -0,0 +1,83 @@ +# 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, Optional +from pydantic import BaseModel, Field, StrictBool + +class ObjectToTestAdditionalProperties(BaseModel): + """ + Minimal object # noqa: E501 + """ + var_property: Optional[StrictBool] = Field(False, alias="property", description="Property") + additional_properties: Dict[str, Any] = {} + __properties = ["property"] + + 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) -> ObjectToTestAdditionalProperties: + """Create an instance of ObjectToTestAdditionalProperties 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) -> ObjectToTestAdditionalProperties: + """Create an instance of ObjectToTestAdditionalProperties from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ObjectToTestAdditionalProperties.parse_obj(obj) + + _obj = ObjectToTestAdditionalProperties.parse_obj({ + "var_property": obj.get("property") if obj.get("property") is not None else False + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/object_with_deprecated_fields.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/object_with_deprecated_fields.py new file mode 100644 index 00000000000..fda4435b8be --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/object_with_deprecated_fields.py @@ -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 typing import Any, Dict, List, Optional +from pydantic import BaseModel, Field, StrictFloat, StrictStr, conlist +from petstore_api.models.deprecated_object import DeprecatedObject + +class ObjectWithDeprecatedFields(BaseModel): + """ + ObjectWithDeprecatedFields + """ + uuid: Optional[StrictStr] = None + id: Optional[StrictFloat] = None + deprecated_ref: Optional[DeprecatedObject] = Field(None, alias="deprecatedRef") + bars: Optional[conlist(StrictStr)] = None + additional_properties: Dict[str, Any] = {} + __properties = ["uuid", "id", "deprecatedRef", "bars"] + + 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) -> ObjectWithDeprecatedFields: + """Create an instance of ObjectWithDeprecatedFields 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 deprecated_ref + if self.deprecated_ref: + _dict['deprecatedRef'] = self.deprecated_ref.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) -> ObjectWithDeprecatedFields: + """Create an instance of ObjectWithDeprecatedFields from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ObjectWithDeprecatedFields.parse_obj(obj) + + _obj = ObjectWithDeprecatedFields.parse_obj({ + "uuid": obj.get("uuid"), + "id": obj.get("id"), + "deprecated_ref": DeprecatedObject.from_dict(obj.get("deprecatedRef")) if obj.get("deprecatedRef") is not None else None, + "bars": obj.get("bars") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/one_of_enum_string.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/one_of_enum_string.py new file mode 100644 index 00000000000..d7ae93ccb6a --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/one_of_enum_string.py @@ -0,0 +1,141 @@ +# 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.enum_string1 import EnumString1 +from petstore_api.models.enum_string2 import EnumString2 +from typing import Union, Any, List, TYPE_CHECKING +from pydantic import StrictStr, Field + +ONEOFENUMSTRING_ONE_OF_SCHEMAS = ["EnumString1", "EnumString2"] + +class OneOfEnumString(BaseModel): + """ + oneOf enum strings + """ + # data type: EnumString1 + oneof_schema_1_validator: Optional[EnumString1] = None + # data type: EnumString2 + oneof_schema_2_validator: Optional[EnumString2] = None + if TYPE_CHECKING: + actual_instance: Union[EnumString1, EnumString2] + else: + actual_instance: Any + one_of_schemas: List[str] = Field(ONEOFENUMSTRING_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 = OneOfEnumString.construct() + error_messages = [] + match = 0 + # validate data type: EnumString1 + if not isinstance(v, EnumString1): + error_messages.append(f"Error! Input type `{type(v)}` is not `EnumString1`") + else: + match += 1 + # validate data type: EnumString2 + if not isinstance(v, EnumString2): + error_messages.append(f"Error! Input type `{type(v)}` is not `EnumString2`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in OneOfEnumString with oneOf schemas: EnumString1, EnumString2. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in OneOfEnumString with oneOf schemas: EnumString1, EnumString2. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: dict) -> OneOfEnumString: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> OneOfEnumString: + """Returns the object represented by the json string""" + instance = OneOfEnumString.construct() + error_messages = [] + match = 0 + + # deserialize data into EnumString1 + try: + instance.actual_instance = EnumString1.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into EnumString2 + try: + instance.actual_instance = EnumString2.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 OneOfEnumString with oneOf schemas: EnumString1, EnumString2. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into OneOfEnumString with oneOf schemas: EnumString1, EnumString2. 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()) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/order.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/order.py new file mode 100644 index 00000000000..691eb04bbb1 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/order.py @@ -0,0 +1,103 @@ +# 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 datetime import datetime +from typing import Any, Dict, Optional +from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, validator + +class Order(BaseModel): + """ + Order + """ + id: Optional[StrictInt] = None + pet_id: Optional[StrictInt] = Field(None, alias="petId") + quantity: Optional[StrictInt] = None + ship_date: Optional[datetime] = Field(None, alias="shipDate") + status: Optional[StrictStr] = Field(None, description="Order Status") + complete: Optional[StrictBool] = False + additional_properties: Dict[str, Any] = {} + __properties = ["id", "petId", "quantity", "shipDate", "status", "complete"] + + @validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('placed', 'approved', 'delivered'): + raise ValueError("must be one of enum values ('placed', 'approved', 'delivered')") + 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) -> Order: + """Create an instance of Order 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) -> Order: + """Create an instance of Order from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Order.parse_obj(obj) + + _obj = Order.parse_obj({ + "id": obj.get("id"), + "pet_id": obj.get("petId"), + "quantity": obj.get("quantity"), + "ship_date": obj.get("shipDate"), + "status": obj.get("status"), + "complete": obj.get("complete") if obj.get("complete") is not None else False + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_composite.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_composite.py new file mode 100644 index 00000000000..b453339e1c8 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_composite.py @@ -0,0 +1,87 @@ +# 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, Optional +from pydantic import BaseModel, StrictBool, StrictFloat, StrictStr + +class OuterComposite(BaseModel): + """ + OuterComposite + """ + my_number: Optional[StrictFloat] = None + my_string: Optional[StrictStr] = None + my_boolean: Optional[StrictBool] = None + additional_properties: Dict[str, Any] = {} + __properties = ["my_number", "my_string", "my_boolean"] + + 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) -> OuterComposite: + """Create an instance of OuterComposite 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) -> OuterComposite: + """Create an instance of OuterComposite from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OuterComposite.parse_obj(obj) + + _obj = OuterComposite.parse_obj({ + "my_number": obj.get("my_number"), + "my_string": obj.get("my_string"), + "my_boolean": obj.get("my_boolean") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_enum.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_enum.py new file mode 100644 index 00000000000..bfb06a008b5 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_enum.py @@ -0,0 +1,41 @@ +# 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 json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class OuterEnum(str, Enum): + """ + OuterEnum + """ + + """ + allowed enum values + """ + PLACED = 'placed' + APPROVED = 'approved' + DELIVERED = 'delivered' + + @classmethod + def from_json(cls, json_str: str) -> OuterEnum: + """Create an instance of OuterEnum from a JSON string""" + return OuterEnum(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_enum_default_value.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_enum_default_value.py new file mode 100644 index 00000000000..807c36f0fe5 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_enum_default_value.py @@ -0,0 +1,41 @@ +# 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 json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class OuterEnumDefaultValue(str, Enum): + """ + OuterEnumDefaultValue + """ + + """ + allowed enum values + """ + PLACED = 'placed' + APPROVED = 'approved' + DELIVERED = 'delivered' + + @classmethod + def from_json(cls, json_str: str) -> OuterEnumDefaultValue: + """Create an instance of OuterEnumDefaultValue from a JSON string""" + return OuterEnumDefaultValue(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_enum_integer.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_enum_integer.py new file mode 100644 index 00000000000..77ae46fa705 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_enum_integer.py @@ -0,0 +1,41 @@ +# 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 json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class OuterEnumInteger(int, Enum): + """ + OuterEnumInteger + """ + + """ + allowed enum values + """ + NUMBER_0 = 0 + NUMBER_1 = 1 + NUMBER_2 = 2 + + @classmethod + def from_json(cls, json_str: str) -> OuterEnumInteger: + """Create an instance of OuterEnumInteger from a JSON string""" + return OuterEnumInteger(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_enum_integer_default_value.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_enum_integer_default_value.py new file mode 100644 index 00000000000..36381197bb7 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_enum_integer_default_value.py @@ -0,0 +1,42 @@ +# 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 json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class OuterEnumIntegerDefaultValue(int, Enum): + """ + OuterEnumIntegerDefaultValue + """ + + """ + allowed enum values + """ + NUMBER_MINUS_1 = -1 + NUMBER_0 = 0 + NUMBER_1 = 1 + NUMBER_2 = 2 + + @classmethod + def from_json(cls, json_str: str) -> OuterEnumIntegerDefaultValue: + """Create an instance of OuterEnumIntegerDefaultValue from a JSON string""" + return OuterEnumIntegerDefaultValue(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_object_with_enum_property.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_object_with_enum_property.py new file mode 100644 index 00000000000..a5723f0a932 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/outer_object_with_enum_property.py @@ -0,0 +1,92 @@ +# 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, Optional +from pydantic import BaseModel, Field +from petstore_api.models.outer_enum import OuterEnum +from petstore_api.models.outer_enum_integer import OuterEnumInteger + +class OuterObjectWithEnumProperty(BaseModel): + """ + OuterObjectWithEnumProperty + """ + str_value: Optional[OuterEnum] = None + value: OuterEnumInteger = Field(...) + additional_properties: Dict[str, Any] = {} + __properties = ["str_value", "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) -> OuterObjectWithEnumProperty: + """Create an instance of OuterObjectWithEnumProperty 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 + + # set to None if str_value (nullable) is None + # and __fields_set__ contains the field + if self.str_value is None and "str_value" in self.__fields_set__: + _dict['str_value'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> OuterObjectWithEnumProperty: + """Create an instance of OuterObjectWithEnumProperty from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OuterObjectWithEnumProperty.parse_obj(obj) + + _obj = OuterObjectWithEnumProperty.parse_obj({ + "str_value": obj.get("str_value"), + "value": obj.get("value") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/parent.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/parent.py new file mode 100644 index 00000000000..d597e8c4e44 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/parent.py @@ -0,0 +1,96 @@ +# 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, Optional +from pydantic import BaseModel, Field +from petstore_api.models.inner_dict_with_property import InnerDictWithProperty + +class Parent(BaseModel): + """ + Parent + """ + optional_dict: Optional[Dict[str, InnerDictWithProperty]] = Field(None, alias="optionalDict") + additional_properties: Dict[str, Any] = {} + __properties = ["optionalDict"] + + 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) -> Parent: + """Create an instance of Parent 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 each value in optional_dict (dict) + _field_dict = {} + if self.optional_dict: + for _key in self.optional_dict: + if self.optional_dict[_key]: + _field_dict[_key] = self.optional_dict[_key].to_dict() + _dict['optionalDict'] = _field_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) -> Parent: + """Create an instance of Parent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Parent.parse_obj(obj) + + _obj = Parent.parse_obj({ + "optional_dict": dict( + (_k, InnerDictWithProperty.from_dict(_v)) + for _k, _v in obj.get("optionalDict").items() + ) + if obj.get("optionalDict") 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/parent_with_optional_dict.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/parent_with_optional_dict.py new file mode 100644 index 00000000000..fa23256f5c6 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/parent_with_optional_dict.py @@ -0,0 +1,96 @@ +# 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, Optional +from pydantic import BaseModel, Field +from petstore_api.models.inner_dict_with_property import InnerDictWithProperty + +class ParentWithOptionalDict(BaseModel): + """ + ParentWithOptionalDict + """ + optional_dict: Optional[Dict[str, InnerDictWithProperty]] = Field(None, alias="optionalDict") + additional_properties: Dict[str, Any] = {} + __properties = ["optionalDict"] + + 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) -> ParentWithOptionalDict: + """Create an instance of ParentWithOptionalDict 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 each value in optional_dict (dict) + _field_dict = {} + if self.optional_dict: + for _key in self.optional_dict: + if self.optional_dict[_key]: + _field_dict[_key] = self.optional_dict[_key].to_dict() + _dict['optionalDict'] = _field_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) -> ParentWithOptionalDict: + """Create an instance of ParentWithOptionalDict from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ParentWithOptionalDict.parse_obj(obj) + + _obj = ParentWithOptionalDict.parse_obj({ + "optional_dict": dict( + (_k, InnerDictWithProperty.from_dict(_v)) + for _k, _v in obj.get("optionalDict").items() + ) + if obj.get("optionalDict") 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/pet.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/pet.py new file mode 100644 index 00000000000..25743a7ef09 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/pet.py @@ -0,0 +1,115 @@ +# 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, List, Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator +from petstore_api.models.category import Category +from petstore_api.models.tag import Tag + +class Pet(BaseModel): + """ + Pet + """ + id: Optional[StrictInt] = None + category: Optional[Category] = None + name: StrictStr = Field(...) + photo_urls: conlist(StrictStr, min_items=0, unique_items=True) = Field(..., alias="photoUrls") + tags: Optional[conlist(Tag)] = None + status: Optional[StrictStr] = Field(None, description="pet status in the store") + additional_properties: Dict[str, Any] = {} + __properties = ["id", "category", "name", "photoUrls", "tags", "status"] + + @validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('available', 'pending', 'sold'): + raise ValueError("must be one of enum values ('available', 'pending', 'sold')") + 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) -> Pet: + """Create an instance of Pet 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 category + if self.category: + _dict['category'] = self.category.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in tags (list) + _items = [] + if self.tags: + for _item in self.tags: + if _item: + _items.append(_item.to_dict()) + _dict['tags'] = _items + # 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) -> Pet: + """Create an instance of Pet from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Pet.parse_obj(obj) + + _obj = Pet.parse_obj({ + "id": obj.get("id"), + "category": Category.from_dict(obj.get("category")) if obj.get("category") is not None else None, + "name": obj.get("name"), + "photo_urls": obj.get("photoUrls"), + "tags": [Tag.from_dict(_item) for _item in obj.get("tags")] if obj.get("tags") is not None else None, + "status": obj.get("status") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/pig.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/pig.py new file mode 100644 index 00000000000..62ae5a2a0ef --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/pig.py @@ -0,0 +1,159 @@ +# 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.basque_pig import BasquePig +from petstore_api.models.danish_pig import DanishPig +from typing import Union, Any, List, TYPE_CHECKING +from pydantic import StrictStr, Field + +PIG_ONE_OF_SCHEMAS = ["BasquePig", "DanishPig"] + +class Pig(BaseModel): + """ + Pig + """ + # data type: BasquePig + oneof_schema_1_validator: Optional[BasquePig] = None + # data type: DanishPig + oneof_schema_2_validator: Optional[DanishPig] = None + if TYPE_CHECKING: + actual_instance: Union[BasquePig, DanishPig] + else: + actual_instance: Any + one_of_schemas: List[str] = Field(PIG_ONE_OF_SCHEMAS, const=True) + + class Config: + validate_assignment = True + + discriminator_value_class_map = { + } + + 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 = Pig.construct() + error_messages = [] + match = 0 + # validate data type: BasquePig + if not isinstance(v, BasquePig): + error_messages.append(f"Error! Input type `{type(v)}` is not `BasquePig`") + else: + match += 1 + # validate data type: DanishPig + if not isinstance(v, DanishPig): + error_messages.append(f"Error! Input type `{type(v)}` is not `DanishPig`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in Pig with oneOf schemas: BasquePig, DanishPig. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in Pig with oneOf schemas: BasquePig, DanishPig. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: dict) -> Pig: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Pig: + """Returns the object represented by the json string""" + instance = Pig.construct() + error_messages = [] + match = 0 + + # use oneOf discriminator to lookup the data type + _data_type = json.loads(json_str).get("className") + if not _data_type: + raise ValueError("Failed to lookup data type from the field `className` in the input.") + + # check if data type is `BasquePig` + if _data_type == "BasquePig": + instance.actual_instance = BasquePig.from_json(json_str) + return instance + + # check if data type is `DanishPig` + if _data_type == "DanishPig": + instance.actual_instance = DanishPig.from_json(json_str) + return instance + + # deserialize data into BasquePig + try: + instance.actual_instance = BasquePig.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into DanishPig + try: + instance.actual_instance = DanishPig.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 Pig with oneOf schemas: BasquePig, DanishPig. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into Pig with oneOf schemas: BasquePig, DanishPig. 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()) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/property_name_collision.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/property_name_collision.py new file mode 100644 index 00000000000..b5314f3d63e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/property_name_collision.py @@ -0,0 +1,87 @@ +# 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, Optional +from pydantic import BaseModel, Field, StrictStr + +class PropertyNameCollision(BaseModel): + """ + PropertyNameCollision + """ + underscore_type: Optional[StrictStr] = Field(None, alias="_type") + type: Optional[StrictStr] = None + type_with_underscore: Optional[StrictStr] = Field(None, alias="type_") + additional_properties: Dict[str, Any] = {} + __properties = ["_type", "type", "type_"] + + 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) -> PropertyNameCollision: + """Create an instance of PropertyNameCollision 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) -> PropertyNameCollision: + """Create an instance of PropertyNameCollision from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return PropertyNameCollision.parse_obj(obj) + + _obj = PropertyNameCollision.parse_obj({ + "underscore_type": obj.get("_type"), + "type": obj.get("type"), + "type_with_underscore": obj.get("type_") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/read_only_first.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/read_only_first.py new file mode 100644 index 00000000000..cfaf97c7091 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/read_only_first.py @@ -0,0 +1,86 @@ +# 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, Optional +from pydantic import BaseModel, StrictStr + +class ReadOnlyFirst(BaseModel): + """ + ReadOnlyFirst + """ + bar: Optional[StrictStr] = None + baz: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties = ["bar", "baz"] + + 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) -> ReadOnlyFirst: + """Create an instance of ReadOnlyFirst 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={ + "bar", + "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) -> ReadOnlyFirst: + """Create an instance of ReadOnlyFirst from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ReadOnlyFirst.parse_obj(obj) + + _obj = ReadOnlyFirst.parse_obj({ + "bar": obj.get("bar"), + "baz": obj.get("baz") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/second_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/second_ref.py new file mode 100644 index 00000000000..2f0c99ae1b9 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/second_ref.py @@ -0,0 +1,90 @@ +# 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, Optional +from pydantic import BaseModel, StrictStr + +class SecondRef(BaseModel): + """ + SecondRef + """ + category: Optional[StrictStr] = None + circular_ref: Optional[CircularReferenceModel] = None + additional_properties: Dict[str, Any] = {} + __properties = ["category", "circular_ref"] + + 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) -> SecondRef: + """Create an instance of SecondRef 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 circular_ref + if self.circular_ref: + _dict['circular_ref'] = self.circular_ref.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) -> SecondRef: + """Create an instance of SecondRef from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return SecondRef.parse_obj(obj) + + _obj = SecondRef.parse_obj({ + "category": obj.get("category"), + "circular_ref": CircularReferenceModel.from_dict(obj.get("circular_ref")) if obj.get("circular_ref") 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 + +from petstore_api.models.circular_reference_model import CircularReferenceModel +SecondRef.update_forward_refs() + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/self_reference_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/self_reference_model.py new file mode 100644 index 00000000000..55512492d8e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/self_reference_model.py @@ -0,0 +1,90 @@ +# 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, Optional +from pydantic import BaseModel, StrictInt + +class SelfReferenceModel(BaseModel): + """ + SelfReferenceModel + """ + size: Optional[StrictInt] = None + nested: Optional[DummyModel] = None + additional_properties: Dict[str, Any] = {} + __properties = ["size", "nested"] + + 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) -> SelfReferenceModel: + """Create an instance of SelfReferenceModel 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 nested + if self.nested: + _dict['nested'] = self.nested.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) -> SelfReferenceModel: + """Create an instance of SelfReferenceModel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return SelfReferenceModel.parse_obj(obj) + + _obj = SelfReferenceModel.parse_obj({ + "size": obj.get("size"), + "nested": DummyModel.from_dict(obj.get("nested")) if obj.get("nested") 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 + +from petstore_api.models.dummy_model import DummyModel +SelfReferenceModel.update_forward_refs() + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/single_ref_type.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/single_ref_type.py new file mode 100644 index 00000000000..7edec4bb32c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/single_ref_type.py @@ -0,0 +1,40 @@ +# 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 json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class SingleRefType(str, Enum): + """ + SingleRefType + """ + + """ + allowed enum values + """ + ADMIN = 'admin' + USER = 'user' + + @classmethod + def from_json(cls, json_str: str) -> SingleRefType: + """Create an instance of SingleRefType from a JSON string""" + return SingleRefType(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/special_character_enum.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/special_character_enum.py new file mode 100644 index 00000000000..14b8a7e3fd6 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/special_character_enum.py @@ -0,0 +1,48 @@ +# 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 json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class SpecialCharacterEnum(str, Enum): + """ + SpecialCharacterEnum + """ + + """ + allowed enum values + """ + ENUM_456 = '456' + ENUM_123ABC = '123abc' + UNDERSCORE = '_' + SPACE = ' ' + AMPERSAND = '&' + DOLLAR = '$' + GREATER_THAN_EQUAL = '>=' + THIS_IS_EXCLAMATION = 'this_is_!' + IMPORT = 'import' + HELLO_WORLD = ' hello world ' + + @classmethod + def from_json(cls, json_str: str) -> SpecialCharacterEnum: + """Create an instance of SpecialCharacterEnum from a JSON string""" + return SpecialCharacterEnum(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/special_model_name.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/special_model_name.py new file mode 100644 index 00000000000..1c9804d5b4a --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/special_model_name.py @@ -0,0 +1,83 @@ +# 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, Optional +from pydantic import BaseModel, Field, StrictInt + +class SpecialModelName(BaseModel): + """ + SpecialModelName + """ + special_property_name: Optional[StrictInt] = Field(None, alias="$special[property.name]") + additional_properties: Dict[str, Any] = {} + __properties = ["$special[property.name]"] + + 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) -> SpecialModelName: + """Create an instance of SpecialModelName 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) -> SpecialModelName: + """Create an instance of SpecialModelName from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return SpecialModelName.parse_obj(obj) + + _obj = SpecialModelName.parse_obj({ + "special_property_name": obj.get("$special[property.name]") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/special_name.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/special_name.py new file mode 100644 index 00000000000..51d955951d4 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/special_name.py @@ -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, Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr, validator +from petstore_api.models.category import Category + +class SpecialName(BaseModel): + """ + SpecialName + """ + var_property: Optional[StrictInt] = Field(None, alias="property") + var_async: Optional[Category] = Field(None, alias="async") + var_schema: Optional[StrictStr] = Field(None, alias="schema", description="pet status in the store") + additional_properties: Dict[str, Any] = {} + __properties = ["property", "async", "schema"] + + @validator('var_schema') + def var_schema_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('available', 'pending', 'sold'): + raise ValueError("must be one of enum values ('available', 'pending', 'sold')") + 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) -> SpecialName: + """Create an instance of SpecialName 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 var_async + if self.var_async: + _dict['async'] = self.var_async.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) -> SpecialName: + """Create an instance of SpecialName from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return SpecialName.parse_obj(obj) + + _obj = SpecialName.parse_obj({ + "var_property": obj.get("property"), + "var_async": Category.from_dict(obj.get("async")) if obj.get("async") is not None else None, + "var_schema": obj.get("schema") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/tag.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/tag.py new file mode 100644 index 00000000000..29915985955 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/tag.py @@ -0,0 +1,85 @@ +# 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, Optional +from pydantic import BaseModel, StrictInt, StrictStr + +class Tag(BaseModel): + """ + Tag + """ + id: Optional[StrictInt] = None + name: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties = ["id", "name"] + + 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) -> Tag: + """Create an instance of Tag 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) -> Tag: + """Create an instance of Tag from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Tag.parse_obj(obj) + + _obj = Tag.parse_obj({ + "id": obj.get("id"), + "name": obj.get("name") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/test_inline_freeform_additional_properties_request.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/test_inline_freeform_additional_properties_request.py new file mode 100644 index 00000000000..c61f52a3e9e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/test_inline_freeform_additional_properties_request.py @@ -0,0 +1,83 @@ +# 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, Optional +from pydantic import BaseModel, Field, StrictStr + +class TestInlineFreeformAdditionalPropertiesRequest(BaseModel): + """ + TestInlineFreeformAdditionalPropertiesRequest + """ + some_property: Optional[StrictStr] = Field(None, alias="someProperty") + additional_properties: Dict[str, Any] = {} + __properties = ["someProperty"] + + 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) -> TestInlineFreeformAdditionalPropertiesRequest: + """Create an instance of TestInlineFreeformAdditionalPropertiesRequest 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) -> TestInlineFreeformAdditionalPropertiesRequest: + """Create an instance of TestInlineFreeformAdditionalPropertiesRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return TestInlineFreeformAdditionalPropertiesRequest.parse_obj(obj) + + _obj = TestInlineFreeformAdditionalPropertiesRequest.parse_obj({ + "some_property": obj.get("someProperty") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/tiger.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/tiger.py new file mode 100644 index 00000000000..71453dcec36 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/tiger.py @@ -0,0 +1,83 @@ +# 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, Optional +from pydantic import BaseModel, StrictStr + +class Tiger(BaseModel): + """ + Tiger + """ + skill: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties = ["skill"] + + 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) -> Tiger: + """Create an instance of Tiger 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) -> Tiger: + """Create an instance of Tiger from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Tiger.parse_obj(obj) + + _obj = Tiger.parse_obj({ + "skill": obj.get("skill") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/user.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/user.py new file mode 100644 index 00000000000..365c77ceb14 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/user.py @@ -0,0 +1,97 @@ +# 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, Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr + +class User(BaseModel): + """ + User + """ + id: Optional[StrictInt] = None + username: Optional[StrictStr] = None + first_name: Optional[StrictStr] = Field(None, alias="firstName") + last_name: Optional[StrictStr] = Field(None, alias="lastName") + email: Optional[StrictStr] = None + password: Optional[StrictStr] = None + phone: Optional[StrictStr] = None + user_status: Optional[StrictInt] = Field(None, alias="userStatus", description="User Status") + additional_properties: Dict[str, Any] = {} + __properties = ["id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus"] + + 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) -> User: + """Create an instance of User 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) -> User: + """Create an instance of User from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return User.parse_obj(obj) + + _obj = User.parse_obj({ + "id": obj.get("id"), + "username": obj.get("username"), + "first_name": obj.get("firstName"), + "last_name": obj.get("lastName"), + "email": obj.get("email"), + "password": obj.get("password"), + "phone": obj.get("phone"), + "user_status": obj.get("userStatus") + }) + # 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/with_nested_one_of.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/with_nested_one_of.py new file mode 100644 index 00000000000..8ec40c8eda1 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/with_nested_one_of.py @@ -0,0 +1,95 @@ +# 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, Optional +from pydantic import BaseModel, StrictInt +from petstore_api.models.one_of_enum_string import OneOfEnumString +from petstore_api.models.pig import Pig + +class WithNestedOneOf(BaseModel): + """ + WithNestedOneOf + """ + size: Optional[StrictInt] = None + nested_pig: Optional[Pig] = None + nested_oneof_enum_string: Optional[OneOfEnumString] = None + additional_properties: Dict[str, Any] = {} + __properties = ["size", "nested_pig", "nested_oneof_enum_string"] + + 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) -> WithNestedOneOf: + """Create an instance of WithNestedOneOf 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 nested_pig + if self.nested_pig: + _dict['nested_pig'] = self.nested_pig.to_dict() + # override the default output from pydantic by calling `to_dict()` of nested_oneof_enum_string + if self.nested_oneof_enum_string: + _dict['nested_oneof_enum_string'] = self.nested_oneof_enum_string.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) -> WithNestedOneOf: + """Create an instance of WithNestedOneOf from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return WithNestedOneOf.parse_obj(obj) + + _obj = WithNestedOneOf.parse_obj({ + "size": obj.get("size"), + "nested_pig": Pig.from_dict(obj.get("nested_pig")) if obj.get("nested_pig") is not None else None, + "nested_oneof_enum_string": OneOfEnumString.from_dict(obj.get("nested_oneof_enum_string")) if obj.get("nested_oneof_enum_string") 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 + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/py.typed b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/py.typed new file mode 100644 index 00000000000..e69de29bb2d diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/rest.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/rest.py new file mode 100644 index 00000000000..df9aca00804 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/rest.py @@ -0,0 +1,303 @@ +# 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 io +import json +import logging +import re +import ssl + +from urllib.parse import urlencode, quote_plus +import urllib3 + +from petstore_api.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError, BadRequestException + + +logger = logging.getLogger(__name__) + + +class RESTResponse(io.IOBase): + + def __init__(self, resp) -> None: + self.urllib3_response = resp + self.status = resp.status + self.reason = resp.reason + self.data = resp.data + + def getheaders(self): + """Returns a dictionary of the response headers.""" + return self.urllib3_response.headers + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.urllib3_response.headers.get(name, default) + + +class RESTClientObject: + + def __init__(self, configuration, pools_size=4, maxsize=None) -> None: + # urllib3.PoolManager will pass all kw parameters to connectionpool + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 + # maxsize is the number of requests to host that are allowed in parallel # noqa: E501 + # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 + + # cert_reqs + if configuration.verify_ssl: + cert_reqs = ssl.CERT_REQUIRED + else: + cert_reqs = ssl.CERT_NONE + + addition_pool_args = {} + if configuration.assert_hostname is not None: + addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 + + if configuration.retries is not None: + addition_pool_args['retries'] = configuration.retries + + if configuration.tls_server_name: + addition_pool_args['server_hostname'] = configuration.tls_server_name + + + if configuration.socket_options is not None: + addition_pool_args['socket_options'] = configuration.socket_options + + if maxsize is None: + if configuration.connection_pool_maxsize is not None: + maxsize = configuration.connection_pool_maxsize + else: + maxsize = 4 + + # https pool manager + if configuration.proxy: + self.pool_manager = urllib3.ProxyManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=configuration.ssl_ca_cert, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + proxy_url=configuration.proxy, + proxy_headers=configuration.proxy_headers, + **addition_pool_args + ) + else: + self.pool_manager = urllib3.PoolManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=configuration.ssl_ca_cert, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + **addition_pool_args + ) + + def request(self, method, url, query_params=None, headers=None, + body=None, post_params=None, _preload_content=True, + _request_timeout=None): + """Perform requests. + + :param method: http request method + :param url: http request url + :param query_params: query parameters in the url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + """ + method = method.upper() + assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', + 'PATCH', 'OPTIONS'] + + if post_params and body: + raise ApiValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + # url already contains the URL query string + # so reset query_params to empty dict + query_params = {} + + timeout = None + if _request_timeout: + if isinstance(_request_timeout, (int,float)): # noqa: E501,F821 + timeout = urllib3.Timeout(total=_request_timeout) + elif (isinstance(_request_timeout, tuple) and + len(_request_timeout) == 2): + timeout = urllib3.Timeout( + connect=_request_timeout[0], read=_request_timeout[1]) + + try: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + + # no content type provided or payload is json + if not headers.get('Content-Type') or re.search('json', headers['Content-Type'], re.IGNORECASE): + request_body = None + if body is not None: + request_body = json.dumps(body) + r = self.pool_manager.request( + method, url, + body=request_body, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + r = self.pool_manager.request( + method, url, + fields=post_params, + encode_multipart=False, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + elif headers['Content-Type'] == 'multipart/form-data': + # must del headers['Content-Type'], or the correct + # Content-Type which generated by urllib3 will be + # overwritten. + del headers['Content-Type'] + r = self.pool_manager.request( + method, url, + fields=post_params, + encode_multipart=True, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + # Pass a `string` parameter directly in the body to support + # other content types than Json when `body` argument is + # provided in serialized form + elif isinstance(body, str) or isinstance(body, bytes): + request_body = body + r = self.pool_manager.request( + method, url, + body=request_body, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + # For `GET`, `HEAD` + else: + r = self.pool_manager.request(method, url, + fields={}, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + except urllib3.exceptions.SSLError as e: + msg = "{0}\n{1}".format(type(e).__name__, str(e)) + raise ApiException(status=0, reason=msg) + + if _preload_content: + r = RESTResponse(r) + + # log response body + logger.debug("response body: %s", r.data) + + if not 200 <= r.status <= 299: + if r.status == 400: + raise BadRequestException(http_resp=r) + + if r.status == 401: + raise UnauthorizedException(http_resp=r) + + if r.status == 403: + raise ForbiddenException(http_resp=r) + + if r.status == 404: + raise NotFoundException(http_resp=r) + + if 500 <= r.status <= 599: + raise ServiceException(http_resp=r) + + raise ApiException(http_resp=r) + + return r + + def get_request(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("GET", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def head_request(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("HEAD", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def options_request(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("OPTIONS", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def delete_request(self, url, headers=None, query_params=None, body=None, + _preload_content=True, _request_timeout=None): + return self.request("DELETE", url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def post_request(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("POST", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def put_request(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PUT", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def patch_request(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PATCH", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/signing.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/signing.py new file mode 100644 index 00000000000..ec4d7d2a67f --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/signing.py @@ -0,0 +1,413 @@ +""" + 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 base64 import b64encode +from Crypto.IO import PEM, PKCS8 +from Crypto.Hash import SHA256, SHA512 +from Crypto.PublicKey import RSA, ECC +from Crypto.Signature import PKCS1_v1_5, pss, DSS +from email.utils import formatdate +import json +import os +import re +from time import time +from urllib.parse import urlencode, urlparse + +# The constants below define a subset of HTTP headers that can be included in the +# HTTP signature scheme. Additional headers may be included in the signature. + +# The '(request-target)' header is a calculated field that includes the HTTP verb, +# the URL path and the URL query. +HEADER_REQUEST_TARGET = '(request-target)' +# The time when the HTTP signature was generated. +HEADER_CREATED = '(created)' +# The time when the HTTP signature expires. The API server should reject HTTP requests +# that have expired. +HEADER_EXPIRES = '(expires)' +# The 'Host' header. +HEADER_HOST = 'Host' +# The 'Date' header. +HEADER_DATE = 'Date' +# When the 'Digest' header is included in the HTTP signature, the client automatically +# computes the digest of the HTTP request body, per RFC 3230. +HEADER_DIGEST = 'Digest' +# The 'Authorization' header is automatically generated by the client. It includes +# the list of signed headers and a base64-encoded signature. +HEADER_AUTHORIZATION = 'Authorization' + +# The constants below define the cryptographic schemes for the HTTP signature scheme. +SCHEME_HS2019 = 'hs2019' +SCHEME_RSA_SHA256 = 'rsa-sha256' +SCHEME_RSA_SHA512 = 'rsa-sha512' + +# The constants below define the signature algorithms that can be used for the HTTP +# signature scheme. +ALGORITHM_RSASSA_PSS = 'RSASSA-PSS' +ALGORITHM_RSASSA_PKCS1v15 = 'RSASSA-PKCS1-v1_5' + +ALGORITHM_ECDSA_MODE_FIPS_186_3 = 'fips-186-3' +ALGORITHM_ECDSA_MODE_DETERMINISTIC_RFC6979 = 'deterministic-rfc6979' +ALGORITHM_ECDSA_KEY_SIGNING_ALGORITHMS = { + ALGORITHM_ECDSA_MODE_FIPS_186_3, + ALGORITHM_ECDSA_MODE_DETERMINISTIC_RFC6979 +} + +# The cryptographic hash algorithm for the message signature. +HASH_SHA256 = 'sha256' +HASH_SHA512 = 'sha512' + + +class HttpSigningConfiguration: + """The configuration parameters for the HTTP signature security scheme. + The HTTP signature security scheme is used to sign HTTP requests with a private key + which is in possession of the API client. + An 'Authorization' header is calculated by creating a hash of select headers, + and optionally the body of the HTTP request, then signing the hash value using + a private key. The 'Authorization' header is added to outbound HTTP requests. + + :param key_id: A string value specifying the identifier of the cryptographic key, + when signing HTTP requests. + :param signing_scheme: A string value specifying the signature scheme, when + signing HTTP requests. + Supported value are hs2019, rsa-sha256, rsa-sha512. + Avoid using rsa-sha256, rsa-sha512 as they are deprecated. These values are + available for server-side applications that only support the older + HTTP signature algorithms. + :param private_key_path: A string value specifying the path of the file containing + a private key. The private key is used to sign HTTP requests. + :param private_key_passphrase: A string value specifying the passphrase to decrypt + the private key. + :param signed_headers: A list of strings. Each value is the name of a HTTP header + that must be included in the HTTP signature calculation. + The two special signature headers '(request-target)' and '(created)' SHOULD be + included in SignedHeaders. + The '(created)' header expresses when the signature was created. + The '(request-target)' header is a concatenation of the lowercased :method, an + ASCII space, and the :path pseudo-headers. + When signed_headers is not specified, the client defaults to a single value, + '(created)', in the list of HTTP headers. + When SignedHeaders contains the 'Digest' value, the client performs the + following operations: + 1. Calculate a digest of request body, as specified in RFC3230, section 4.3.2. + 2. Set the 'Digest' header in the request body. + 3. Include the 'Digest' header and value in the HTTP signature. + :param signing_algorithm: A string value specifying the signature algorithm, when + signing HTTP requests. + Supported values are: + 1. For RSA keys: RSASSA-PSS, RSASSA-PKCS1-v1_5. + 2. For ECDSA keys: fips-186-3, deterministic-rfc6979. + If None, the signing algorithm is inferred from the private key. + The default signing algorithm for RSA keys is RSASSA-PSS. + The default signing algorithm for ECDSA keys is fips-186-3. + :param hash_algorithm: The hash algorithm for the signature. Supported values are + sha256 and sha512. + If the signing_scheme is rsa-sha256, the hash algorithm must be set + to None or sha256. + If the signing_scheme is rsa-sha512, the hash algorithm must be set + to None or sha512. + :param signature_max_validity: The signature max validity, expressed as + a datetime.timedelta value. It must be a positive value. + """ + def __init__(self, key_id, signing_scheme, private_key_path, + private_key_passphrase=None, + signed_headers=None, + signing_algorithm=None, + hash_algorithm=None, + signature_max_validity=None) -> None: + self.key_id = key_id + if signing_scheme not in {SCHEME_HS2019, SCHEME_RSA_SHA256, SCHEME_RSA_SHA512}: + raise Exception("Unsupported security scheme: {0}".format(signing_scheme)) + self.signing_scheme = signing_scheme + if not os.path.exists(private_key_path): + raise Exception("Private key file does not exist") + self.private_key_path = private_key_path + self.private_key_passphrase = private_key_passphrase + self.signing_algorithm = signing_algorithm + self.hash_algorithm = hash_algorithm + if signing_scheme == SCHEME_RSA_SHA256: + if self.hash_algorithm is None: + self.hash_algorithm = HASH_SHA256 + elif self.hash_algorithm != HASH_SHA256: + raise Exception("Hash algorithm must be sha256 when security scheme is %s" % + SCHEME_RSA_SHA256) + elif signing_scheme == SCHEME_RSA_SHA512: + if self.hash_algorithm is None: + self.hash_algorithm = HASH_SHA512 + elif self.hash_algorithm != HASH_SHA512: + raise Exception("Hash algorithm must be sha512 when security scheme is %s" % + SCHEME_RSA_SHA512) + elif signing_scheme == SCHEME_HS2019: + if self.hash_algorithm is None: + self.hash_algorithm = HASH_SHA256 + elif self.hash_algorithm not in {HASH_SHA256, HASH_SHA512}: + raise Exception("Invalid hash algorithm") + if signature_max_validity is not None and signature_max_validity.total_seconds() < 0: + raise Exception("The signature max validity must be a positive value") + self.signature_max_validity = signature_max_validity + # If the user has not provided any signed_headers, the default must be set to '(created)', + # as specified in the 'HTTP signature' standard. + if signed_headers is None or len(signed_headers) == 0: + signed_headers = [HEADER_CREATED] + if self.signature_max_validity is None and HEADER_EXPIRES in signed_headers: + raise Exception( + "Signature max validity must be set when " + "'(expires)' signature parameter is specified") + if len(signed_headers) != len(set(signed_headers)): + raise Exception("Cannot have duplicates in the signed_headers parameter") + if HEADER_AUTHORIZATION in signed_headers: + raise Exception("'Authorization' header cannot be included in signed headers") + self.signed_headers = signed_headers + self.private_key = None + """The private key used to sign HTTP requests. + Initialized when the PEM-encoded private key is loaded from a file. + """ + self.host = None + """The host name, optionally followed by a colon and TCP port number. + """ + self._load_private_key() + + def get_http_signature_headers(self, resource_path, method, headers, body, query_params): + """Create a cryptographic message signature for the HTTP request and add the signed headers. + + :param resource_path : A string representation of the HTTP request resource path. + :param method: A string representation of the HTTP request method, e.g. GET, POST. + :param headers: A dict containing the HTTP request headers. + :param body: The object representing the HTTP request body. + :param query_params: A string representing the HTTP request query parameters. + :return: A dict of HTTP headers that must be added to the outbound HTTP request. + """ + if method is None: + raise Exception("HTTP method must be set") + if resource_path is None: + raise Exception("Resource path must be set") + + signed_headers_list, request_headers_dict = self._get_signed_header_info( + resource_path, method, headers, body, query_params) + + header_items = [ + "{0}: {1}".format(key.lower(), value) for key, value in signed_headers_list] + string_to_sign = "\n".join(header_items) + + digest, digest_prefix = self._get_message_digest(string_to_sign.encode()) + b64_signed_msg = self._sign_digest(digest) + + request_headers_dict[HEADER_AUTHORIZATION] = self._get_authorization_header( + signed_headers_list, b64_signed_msg) + + return request_headers_dict + + def get_public_key(self): + """Returns the public key object associated with the private key. + """ + pubkey = None + if isinstance(self.private_key, RSA.RsaKey): + pubkey = self.private_key.publickey() + elif isinstance(self.private_key, ECC.EccKey): + pubkey = self.private_key.public_key() + return pubkey + + def _load_private_key(self): + """Load the private key used to sign HTTP requests. + The private key is used to sign HTTP requests as defined in + https://datatracker.ietf.org/doc/draft-cavage-http-signatures/. + """ + if self.private_key is not None: + return + with open(self.private_key_path, 'r') as f: + pem_data = f.read() + # Verify PEM Pre-Encapsulation Boundary + r = re.compile(r"\s*-----BEGIN (.*)-----\s+") + m = r.match(pem_data) + if not m: + raise ValueError("Not a valid PEM pre boundary") + pem_header = m.group(1) + if pem_header == 'RSA PRIVATE KEY': + self.private_key = RSA.importKey(pem_data, self.private_key_passphrase) + elif pem_header == 'EC PRIVATE KEY': + self.private_key = ECC.import_key(pem_data, self.private_key_passphrase) + elif pem_header in {'PRIVATE KEY', 'ENCRYPTED PRIVATE KEY'}: + # Key is in PKCS8 format, which is capable of holding many different + # types of private keys, not just EC keys. + (key_binary, pem_header, is_encrypted) = \ + PEM.decode(pem_data, self.private_key_passphrase) + (oid, privkey, params) = \ + PKCS8.unwrap(key_binary, passphrase=self.private_key_passphrase) + if oid == '1.2.840.10045.2.1': + self.private_key = ECC.import_key(pem_data, self.private_key_passphrase) + else: + raise Exception("Unsupported key: {0}. OID: {1}".format(pem_header, oid)) + else: + raise Exception("Unsupported key: {0}".format(pem_header)) + # Validate the specified signature algorithm is compatible with the private key. + if self.signing_algorithm is not None: + supported_algs = None + if isinstance(self.private_key, RSA.RsaKey): + supported_algs = {ALGORITHM_RSASSA_PSS, ALGORITHM_RSASSA_PKCS1v15} + elif isinstance(self.private_key, ECC.EccKey): + supported_algs = ALGORITHM_ECDSA_KEY_SIGNING_ALGORITHMS + if supported_algs is not None and self.signing_algorithm not in supported_algs: + raise Exception( + "Signing algorithm {0} is not compatible with private key".format( + self.signing_algorithm)) + + def _get_signed_header_info(self, resource_path, method, headers, body, query_params): + """Build the HTTP headers (name, value) that need to be included in + the HTTP signature scheme. + + :param resource_path : A string representation of the HTTP request resource path. + :param method: A string representation of the HTTP request method, e.g. GET, POST. + :param headers: A dict containing the HTTP request headers. + :param body: The object (e.g. a dict) representing the HTTP request body. + :param query_params: A string representing the HTTP request query parameters. + :return: A tuple containing two dict objects: + The first dict contains the HTTP headers that are used to calculate + the HTTP signature. + The second dict contains the HTTP headers that must be added to + the outbound HTTP request. + """ + + if body is None: + body = '' + else: + body = body.to_json() + + # Build the '(request-target)' HTTP signature parameter. + target_host = urlparse(self.host).netloc + target_path = urlparse(self.host).path + request_target = method.lower() + " " + target_path + resource_path + if query_params: + request_target += "?" + urlencode(query_params) + + # Get UNIX time, e.g. seconds since epoch, not including leap seconds. + now = time() + # Format date per RFC 7231 section-7.1.1.2. An example is: + # Date: Wed, 21 Oct 2015 07:28:00 GMT + cdate = formatdate(timeval=now, localtime=False, usegmt=True) + # The '(created)' value MUST be a Unix timestamp integer value. + # Subsecond precision is not supported. + created = int(now) + if self.signature_max_validity is not None: + expires = now + self.signature_max_validity.total_seconds() + + signed_headers_list = [] + request_headers_dict = {} + for hdr_key in self.signed_headers: + hdr_key = hdr_key.lower() + if hdr_key == HEADER_REQUEST_TARGET: + value = request_target + elif hdr_key == HEADER_CREATED: + value = '{0}'.format(created) + elif hdr_key == HEADER_EXPIRES: + value = '{0}'.format(expires) + elif hdr_key == HEADER_DATE.lower(): + value = cdate + request_headers_dict[HEADER_DATE] = '{0}'.format(cdate) + elif hdr_key == HEADER_DIGEST.lower(): + request_body = body.encode() + body_digest, digest_prefix = self._get_message_digest(request_body) + b64_body_digest = b64encode(body_digest.digest()) + value = digest_prefix + b64_body_digest.decode('ascii') + request_headers_dict[HEADER_DIGEST] = '{0}{1}'.format( + digest_prefix, b64_body_digest.decode('ascii')) + elif hdr_key == HEADER_HOST.lower(): + value = target_host + request_headers_dict[HEADER_HOST] = '{0}'.format(target_host) + else: + value = next((v for k, v in headers.items() if k.lower() == hdr_key), None) + if value is None: + raise Exception( + "Cannot sign HTTP request. " + "Request does not contain the '{0}' header".format(hdr_key)) + signed_headers_list.append((hdr_key, value)) + + return signed_headers_list, request_headers_dict + + def _get_message_digest(self, data): + """Calculates and returns a cryptographic digest of a specified HTTP request. + + :param data: The string representation of the date to be hashed with a cryptographic hash. + :return: A tuple of (digest, prefix). + The digest is a hashing object that contains the cryptographic digest of + the HTTP request. + The prefix is a string that identifies the cryptographic hash. It is used + to generate the 'Digest' header as specified in RFC 3230. + """ + if self.hash_algorithm == HASH_SHA512: + digest = SHA512.new() + prefix = 'SHA-512=' + elif self.hash_algorithm == HASH_SHA256: + digest = SHA256.new() + prefix = 'SHA-256=' + else: + raise Exception("Unsupported hash algorithm: {0}".format(self.hash_algorithm)) + digest.update(data) + return digest, prefix + + def _sign_digest(self, digest): + """Signs a message digest with a private key specified in the signing_info. + + :param digest: A hashing object that contains the cryptographic digest of the HTTP request. + :return: A base-64 string representing the cryptographic signature of the input digest. + """ + sig_alg = self.signing_algorithm + if isinstance(self.private_key, RSA.RsaKey): + if sig_alg is None or sig_alg == ALGORITHM_RSASSA_PSS: + # RSASSA-PSS in Section 8.1 of RFC8017. + signature = pss.new(self.private_key).sign(digest) + elif sig_alg == ALGORITHM_RSASSA_PKCS1v15: + # RSASSA-PKCS1-v1_5 in Section 8.2 of RFC8017. + signature = PKCS1_v1_5.new(self.private_key).sign(digest) + else: + raise Exception("Unsupported signature algorithm: {0}".format(sig_alg)) + elif isinstance(self.private_key, ECC.EccKey): + if sig_alg is None: + sig_alg = ALGORITHM_ECDSA_MODE_FIPS_186_3 + if sig_alg in ALGORITHM_ECDSA_KEY_SIGNING_ALGORITHMS: + # draft-ietf-httpbis-message-signatures-00 does not specify the ECDSA encoding. + # Issue: https://github.com/w3c-ccg/http-signatures/issues/107 + signature = DSS.new(key=self.private_key, mode=sig_alg, + encoding='der').sign(digest) + else: + raise Exception("Unsupported signature algorithm: {0}".format(sig_alg)) + else: + raise Exception("Unsupported private key: {0}".format(type(self.private_key))) + return b64encode(signature) + + def _get_authorization_header(self, signed_headers, signed_msg): + """Calculates and returns the value of the 'Authorization' header when signing HTTP requests. + + :param signed_headers : A list of tuples. Each value is the name of a HTTP header that + must be included in the HTTP signature calculation. + :param signed_msg: A base-64 encoded string representation of the signature. + :return: The string value of the 'Authorization' header, representing the signature + of the HTTP request. + """ + created_ts = None + expires_ts = None + for k, v in signed_headers: + if k == HEADER_CREATED: + created_ts = v + elif k == HEADER_EXPIRES: + expires_ts = v + lower_keys = [k.lower() for k, v in signed_headers] + headers_value = " ".join(lower_keys) + + auth_str = "Signature keyId=\"{0}\",algorithm=\"{1}\",".format( + self.key_id, self.signing_scheme) + if created_ts is not None: + auth_str = auth_str + "created={0},".format(created_ts) + if expires_ts is not None: + auth_str = auth_str + "expires={0},".format(expires_ts) + auth_str = auth_str + "headers=\"{0}\",signature=\"{1}\"".format( + headers_value, signed_msg.decode('ascii')) + + return auth_str diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/pyproject.toml b/samples/openapi3/client/petstore/python-pydantic-v1/pyproject.toml new file mode 100644 index 00000000000..be791aff52a --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/pyproject.toml @@ -0,0 +1,32 @@ +[tool.poetry] +name = "petstore_api" +version = "1.0.0" +description = "OpenAPI Petstore" +authors = ["OpenAPI Generator Community "] +license = "Apache-2.0" +readme = "README.md" +repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID" +keywords = ["OpenAPI", "OpenAPI-Generator", "OpenAPI Petstore"] +include = ["petstore_api/py.typed"] + +[tool.poetry.dependencies] +python = "^3.7" + +urllib3 = ">= 1.25.3" +python-dateutil = ">=2.8.2" +pem = ">= 19.3.0" +pycryptodome = ">= 3.9.0" +pydantic = "^1.10.5, <2" +aenum = ">=3.1.11" + +[tool.poetry.dev-dependencies] +pytest = ">=7.2.1" +tox = ">=3.9.0" +flake8 = ">=4.0.0" + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[tool.pylint.'MESSAGES CONTROL'] +extension-pkg-whitelist = "pydantic" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/requirements.txt b/samples/openapi3/client/petstore/python-pydantic-v1/requirements.txt new file mode 100644 index 00000000000..e807d94fe0a --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/requirements.txt @@ -0,0 +1,6 @@ +python_dateutil >= 2.5.3 +setuptools >= 21.0.0 +urllib3 >= 1.25.3, < 2.1.0 +pydantic >= 1.10.5, < 2 +aenum >= 3.1.11 +pycryptodome >= 3.9.0 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/setup.cfg b/samples/openapi3/client/petstore/python-pydantic-v1/setup.cfg new file mode 100644 index 00000000000..11433ee875a --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/setup.cfg @@ -0,0 +1,2 @@ +[flake8] +max-line-length=99 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/setup.py b/samples/openapi3/client/petstore/python-pydantic-v1/setup.py new file mode 100644 index 00000000000..283e0441c00 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/setup.py @@ -0,0 +1,52 @@ +# 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 setuptools import setup, find_packages # noqa: H301 + +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools +NAME = "petstore-api" +VERSION = "1.0.0" +PYTHON_REQUIRES = ">=3.7" +REQUIRES = [ + "urllib3 >= 1.25.3, < 2.1.0", + "python-dateutil", + "pem>=19.3.0", + "pycryptodome>=3.9.0", + "pydantic >= 1.10.5, < 2", + "aenum" +] + +setup( + name=NAME, + version=VERSION, + description="OpenAPI Petstore", + author="OpenAPI Generator community", + author_email="team@openapitools.org", + url="", + keywords=["OpenAPI", "OpenAPI-Generator", "OpenAPI Petstore"], + install_requires=REQUIRES, + packages=find_packages(exclude=["test", "tests"]), + include_package_data=True, + license="Apache-2.0", + long_description_content_type='text/markdown', + long_description="""\ + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + """, # noqa: E501 + package_data={"petstore_api": ["py.typed"]}, +) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test-requirements.txt b/samples/openapi3/client/petstore/python-pydantic-v1/test-requirements.txt new file mode 100644 index 00000000000..3a0d0b939a1 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test-requirements.txt @@ -0,0 +1,3 @@ +pytest~=7.1.3 +pytest-cov>=2.8.1 +pytest-randomly>=3.12.0 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_any_type.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_any_type.py new file mode 100644 index 00000000000..a1669f0664d --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_any_type.py @@ -0,0 +1,52 @@ +# 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.additional_properties_any_type import AdditionalPropertiesAnyType # noqa: E501 + +class TestAdditionalPropertiesAnyType(unittest.TestCase): + """AdditionalPropertiesAnyType unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AdditionalPropertiesAnyType: + """Test AdditionalPropertiesAnyType + 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 `AdditionalPropertiesAnyType` + """ + model = AdditionalPropertiesAnyType() # noqa: E501 + if include_optional: + return AdditionalPropertiesAnyType( + name = '' + ) + else: + return AdditionalPropertiesAnyType( + ) + """ + + def testAdditionalPropertiesAnyType(self): + """Test AdditionalPropertiesAnyType""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_class.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_class.py new file mode 100644 index 00000000000..d1dc12c4458 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_class.py @@ -0,0 +1,59 @@ +# 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.additional_properties_class import AdditionalPropertiesClass # noqa: E501 + +class TestAdditionalPropertiesClass(unittest.TestCase): + """AdditionalPropertiesClass unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AdditionalPropertiesClass: + """Test AdditionalPropertiesClass + 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 `AdditionalPropertiesClass` + """ + model = AdditionalPropertiesClass() # noqa: E501 + if include_optional: + return AdditionalPropertiesClass( + map_property = { + 'key' : '' + }, + map_of_map_property = { + 'key' : { + 'key' : '' + } + } + ) + else: + return AdditionalPropertiesClass( + ) + """ + + def testAdditionalPropertiesClass(self): + """Test AdditionalPropertiesClass""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_object.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_object.py new file mode 100644 index 00000000000..9bfa2a0cde8 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_object.py @@ -0,0 +1,52 @@ +# 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.additional_properties_object import AdditionalPropertiesObject # noqa: E501 + +class TestAdditionalPropertiesObject(unittest.TestCase): + """AdditionalPropertiesObject unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AdditionalPropertiesObject: + """Test AdditionalPropertiesObject + 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 `AdditionalPropertiesObject` + """ + model = AdditionalPropertiesObject() # noqa: E501 + if include_optional: + return AdditionalPropertiesObject( + name = '' + ) + else: + return AdditionalPropertiesObject( + ) + """ + + def testAdditionalPropertiesObject(self): + """Test AdditionalPropertiesObject""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_with_description_only.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_with_description_only.py new file mode 100644 index 00000000000..88df1cc9295 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_with_description_only.py @@ -0,0 +1,52 @@ +# 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.additional_properties_with_description_only import AdditionalPropertiesWithDescriptionOnly # noqa: E501 + +class TestAdditionalPropertiesWithDescriptionOnly(unittest.TestCase): + """AdditionalPropertiesWithDescriptionOnly unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AdditionalPropertiesWithDescriptionOnly: + """Test AdditionalPropertiesWithDescriptionOnly + 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 `AdditionalPropertiesWithDescriptionOnly` + """ + model = AdditionalPropertiesWithDescriptionOnly() # noqa: E501 + if include_optional: + return AdditionalPropertiesWithDescriptionOnly( + name = '' + ) + else: + return AdditionalPropertiesWithDescriptionOnly( + ) + """ + + def testAdditionalPropertiesWithDescriptionOnly(self): + """Test AdditionalPropertiesWithDescriptionOnly""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_all_of_with_single_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_all_of_with_single_ref.py new file mode 100644 index 00000000000..920ad3782e1 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_all_of_with_single_ref.py @@ -0,0 +1,53 @@ +# 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.all_of_with_single_ref import AllOfWithSingleRef # noqa: E501 + +class TestAllOfWithSingleRef(unittest.TestCase): + """AllOfWithSingleRef unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AllOfWithSingleRef: + """Test AllOfWithSingleRef + 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 `AllOfWithSingleRef` + """ + model = AllOfWithSingleRef() # noqa: E501 + if include_optional: + return AllOfWithSingleRef( + username = '', + single_ref_type = 'admin' + ) + else: + return AllOfWithSingleRef( + ) + """ + + def testAllOfWithSingleRef(self): + """Test AllOfWithSingleRef""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_animal.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_animal.py new file mode 100644 index 00000000000..b0b62a0bb2b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_animal.py @@ -0,0 +1,54 @@ +# 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.animal import Animal # noqa: E501 + +class TestAnimal(unittest.TestCase): + """Animal unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Animal: + """Test Animal + 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 `Animal` + """ + model = Animal() # noqa: E501 + if include_optional: + return Animal( + class_name = '', + color = 'red' + ) + else: + return Animal( + class_name = '', + ) + """ + + def testAnimal(self): + """Test Animal""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_another_fake_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_another_fake_api.py new file mode 100644 index 00000000000..a6070f5b5f5 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_another_fake_api.py @@ -0,0 +1,38 @@ +# 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.api.another_fake_api import AnotherFakeApi # noqa: E501 + + +class TestAnotherFakeApi(unittest.TestCase): + """AnotherFakeApi unit test stubs""" + + def setUp(self) -> None: + self.api = AnotherFakeApi() # noqa: E501 + + def tearDown(self) -> None: + pass + + def test_call_123_test_special_tags(self) -> None: + """Test case for call_123_test_special_tags + + To test special tags # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_color.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_color.py new file mode 100644 index 00000000000..f99dfd0020b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_color.py @@ -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 +import datetime + +from petstore_api.models.any_of_color import AnyOfColor # noqa: E501 + +class TestAnyOfColor(unittest.TestCase): + """AnyOfColor unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AnyOfColor: + """Test AnyOfColor + 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 `AnyOfColor` + """ + model = AnyOfColor() # noqa: E501 + if include_optional: + return AnyOfColor( + ) + else: + return AnyOfColor( + ) + """ + + def testAnyOfColor(self): + """Test AnyOfColor""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_pig.py new file mode 100644 index 00000000000..c3e4760182c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_pig.py @@ -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.any_of_pig import AnyOfPig # noqa: E501 + +class TestAnyOfPig(unittest.TestCase): + """AnyOfPig unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> AnyOfPig: + """Test AnyOfPig + 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 `AnyOfPig` + """ + model = AnyOfPig() # noqa: E501 + if include_optional: + return AnyOfPig( + class_name = '', + color = '', + size = 56 + ) + else: + return AnyOfPig( + class_name = '', + color = '', + size = 56, + ) + """ + + def testAnyOfPig(self): + """Test AnyOfPig""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_api_response.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_api_response.py new file mode 100644 index 00000000000..9882aa1b900 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_api_response.py @@ -0,0 +1,54 @@ +# 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.api_response import ApiResponse # noqa: E501 + +class TestApiResponse(unittest.TestCase): + """ApiResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ApiResponse: + """Test ApiResponse + 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 `ApiResponse` + """ + model = ApiResponse() # noqa: E501 + if include_optional: + return ApiResponse( + code = 56, + type = '', + message = '' + ) + else: + return ApiResponse( + ) + """ + + def testApiResponse(self): + """Test ApiResponse""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_model.py new file mode 100644 index 00000000000..7c0809b0b23 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_model.py @@ -0,0 +1,58 @@ +# 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.array_of_array_of_model import ArrayOfArrayOfModel # noqa: E501 + +class TestArrayOfArrayOfModel(unittest.TestCase): + """ArrayOfArrayOfModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ArrayOfArrayOfModel: + """Test ArrayOfArrayOfModel + 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 `ArrayOfArrayOfModel` + """ + model = ArrayOfArrayOfModel() # noqa: E501 + if include_optional: + return ArrayOfArrayOfModel( + another_property = [ + [ + petstore_api.models.tag.Tag( + id = 56, + name = '', ) + ] + ] + ) + else: + return ArrayOfArrayOfModel( + ) + """ + + def testArrayOfArrayOfModel(self): + """Test ArrayOfArrayOfModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_number_only.py new file mode 100644 index 00000000000..22160c2bd05 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_number_only.py @@ -0,0 +1,56 @@ +# 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.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly # noqa: E501 + +class TestArrayOfArrayOfNumberOnly(unittest.TestCase): + """ArrayOfArrayOfNumberOnly unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ArrayOfArrayOfNumberOnly: + """Test ArrayOfArrayOfNumberOnly + 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 `ArrayOfArrayOfNumberOnly` + """ + model = ArrayOfArrayOfNumberOnly() # noqa: E501 + if include_optional: + return ArrayOfArrayOfNumberOnly( + array_array_number = [ + [ + 1.337 + ] + ] + ) + else: + return ArrayOfArrayOfNumberOnly( + ) + """ + + def testArrayOfArrayOfNumberOnly(self): + """Test ArrayOfArrayOfNumberOnly""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_number_only.py new file mode 100644 index 00000000000..ade32f4f8f2 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_number_only.py @@ -0,0 +1,54 @@ +# 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.array_of_number_only import ArrayOfNumberOnly # noqa: E501 + +class TestArrayOfNumberOnly(unittest.TestCase): + """ArrayOfNumberOnly unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ArrayOfNumberOnly: + """Test ArrayOfNumberOnly + 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 `ArrayOfNumberOnly` + """ + model = ArrayOfNumberOnly() # noqa: E501 + if include_optional: + return ArrayOfNumberOnly( + array_number = [ + 1.337 + ] + ) + else: + return ArrayOfNumberOnly( + ) + """ + + def testArrayOfNumberOnly(self): + """Test ArrayOfNumberOnly""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_test.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_test.py new file mode 100644 index 00000000000..dc20a60413c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_test.py @@ -0,0 +1,66 @@ +# 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.array_test import ArrayTest # noqa: E501 + +class TestArrayTest(unittest.TestCase): + """ArrayTest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ArrayTest: + """Test ArrayTest + 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 `ArrayTest` + """ + model = ArrayTest() # noqa: E501 + if include_optional: + return ArrayTest( + array_of_string = [ + '' + ], + array_array_of_integer = [ + [ + 56 + ] + ], + array_array_of_model = [ + [ + petstore_api.models.read_only_first.ReadOnlyFirst( + bar = '', + baz = '', ) + ] + ] + ) + else: + return ArrayTest( + ) + """ + + def testArrayTest(self): + """Test ArrayTest""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_basque_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_basque_pig.py new file mode 100644 index 00000000000..42f62fa3111 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_basque_pig.py @@ -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.basque_pig import BasquePig # noqa: E501 + +class TestBasquePig(unittest.TestCase): + """BasquePig unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> BasquePig: + """Test BasquePig + 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 `BasquePig` + """ + model = BasquePig() # noqa: E501 + if include_optional: + return BasquePig( + class_name = '', + color = '' + ) + else: + return BasquePig( + class_name = '', + color = '', + ) + """ + + def testBasquePig(self): + """Test BasquePig""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_capitalization.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_capitalization.py new file mode 100644 index 00000000000..17b75e51e36 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_capitalization.py @@ -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.capitalization import Capitalization # noqa: E501 + +class TestCapitalization(unittest.TestCase): + """Capitalization unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Capitalization: + """Test Capitalization + 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 `Capitalization` + """ + model = Capitalization() # noqa: E501 + if include_optional: + return Capitalization( + small_camel = '', + capital_camel = '', + small_snake = '', + capital_snake = '', + sca_eth_flow_points = '', + att_name = '' + ) + else: + return Capitalization( + ) + """ + + def testCapitalization(self): + """Test Capitalization""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_cat.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_cat.py new file mode 100644 index 00000000000..58e743f44c8 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_cat.py @@ -0,0 +1,52 @@ +# 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.cat import Cat # noqa: E501 + +class TestCat(unittest.TestCase): + """Cat unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Cat: + """Test Cat + 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 `Cat` + """ + model = Cat() # noqa: E501 + if include_optional: + return Cat( + declawed = True + ) + else: + return Cat( + ) + """ + + def testCat(self): + """Test Cat""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_category.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_category.py new file mode 100644 index 00000000000..2a287246f81 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_category.py @@ -0,0 +1,54 @@ +# 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.category import Category # noqa: E501 + +class TestCategory(unittest.TestCase): + """Category unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Category: + """Test Category + 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 `Category` + """ + model = Category() # noqa: E501 + if include_optional: + return Category( + id = 56, + name = 'default-name' + ) + else: + return Category( + name = 'default-name', + ) + """ + + def testCategory(self): + """Test Category""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_circular_reference_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_circular_reference_model.py new file mode 100644 index 00000000000..f23f0200022 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_circular_reference_model.py @@ -0,0 +1,60 @@ +# 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.circular_reference_model import CircularReferenceModel # noqa: E501 + +class TestCircularReferenceModel(unittest.TestCase): + """CircularReferenceModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> CircularReferenceModel: + """Test CircularReferenceModel + 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 `CircularReferenceModel` + """ + model = CircularReferenceModel() # noqa: E501 + if include_optional: + return CircularReferenceModel( + size = 56, + nested = petstore_api.models.first_ref.FirstRef( + category = '', + self_ref = petstore_api.models.second_ref.SecondRef( + category = '', + circular_ref = petstore_api.models.circular_reference_model.Circular-Reference-Model( + size = 56, + nested = petstore_api.models.first_ref.FirstRef( + category = '', ), ), ), ) + ) + else: + return CircularReferenceModel( + ) + """ + + def testCircularReferenceModel(self): + """Test CircularReferenceModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_class_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_class_model.py new file mode 100644 index 00000000000..6b78a194182 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_class_model.py @@ -0,0 +1,52 @@ +# 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.class_model import ClassModel # noqa: E501 + +class TestClassModel(unittest.TestCase): + """ClassModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ClassModel: + """Test ClassModel + 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 `ClassModel` + """ + model = ClassModel() # noqa: E501 + if include_optional: + return ClassModel( + var_class = '' + ) + else: + return ClassModel( + ) + """ + + def testClassModel(self): + """Test ClassModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_client.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_client.py new file mode 100644 index 00000000000..9d109601e81 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_client.py @@ -0,0 +1,52 @@ +# 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.client import Client # noqa: E501 + +class TestClient(unittest.TestCase): + """Client unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Client: + """Test Client + 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 `Client` + """ + model = Client() # noqa: E501 + if include_optional: + return Client( + client = '' + ) + else: + return Client( + ) + """ + + def testClient(self): + """Test Client""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_color.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_color.py new file mode 100644 index 00000000000..21f53552b36 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_color.py @@ -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 +import datetime + +from petstore_api.models.color import Color # noqa: E501 + +class TestColor(unittest.TestCase): + """Color unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Color: + """Test Color + 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 `Color` + """ + model = Color() # noqa: E501 + if include_optional: + return Color( + ) + else: + return Color( + ) + """ + + def testColor(self): + """Test Color""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature.py new file mode 100644 index 00000000000..af6b9ef7b31 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature.py @@ -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.creature import Creature # noqa: E501 + +class TestCreature(unittest.TestCase): + """Creature unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Creature: + """Test Creature + 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 `Creature` + """ + model = Creature() # noqa: E501 + if include_optional: + return Creature( + info = petstore_api.models.creature_info.CreatureInfo( + name = '', ), + type = '' + ) + else: + return Creature( + info = petstore_api.models.creature_info.CreatureInfo( + name = '', ), + type = '', + ) + """ + + def testCreature(self): + """Test Creature""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature_info.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature_info.py new file mode 100644 index 00000000000..a95dfd3d922 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature_info.py @@ -0,0 +1,53 @@ +# 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.creature_info import CreatureInfo # noqa: E501 + +class TestCreatureInfo(unittest.TestCase): + """CreatureInfo unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> CreatureInfo: + """Test CreatureInfo + 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 `CreatureInfo` + """ + model = CreatureInfo() # noqa: E501 + if include_optional: + return CreatureInfo( + name = '' + ) + else: + return CreatureInfo( + name = '', + ) + """ + + def testCreatureInfo(self): + """Test CreatureInfo""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_danish_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_danish_pig.py new file mode 100644 index 00000000000..bbd0ffcb5f0 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_danish_pig.py @@ -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.danish_pig import DanishPig # noqa: E501 + +class TestDanishPig(unittest.TestCase): + """DanishPig unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DanishPig: + """Test DanishPig + 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 `DanishPig` + """ + model = DanishPig() # noqa: E501 + if include_optional: + return DanishPig( + class_name = '', + size = 56 + ) + else: + return DanishPig( + class_name = '', + size = 56, + ) + """ + + def testDanishPig(self): + """Test DanishPig""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_default_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_default_api.py new file mode 100644 index 00000000000..2d9b266a725 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_default_api.py @@ -0,0 +1,37 @@ +# 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.api.default_api import DefaultApi # noqa: E501 + + +class TestDefaultApi(unittest.TestCase): + """DefaultApi unit test stubs""" + + def setUp(self) -> None: + self.api = DefaultApi() # noqa: E501 + + def tearDown(self) -> None: + pass + + def test_foo_get(self) -> None: + """Test case for foo_get + + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_deprecated_object.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_deprecated_object.py new file mode 100644 index 00000000000..ba3a63c719d --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_deprecated_object.py @@ -0,0 +1,52 @@ +# 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.deprecated_object import DeprecatedObject # noqa: E501 + +class TestDeprecatedObject(unittest.TestCase): + """DeprecatedObject unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DeprecatedObject: + """Test DeprecatedObject + 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 `DeprecatedObject` + """ + model = DeprecatedObject() # noqa: E501 + if include_optional: + return DeprecatedObject( + name = '' + ) + else: + return DeprecatedObject( + ) + """ + + def testDeprecatedObject(self): + """Test DeprecatedObject""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_dog.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_dog.py new file mode 100644 index 00000000000..d8a51df906c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_dog.py @@ -0,0 +1,52 @@ +# 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.dog import Dog # noqa: E501 + +class TestDog(unittest.TestCase): + """Dog unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Dog: + """Test Dog + 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 `Dog` + """ + model = Dog() # noqa: E501 + if include_optional: + return Dog( + breed = '' + ) + else: + return Dog( + ) + """ + + def testDog(self): + """Test Dog""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_dummy_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_dummy_model.py new file mode 100644 index 00000000000..45459b666b1 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_dummy_model.py @@ -0,0 +1,56 @@ +# 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.dummy_model import DummyModel # noqa: E501 + +class TestDummyModel(unittest.TestCase): + """DummyModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DummyModel: + """Test DummyModel + 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 `DummyModel` + """ + model = DummyModel() # noqa: E501 + if include_optional: + return DummyModel( + category = '', + self_ref = petstore_api.models.self_reference_model.Self-Reference-Model( + size = 56, + nested = petstore_api.models.dummy_model.Dummy-Model( + category = '', ), ) + ) + else: + return DummyModel( + ) + """ + + def testDummyModel(self): + """Test DummyModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_arrays.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_arrays.py new file mode 100644 index 00000000000..21e4cf531c4 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_arrays.py @@ -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.enum_arrays import EnumArrays # noqa: E501 + +class TestEnumArrays(unittest.TestCase): + """EnumArrays unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> EnumArrays: + """Test EnumArrays + 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 `EnumArrays` + """ + model = EnumArrays() # noqa: E501 + if include_optional: + return EnumArrays( + just_symbol = '>=', + array_enum = [ + 'fish' + ] + ) + else: + return EnumArrays( + ) + """ + + def testEnumArrays(self): + """Test EnumArrays""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_class.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_class.py new file mode 100644 index 00000000000..92822bcdd97 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_class.py @@ -0,0 +1,34 @@ +# 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.enum_class import EnumClass # noqa: E501 + +class TestEnumClass(unittest.TestCase): + """EnumClass unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEnumClass(self): + """Test EnumClass""" + # inst = EnumClass() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string1.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string1.py new file mode 100644 index 00000000000..9cbeacbe344 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string1.py @@ -0,0 +1,34 @@ +# 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.enum_string1 import EnumString1 # noqa: E501 + +class TestEnumString1(unittest.TestCase): + """EnumString1 unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEnumString1(self): + """Test EnumString1""" + # inst = EnumString1() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string2.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string2.py new file mode 100644 index 00000000000..409c7f257a5 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string2.py @@ -0,0 +1,34 @@ +# 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.enum_string2 import EnumString2 # noqa: E501 + +class TestEnumString2(unittest.TestCase): + """EnumString2 unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testEnumString2(self): + """Test EnumString2""" + # inst = EnumString2() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_test.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_test.py new file mode 100644 index 00000000000..b706fa63df2 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_test.py @@ -0,0 +1,61 @@ +# 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.enum_test import EnumTest # noqa: E501 + +class TestEnumTest(unittest.TestCase): + """EnumTest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> EnumTest: + """Test EnumTest + 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 `EnumTest` + """ + model = EnumTest() # noqa: E501 + if include_optional: + return EnumTest( + enum_string = 'UPPER', + enum_string_required = 'UPPER', + enum_integer_default = 1, + enum_integer = 1, + enum_number = 1.1, + outer_enum = 'placed', + outer_enum_integer = 2, + outer_enum_default_value = 'placed', + outer_enum_integer_default_value = -1 + ) + else: + return EnumTest( + enum_string_required = 'UPPER', + ) + """ + + def testEnumTest(self): + """Test EnumTest""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_api.py new file mode 100644 index 00000000000..0d3fca3d755 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_api.py @@ -0,0 +1,175 @@ +# 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.api.fake_api import FakeApi # noqa: E501 + + +class TestFakeApi(unittest.TestCase): + """FakeApi unit test stubs""" + + def setUp(self) -> None: + self.api = FakeApi() # noqa: E501 + + def tearDown(self) -> None: + pass + + def test_fake_any_type_request_body(self) -> None: + """Test case for fake_any_type_request_body + + test any type request body # noqa: E501 + """ + pass + + def test_fake_enum_ref_query_parameter(self) -> None: + """Test case for fake_enum_ref_query_parameter + + test enum reference query parameter # noqa: E501 + """ + pass + + def test_fake_health_get(self) -> None: + """Test case for fake_health_get + + Health check endpoint # noqa: E501 + """ + pass + + def test_fake_http_signature_test(self) -> None: + """Test case for fake_http_signature_test + + test http signature authentication # noqa: E501 + """ + pass + + def test_fake_outer_boolean_serialize(self) -> None: + """Test case for fake_outer_boolean_serialize + + """ + pass + + def test_fake_outer_composite_serialize(self) -> None: + """Test case for fake_outer_composite_serialize + + """ + pass + + def test_fake_outer_number_serialize(self) -> None: + """Test case for fake_outer_number_serialize + + """ + pass + + def test_fake_outer_string_serialize(self) -> None: + """Test case for fake_outer_string_serialize + + """ + pass + + def test_fake_property_enum_integer_serialize(self) -> None: + """Test case for fake_property_enum_integer_serialize + + """ + pass + + def test_fake_return_list_of_objects(self) -> None: + """Test case for fake_return_list_of_objects + + test returning list of objects # noqa: E501 + """ + pass + + def test_fake_uuid_example(self) -> None: + """Test case for fake_uuid_example + + test uuid example # noqa: E501 + """ + pass + + def test_test_body_with_binary(self) -> None: + """Test case for test_body_with_binary + + """ + pass + + def test_test_body_with_file_schema(self) -> None: + """Test case for test_body_with_file_schema + + """ + pass + + def test_test_body_with_query_params(self) -> None: + """Test case for test_body_with_query_params + + """ + pass + + def test_test_client_model(self) -> None: + """Test case for test_client_model + + To test \"client\" model # noqa: E501 + """ + pass + + def test_test_date_time_query_parameter(self) -> None: + """Test case for test_date_time_query_parameter + + """ + pass + + def test_test_endpoint_parameters(self) -> None: + """Test case for test_endpoint_parameters + + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 + """ + pass + + def test_test_group_parameters(self) -> None: + """Test case for test_group_parameters + + Fake endpoint to test group parameters (optional) # noqa: E501 + """ + pass + + def test_test_inline_additional_properties(self) -> None: + """Test case for test_inline_additional_properties + + test inline additionalProperties # noqa: E501 + """ + pass + + def test_test_inline_freeform_additional_properties(self) -> None: + """Test case for test_inline_freeform_additional_properties + + test inline free-form additionalProperties # noqa: E501 + """ + pass + + def test_test_json_form_data(self) -> None: + """Test case for test_json_form_data + + test json serialization of form data # noqa: E501 + """ + pass + + def test_test_query_parameter_collection_format(self) -> None: + """Test case for test_query_parameter_collection_format + + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_classname_tags123_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_classname_tags123_api.py new file mode 100644 index 00000000000..25088624aea --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_classname_tags123_api.py @@ -0,0 +1,38 @@ +# 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.api.fake_classname_tags123_api import FakeClassnameTags123Api # noqa: E501 + + +class TestFakeClassnameTags123Api(unittest.TestCase): + """FakeClassnameTags123Api unit test stubs""" + + def setUp(self) -> None: + self.api = FakeClassnameTags123Api() # noqa: E501 + + def tearDown(self) -> None: + pass + + def test_test_classname(self) -> None: + """Test case for test_classname + + To test class name in snake case # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_file.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_file.py new file mode 100644 index 00000000000..0896f1869db --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_file.py @@ -0,0 +1,52 @@ +# 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.file import File # noqa: E501 + +class TestFile(unittest.TestCase): + """File unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> File: + """Test File + 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 `File` + """ + model = File() # noqa: E501 + if include_optional: + return File( + source_uri = '' + ) + else: + return File( + ) + """ + + def testFile(self): + """Test File""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_file_schema_test_class.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_file_schema_test_class.py new file mode 100644 index 00000000000..72963bf91d5 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_file_schema_test_class.py @@ -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.file_schema_test_class import FileSchemaTestClass # noqa: E501 + +class TestFileSchemaTestClass(unittest.TestCase): + """FileSchemaTestClass unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> FileSchemaTestClass: + """Test FileSchemaTestClass + 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 `FileSchemaTestClass` + """ + model = FileSchemaTestClass() # noqa: E501 + if include_optional: + return FileSchemaTestClass( + file = petstore_api.models.file.File( + source_uri = '', ), + files = [ + petstore_api.models.file.File( + source_uri = '', ) + ] + ) + else: + return FileSchemaTestClass( + ) + """ + + def testFileSchemaTestClass(self): + """Test FileSchemaTestClass""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_first_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_first_ref.py new file mode 100644 index 00000000000..a99fc7cfc79 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_first_ref.py @@ -0,0 +1,58 @@ +# 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.first_ref import FirstRef # noqa: E501 + +class TestFirstRef(unittest.TestCase): + """FirstRef unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> FirstRef: + """Test FirstRef + 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 `FirstRef` + """ + model = FirstRef() # noqa: E501 + if include_optional: + return FirstRef( + category = '', + self_ref = petstore_api.models.second_ref.SecondRef( + category = '', + circular_ref = petstore_api.models.circular_reference_model.Circular-Reference-Model( + size = 56, + nested = petstore_api.models.first_ref.FirstRef( + category = '', ), ), ) + ) + else: + return FirstRef( + ) + """ + + def testFirstRef(self): + """Test FirstRef""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo.py new file mode 100644 index 00000000000..f92679671c7 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo.py @@ -0,0 +1,52 @@ +# 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.foo import Foo # noqa: E501 + +class TestFoo(unittest.TestCase): + """Foo unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Foo: + """Test Foo + 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 `Foo` + """ + model = Foo() # noqa: E501 + if include_optional: + return Foo( + bar = 'bar' + ) + else: + return Foo( + ) + """ + + def testFoo(self): + """Test Foo""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo_get_default_response.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo_get_default_response.py new file mode 100644 index 00000000000..3a024f8e6c7 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo_get_default_response.py @@ -0,0 +1,53 @@ +# 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.foo_get_default_response import FooGetDefaultResponse # noqa: E501 + +class TestFooGetDefaultResponse(unittest.TestCase): + """FooGetDefaultResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> FooGetDefaultResponse: + """Test FooGetDefaultResponse + 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 `FooGetDefaultResponse` + """ + model = FooGetDefaultResponse() # noqa: E501 + if include_optional: + return FooGetDefaultResponse( + string = petstore_api.models.foo.Foo( + bar = 'bar', ) + ) + else: + return FooGetDefaultResponse( + ) + """ + + def testFooGetDefaultResponse(self): + """Test FooGetDefaultResponse""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_format_test.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_format_test.py new file mode 100644 index 00000000000..72c8965d491 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_format_test.py @@ -0,0 +1,71 @@ +# 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.format_test import FormatTest # noqa: E501 + +class TestFormatTest(unittest.TestCase): + """FormatTest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> FormatTest: + """Test FormatTest + 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 `FormatTest` + """ + model = FormatTest() # noqa: E501 + if include_optional: + return FormatTest( + integer = 10, + int32 = 20, + int64 = 56, + number = 32.1, + float = 54.3, + double = 67.8, + decimal = 1, + string = 'a', + string_with_double_quote_pattern = 'this is \"something\"', + byte = 'YQ==', + binary = bytes(b'blah'), + var_date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + date_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + uuid = '72f98069-206d-4f12-9f12-3d1e525a8e84', + password = '0123456789', + pattern_with_digits = '0480728880', + pattern_with_digits_and_delimiter = 'image_480' + ) + else: + return FormatTest( + number = 32.1, + var_date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + password = '0123456789', + ) + """ + + def testFormatTest(self): + """Test FormatTest""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_has_only_read_only.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_has_only_read_only.py new file mode 100644 index 00000000000..f106dda48d7 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_has_only_read_only.py @@ -0,0 +1,53 @@ +# 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.has_only_read_only import HasOnlyReadOnly # noqa: E501 + +class TestHasOnlyReadOnly(unittest.TestCase): + """HasOnlyReadOnly unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> HasOnlyReadOnly: + """Test HasOnlyReadOnly + 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 `HasOnlyReadOnly` + """ + model = HasOnlyReadOnly() # noqa: E501 + if include_optional: + return HasOnlyReadOnly( + bar = '', + foo = '' + ) + else: + return HasOnlyReadOnly( + ) + """ + + def testHasOnlyReadOnly(self): + """Test HasOnlyReadOnly""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_health_check_result.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_health_check_result.py new file mode 100644 index 00000000000..4f36cde5f8b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_health_check_result.py @@ -0,0 +1,52 @@ +# 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.health_check_result import HealthCheckResult # noqa: E501 + +class TestHealthCheckResult(unittest.TestCase): + """HealthCheckResult unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> HealthCheckResult: + """Test HealthCheckResult + 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 `HealthCheckResult` + """ + model = HealthCheckResult() # noqa: E501 + if include_optional: + return HealthCheckResult( + nullable_message = '' + ) + else: + return HealthCheckResult( + ) + """ + + def testHealthCheckResult(self): + """Test HealthCheckResult""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_inner_dict_with_property.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_inner_dict_with_property.py new file mode 100644 index 00000000000..1ba15fd984d --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_inner_dict_with_property.py @@ -0,0 +1,52 @@ +# 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.inner_dict_with_property import InnerDictWithProperty # noqa: E501 + +class TestInnerDictWithProperty(unittest.TestCase): + """InnerDictWithProperty unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> InnerDictWithProperty: + """Test InnerDictWithProperty + 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 `InnerDictWithProperty` + """ + model = InnerDictWithProperty() # noqa: E501 + if include_optional: + return InnerDictWithProperty( + a_property = None + ) + else: + return InnerDictWithProperty( + ) + """ + + def testInnerDictWithProperty(self): + """Test InnerDictWithProperty""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_int_or_string.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_int_or_string.py new file mode 100644 index 00000000000..41bf80d02cb --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_int_or_string.py @@ -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 +import datetime + +from petstore_api.models.int_or_string import IntOrString # noqa: E501 + +class TestIntOrString(unittest.TestCase): + """IntOrString unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> IntOrString: + """Test IntOrString + 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 `IntOrString` + """ + model = IntOrString() # noqa: E501 + if include_optional: + return IntOrString( + ) + else: + return IntOrString( + ) + """ + + def testIntOrString(self): + """Test IntOrString""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_list.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_list.py new file mode 100644 index 00000000000..63be8f9a3d3 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_list.py @@ -0,0 +1,52 @@ +# 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.list import List # noqa: E501 + +class TestList(unittest.TestCase): + """List unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> List: + """Test List + 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 `List` + """ + model = List() # noqa: E501 + if include_optional: + return List( + var_123_list = '' + ) + else: + return List( + ) + """ + + def testList(self): + """Test List""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_of_array_of_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_of_array_of_model.py new file mode 100644 index 00000000000..2f88aa7935a --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_of_array_of_model.py @@ -0,0 +1,58 @@ +# 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.map_of_array_of_model import MapOfArrayOfModel # noqa: E501 + +class TestMapOfArrayOfModel(unittest.TestCase): + """MapOfArrayOfModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> MapOfArrayOfModel: + """Test MapOfArrayOfModel + 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 `MapOfArrayOfModel` + """ + model = MapOfArrayOfModel() # noqa: E501 + if include_optional: + return MapOfArrayOfModel( + shop_id_to_org_online_lip_map = { + 'key' : [ + petstore_api.models.tag.Tag( + id = 56, + name = '', ) + ] + } + ) + else: + return MapOfArrayOfModel( + ) + """ + + def testMapOfArrayOfModel(self): + """Test MapOfArrayOfModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_test.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_test.py new file mode 100644 index 00000000000..8aedbfa8f66 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_test.py @@ -0,0 +1,65 @@ +# 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.map_test import MapTest # noqa: E501 + +class TestMapTest(unittest.TestCase): + """MapTest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> MapTest: + """Test MapTest + 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 `MapTest` + """ + model = MapTest() # noqa: E501 + if include_optional: + return MapTest( + map_map_of_string = { + 'key' : { + 'key' : '' + } + }, + map_of_enum_string = { + 'UPPER' : 'UPPER' + }, + direct_map = { + 'key' : True + }, + indirect_map = { + 'key' : True + } + ) + else: + return MapTest( + ) + """ + + def testMapTest(self): + """Test MapTest""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_mixed_properties_and_additional_properties_class.py new file mode 100644 index 00000000000..12a96998a56 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_mixed_properties_and_additional_properties_class.py @@ -0,0 +1,58 @@ +# 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.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass # noqa: E501 + +class TestMixedPropertiesAndAdditionalPropertiesClass(unittest.TestCase): + """MixedPropertiesAndAdditionalPropertiesClass unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> MixedPropertiesAndAdditionalPropertiesClass: + """Test MixedPropertiesAndAdditionalPropertiesClass + 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 `MixedPropertiesAndAdditionalPropertiesClass` + """ + model = MixedPropertiesAndAdditionalPropertiesClass() # noqa: E501 + if include_optional: + return MixedPropertiesAndAdditionalPropertiesClass( + uuid = '', + date_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + map = { + 'key' : petstore_api.models.animal.Animal( + class_name = '', + color = 'red', ) + } + ) + else: + return MixedPropertiesAndAdditionalPropertiesClass( + ) + """ + + def testMixedPropertiesAndAdditionalPropertiesClass(self): + """Test MixedPropertiesAndAdditionalPropertiesClass""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_model200_response.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_model200_response.py new file mode 100644 index 00000000000..f5e65f1aca4 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_model200_response.py @@ -0,0 +1,53 @@ +# 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.model200_response import Model200Response # noqa: E501 + +class TestModel200Response(unittest.TestCase): + """Model200Response unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Model200Response: + """Test Model200Response + 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 `Model200Response` + """ + model = Model200Response() # noqa: E501 + if include_optional: + return Model200Response( + name = 56, + var_class = '' + ) + else: + return Model200Response( + ) + """ + + def testModel200Response(self): + """Test Model200Response""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_model_return.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_model_return.py new file mode 100644 index 00000000000..e011892fb0b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_model_return.py @@ -0,0 +1,52 @@ +# 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.model_return import ModelReturn # noqa: E501 + +class TestModelReturn(unittest.TestCase): + """ModelReturn unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ModelReturn: + """Test ModelReturn + 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 `ModelReturn` + """ + model = ModelReturn() # noqa: E501 + if include_optional: + return ModelReturn( + var_return = 56 + ) + else: + return ModelReturn( + ) + """ + + def testModelReturn(self): + """Test ModelReturn""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_name.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_name.py new file mode 100644 index 00000000000..be7ddc8461d --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_name.py @@ -0,0 +1,56 @@ +# 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.name import Name # noqa: E501 + +class TestName(unittest.TestCase): + """Name unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Name: + """Test Name + 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 `Name` + """ + model = Name() # noqa: E501 + if include_optional: + return Name( + name = 56, + snake_case = 56, + var_property = '', + var_123_number = 56 + ) + else: + return Name( + name = 56, + ) + """ + + def testName(self): + """Test Name""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_class.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_class.py new file mode 100644 index 00000000000..b1170db23c4 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_class.py @@ -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 + + +import unittest +import datetime + +from petstore_api.models.nullable_class import NullableClass # noqa: E501 + +class TestNullableClass(unittest.TestCase): + """NullableClass unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> NullableClass: + """Test NullableClass + 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 `NullableClass` + """ + model = NullableClass() # noqa: E501 + if include_optional: + return NullableClass( + required_integer_prop = 56, + integer_prop = 56, + number_prop = 1.337, + boolean_prop = True, + string_prop = '', + date_prop = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + datetime_prop = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + array_nullable_prop = [ + None + ], + array_and_items_nullable_prop = [ + None + ], + array_items_nullable = [ + None + ], + object_nullable_prop = { + 'key' : None + }, + object_and_items_nullable_prop = { + 'key' : None + }, + object_items_nullable = { + 'key' : None + } + ) + else: + return NullableClass( + required_integer_prop = 56, + ) + """ + + def testNullableClass(self): + """Test NullableClass""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_property.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_property.py new file mode 100644 index 00000000000..aa34b84e797 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_property.py @@ -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.nullable_property import NullableProperty # noqa: E501 + +class TestNullableProperty(unittest.TestCase): + """NullableProperty unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> NullableProperty: + """Test NullableProperty + 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 `NullableProperty` + """ + model = NullableProperty() # noqa: E501 + if include_optional: + return NullableProperty( + id = 56, + name = 'AUR,rZ#UM/?R,Fp^l6$ARjbhJk C>' + ) + else: + return NullableProperty( + id = 56, + name = 'AUR,rZ#UM/?R,Fp^l6$ARjbhJk C>', + ) + """ + + def testNullableProperty(self): + """Test NullableProperty""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_number_only.py new file mode 100644 index 00000000000..cfc8c5c778c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_number_only.py @@ -0,0 +1,52 @@ +# 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.number_only import NumberOnly # noqa: E501 + +class TestNumberOnly(unittest.TestCase): + """NumberOnly unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> NumberOnly: + """Test NumberOnly + 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 `NumberOnly` + """ + model = NumberOnly() # noqa: E501 + if include_optional: + return NumberOnly( + just_number = 1.337 + ) + else: + return NumberOnly( + ) + """ + + def testNumberOnly(self): + """Test NumberOnly""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_to_test_additional_properties.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_to_test_additional_properties.py new file mode 100644 index 00000000000..d080b21afb3 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_to_test_additional_properties.py @@ -0,0 +1,52 @@ +# 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.object_to_test_additional_properties import ObjectToTestAdditionalProperties # noqa: E501 + +class TestObjectToTestAdditionalProperties(unittest.TestCase): + """ObjectToTestAdditionalProperties unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ObjectToTestAdditionalProperties: + """Test ObjectToTestAdditionalProperties + 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 `ObjectToTestAdditionalProperties` + """ + model = ObjectToTestAdditionalProperties() # noqa: E501 + if include_optional: + return ObjectToTestAdditionalProperties( + var_property = True + ) + else: + return ObjectToTestAdditionalProperties( + ) + """ + + def testObjectToTestAdditionalProperties(self): + """Test ObjectToTestAdditionalProperties""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_with_deprecated_fields.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_with_deprecated_fields.py new file mode 100644 index 00000000000..5f04c63a3cb --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_with_deprecated_fields.py @@ -0,0 +1,58 @@ +# 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.object_with_deprecated_fields import ObjectWithDeprecatedFields # noqa: E501 + +class TestObjectWithDeprecatedFields(unittest.TestCase): + """ObjectWithDeprecatedFields unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ObjectWithDeprecatedFields: + """Test ObjectWithDeprecatedFields + 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 `ObjectWithDeprecatedFields` + """ + model = ObjectWithDeprecatedFields() # noqa: E501 + if include_optional: + return ObjectWithDeprecatedFields( + uuid = '', + id = 1.337, + deprecated_ref = petstore_api.models.deprecated_object.DeprecatedObject( + name = '', ), + bars = [ + 'bar' + ] + ) + else: + return ObjectWithDeprecatedFields( + ) + """ + + def testObjectWithDeprecatedFields(self): + """Test ObjectWithDeprecatedFields""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_one_of_enum_string.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_one_of_enum_string.py new file mode 100644 index 00000000000..3db614a16ca --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_one_of_enum_string.py @@ -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 +import datetime + +from petstore_api.models.one_of_enum_string import OneOfEnumString # noqa: E501 + +class TestOneOfEnumString(unittest.TestCase): + """OneOfEnumString unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> OneOfEnumString: + """Test OneOfEnumString + 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 `OneOfEnumString` + """ + model = OneOfEnumString() # noqa: E501 + if include_optional: + return OneOfEnumString( + ) + else: + return OneOfEnumString( + ) + """ + + def testOneOfEnumString(self): + """Test OneOfEnumString""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_order.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_order.py new file mode 100644 index 00000000000..3334ed8f949 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_order.py @@ -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.order import Order # noqa: E501 + +class TestOrder(unittest.TestCase): + """Order unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Order: + """Test Order + 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 `Order` + """ + model = Order() # noqa: E501 + if include_optional: + return Order( + id = 56, + pet_id = 56, + quantity = 56, + ship_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + status = 'placed', + complete = True + ) + else: + return Order( + ) + """ + + def testOrder(self): + """Test Order""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_composite.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_composite.py new file mode 100644 index 00000000000..7df32d8c672 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_composite.py @@ -0,0 +1,54 @@ +# 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.outer_composite import OuterComposite # noqa: E501 + +class TestOuterComposite(unittest.TestCase): + """OuterComposite unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> OuterComposite: + """Test OuterComposite + 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 `OuterComposite` + """ + model = OuterComposite() # noqa: E501 + if include_optional: + return OuterComposite( + my_number = 1.337, + my_string = '', + my_boolean = True + ) + else: + return OuterComposite( + ) + """ + + def testOuterComposite(self): + """Test OuterComposite""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum.py new file mode 100644 index 00000000000..5da04a9a45c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum.py @@ -0,0 +1,34 @@ +# 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.outer_enum import OuterEnum # noqa: E501 + +class TestOuterEnum(unittest.TestCase): + """OuterEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOuterEnum(self): + """Test OuterEnum""" + # inst = OuterEnum() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_default_value.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_default_value.py new file mode 100644 index 00000000000..df6499565fd --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_default_value.py @@ -0,0 +1,34 @@ +# 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.outer_enum_default_value import OuterEnumDefaultValue # noqa: E501 + +class TestOuterEnumDefaultValue(unittest.TestCase): + """OuterEnumDefaultValue unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOuterEnumDefaultValue(self): + """Test OuterEnumDefaultValue""" + # inst = OuterEnumDefaultValue() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer.py new file mode 100644 index 00000000000..7b89b806ba2 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer.py @@ -0,0 +1,34 @@ +# 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.outer_enum_integer import OuterEnumInteger # noqa: E501 + +class TestOuterEnumInteger(unittest.TestCase): + """OuterEnumInteger unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOuterEnumInteger(self): + """Test OuterEnumInteger""" + # inst = OuterEnumInteger() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer_default_value.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer_default_value.py new file mode 100644 index 00000000000..532616fdee1 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer_default_value.py @@ -0,0 +1,34 @@ +# 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.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue # noqa: E501 + +class TestOuterEnumIntegerDefaultValue(unittest.TestCase): + """OuterEnumIntegerDefaultValue unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOuterEnumIntegerDefaultValue(self): + """Test OuterEnumIntegerDefaultValue""" + # inst = OuterEnumIntegerDefaultValue() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_object_with_enum_property.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_object_with_enum_property.py new file mode 100644 index 00000000000..27e518b0059 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_object_with_enum_property.py @@ -0,0 +1,54 @@ +# 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.outer_object_with_enum_property import OuterObjectWithEnumProperty # noqa: E501 + +class TestOuterObjectWithEnumProperty(unittest.TestCase): + """OuterObjectWithEnumProperty unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> OuterObjectWithEnumProperty: + """Test OuterObjectWithEnumProperty + 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 `OuterObjectWithEnumProperty` + """ + model = OuterObjectWithEnumProperty() # noqa: E501 + if include_optional: + return OuterObjectWithEnumProperty( + str_value = 'placed', + value = 2 + ) + else: + return OuterObjectWithEnumProperty( + value = 2, + ) + """ + + def testOuterObjectWithEnumProperty(self): + """Test OuterObjectWithEnumProperty""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent.py new file mode 100644 index 00000000000..ea206970c9c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent.py @@ -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.parent import Parent # noqa: E501 + +class TestParent(unittest.TestCase): + """Parent unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Parent: + """Test Parent + 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 `Parent` + """ + model = Parent() # noqa: E501 + if include_optional: + return Parent( + optional_dict = { + 'key' : petstore_api.models.inner_dict_with_property.InnerDictWithProperty( + a_property = petstore_api.models.a_property.aProperty(), ) + } + ) + else: + return Parent( + ) + """ + + def testParent(self): + """Test Parent""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent_with_optional_dict.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent_with_optional_dict.py new file mode 100644 index 00000000000..2c668a7047a --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent_with_optional_dict.py @@ -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.parent_with_optional_dict import ParentWithOptionalDict # noqa: E501 + +class TestParentWithOptionalDict(unittest.TestCase): + """ParentWithOptionalDict unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ParentWithOptionalDict: + """Test ParentWithOptionalDict + 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 `ParentWithOptionalDict` + """ + model = ParentWithOptionalDict() # noqa: E501 + if include_optional: + return ParentWithOptionalDict( + optional_dict = { + 'key' : petstore_api.models.inner_dict_with_property.InnerDictWithProperty( + a_property = petstore_api.models.a_property.aProperty(), ) + } + ) + else: + return ParentWithOptionalDict( + ) + """ + + def testParentWithOptionalDict(self): + """Test ParentWithOptionalDict""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet.py new file mode 100644 index 00000000000..f89e6cdf4b4 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet.py @@ -0,0 +1,69 @@ +# 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.pet import Pet # noqa: E501 + +class TestPet(unittest.TestCase): + """Pet unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Pet: + """Test Pet + 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 `Pet` + """ + model = Pet() # noqa: E501 + if include_optional: + return Pet( + id = 56, + category = petstore_api.models.category.Category( + id = 56, + name = 'default-name', ), + name = 'doggie', + photo_urls = [ + '' + ], + tags = [ + petstore_api.models.tag.Tag( + id = 56, + name = '', ) + ], + status = 'available' + ) + else: + return Pet( + name = 'doggie', + photo_urls = [ + '' + ], + ) + """ + + def testPet(self): + """Test Pet""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet_api.py new file mode 100644 index 00000000000..2352eb7ab40 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet_api.py @@ -0,0 +1,94 @@ +# 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.api.pet_api import PetApi # noqa: E501 + + +class TestPetApi(unittest.TestCase): + """PetApi unit test stubs""" + + def setUp(self) -> None: + self.api = PetApi() # noqa: E501 + + def tearDown(self) -> None: + pass + + def test_add_pet(self) -> None: + """Test case for add_pet + + Add a new pet to the store # noqa: E501 + """ + pass + + def test_delete_pet(self) -> None: + """Test case for delete_pet + + Deletes a pet # noqa: E501 + """ + pass + + def test_find_pets_by_status(self) -> None: + """Test case for find_pets_by_status + + Finds Pets by status # noqa: E501 + """ + pass + + def test_find_pets_by_tags(self) -> None: + """Test case for find_pets_by_tags + + Finds Pets by tags # noqa: E501 + """ + pass + + def test_get_pet_by_id(self) -> None: + """Test case for get_pet_by_id + + Find pet by ID # noqa: E501 + """ + pass + + def test_update_pet(self) -> None: + """Test case for update_pet + + Update an existing pet # noqa: E501 + """ + pass + + def test_update_pet_with_form(self) -> None: + """Test case for update_pet_with_form + + Updates a pet in the store with form data # noqa: E501 + """ + pass + + def test_upload_file(self) -> None: + """Test case for upload_file + + uploads an image # noqa: E501 + """ + pass + + def test_upload_file_with_required_file(self) -> None: + """Test case for upload_file_with_required_file + + uploads an image (required) # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pig.py new file mode 100644 index 00000000000..cd3f112aabc --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pig.py @@ -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.pig import Pig # noqa: E501 + +class TestPig(unittest.TestCase): + """Pig unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Pig: + """Test Pig + 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 `Pig` + """ + model = Pig() # noqa: E501 + if include_optional: + return Pig( + class_name = '', + color = '', + size = 56 + ) + else: + return Pig( + class_name = '', + color = '', + size = 56, + ) + """ + + def testPig(self): + """Test Pig""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_property_name_collision.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_property_name_collision.py new file mode 100644 index 00000000000..a869945b320 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_property_name_collision.py @@ -0,0 +1,54 @@ +# 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.property_name_collision import PropertyNameCollision # noqa: E501 + +class TestPropertyNameCollision(unittest.TestCase): + """PropertyNameCollision unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PropertyNameCollision: + """Test PropertyNameCollision + 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 `PropertyNameCollision` + """ + model = PropertyNameCollision() # noqa: E501 + if include_optional: + return PropertyNameCollision( + underscore_type = '', + type = '', + type_with_underscore = '' + ) + else: + return PropertyNameCollision( + ) + """ + + def testPropertyNameCollision(self): + """Test PropertyNameCollision""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_read_only_first.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_read_only_first.py new file mode 100644 index 00000000000..1026a73205d --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_read_only_first.py @@ -0,0 +1,53 @@ +# 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.read_only_first import ReadOnlyFirst # noqa: E501 + +class TestReadOnlyFirst(unittest.TestCase): + """ReadOnlyFirst unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ReadOnlyFirst: + """Test ReadOnlyFirst + 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 `ReadOnlyFirst` + """ + model = ReadOnlyFirst() # noqa: E501 + if include_optional: + return ReadOnlyFirst( + bar = '', + baz = '' + ) + else: + return ReadOnlyFirst( + ) + """ + + def testReadOnlyFirst(self): + """Test ReadOnlyFirst""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_second_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_second_ref.py new file mode 100644 index 00000000000..44194f94544 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_second_ref.py @@ -0,0 +1,58 @@ +# 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.second_ref import SecondRef # noqa: E501 + +class TestSecondRef(unittest.TestCase): + """SecondRef unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> SecondRef: + """Test SecondRef + 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 `SecondRef` + """ + model = SecondRef() # noqa: E501 + if include_optional: + return SecondRef( + category = '', + circular_ref = petstore_api.models.circular_reference_model.Circular-Reference-Model( + size = 56, + nested = petstore_api.models.first_ref.FirstRef( + category = '', + self_ref = petstore_api.models.second_ref.SecondRef( + category = '', ), ), ) + ) + else: + return SecondRef( + ) + """ + + def testSecondRef(self): + """Test SecondRef""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_self_reference_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_self_reference_model.py new file mode 100644 index 00000000000..8c23008b26e --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_self_reference_model.py @@ -0,0 +1,58 @@ +# 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.self_reference_model import SelfReferenceModel # noqa: E501 + +class TestSelfReferenceModel(unittest.TestCase): + """SelfReferenceModel unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> SelfReferenceModel: + """Test SelfReferenceModel + 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 `SelfReferenceModel` + """ + model = SelfReferenceModel() # noqa: E501 + if include_optional: + return SelfReferenceModel( + size = 56, + nested = petstore_api.models.dummy_model.Dummy-Model( + category = '', + self_ref = petstore_api.models.self_reference_model.Self-Reference-Model( + size = 56, + nested = petstore_api.models.dummy_model.Dummy-Model( + category = '', ), ), ) + ) + else: + return SelfReferenceModel( + ) + """ + + def testSelfReferenceModel(self): + """Test SelfReferenceModel""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_single_ref_type.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_single_ref_type.py new file mode 100644 index 00000000000..f5642b8376b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_single_ref_type.py @@ -0,0 +1,34 @@ +# 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.single_ref_type import SingleRefType # noqa: E501 + +class TestSingleRefType(unittest.TestCase): + """SingleRefType unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testSingleRefType(self): + """Test SingleRefType""" + # inst = SingleRefType() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_character_enum.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_character_enum.py new file mode 100644 index 00000000000..ee5baab1309 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_character_enum.py @@ -0,0 +1,34 @@ +# 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.special_character_enum import SpecialCharacterEnum # noqa: E501 + +class TestSpecialCharacterEnum(unittest.TestCase): + """SpecialCharacterEnum unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testSpecialCharacterEnum(self): + """Test SpecialCharacterEnum""" + # inst = SpecialCharacterEnum() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_model_name.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_model_name.py new file mode 100644 index 00000000000..12ec90a9067 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_model_name.py @@ -0,0 +1,52 @@ +# 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.special_model_name import SpecialModelName # noqa: E501 + +class TestSpecialModelName(unittest.TestCase): + """SpecialModelName unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> SpecialModelName: + """Test SpecialModelName + 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 `SpecialModelName` + """ + model = SpecialModelName() # noqa: E501 + if include_optional: + return SpecialModelName( + special_property_name = 56 + ) + else: + return SpecialModelName( + ) + """ + + def testSpecialModelName(self): + """Test SpecialModelName""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_name.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_name.py new file mode 100644 index 00000000000..afaf0996b74 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_name.py @@ -0,0 +1,56 @@ +# 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.special_name import SpecialName # noqa: E501 + +class TestSpecialName(unittest.TestCase): + """SpecialName unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> SpecialName: + """Test SpecialName + 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 `SpecialName` + """ + model = SpecialName() # noqa: E501 + if include_optional: + return SpecialName( + var_property = 56, + var_async = petstore_api.models.category.Category( + id = 56, + name = 'default-name', ), + var_schema = 'available' + ) + else: + return SpecialName( + ) + """ + + def testSpecialName(self): + """Test SpecialName""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_store_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_store_api.py new file mode 100644 index 00000000000..c25309ee006 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_store_api.py @@ -0,0 +1,59 @@ +# 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.api.store_api import StoreApi # noqa: E501 + + +class TestStoreApi(unittest.TestCase): + """StoreApi unit test stubs""" + + def setUp(self) -> None: + self.api = StoreApi() # noqa: E501 + + def tearDown(self) -> None: + pass + + def test_delete_order(self) -> None: + """Test case for delete_order + + Delete purchase order by ID # noqa: E501 + """ + pass + + def test_get_inventory(self) -> None: + """Test case for get_inventory + + Returns pet inventories by status # noqa: E501 + """ + pass + + def test_get_order_by_id(self) -> None: + """Test case for get_order_by_id + + Find purchase order by ID # noqa: E501 + """ + pass + + def test_place_order(self) -> None: + """Test case for place_order + + Place an order for a pet # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_tag.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_tag.py new file mode 100644 index 00000000000..d5ce3fb8a0c --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_tag.py @@ -0,0 +1,53 @@ +# 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.tag import Tag # noqa: E501 + +class TestTag(unittest.TestCase): + """Tag unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Tag: + """Test Tag + 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 `Tag` + """ + model = Tag() # noqa: E501 + if include_optional: + return Tag( + id = 56, + name = '' + ) + else: + return Tag( + ) + """ + + def testTag(self): + """Test Tag""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_test_inline_freeform_additional_properties_request.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_test_inline_freeform_additional_properties_request.py new file mode 100644 index 00000000000..5c40397bc91 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_test_inline_freeform_additional_properties_request.py @@ -0,0 +1,52 @@ +# 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.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest # noqa: E501 + +class TestTestInlineFreeformAdditionalPropertiesRequest(unittest.TestCase): + """TestInlineFreeformAdditionalPropertiesRequest unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> TestInlineFreeformAdditionalPropertiesRequest: + """Test TestInlineFreeformAdditionalPropertiesRequest + 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 `TestInlineFreeformAdditionalPropertiesRequest` + """ + model = TestInlineFreeformAdditionalPropertiesRequest() # noqa: E501 + if include_optional: + return TestInlineFreeformAdditionalPropertiesRequest( + some_property = '' + ) + else: + return TestInlineFreeformAdditionalPropertiesRequest( + ) + """ + + def testTestInlineFreeformAdditionalPropertiesRequest(self): + """Test TestInlineFreeformAdditionalPropertiesRequest""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_tiger.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_tiger.py new file mode 100644 index 00000000000..7aab61a4606 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_tiger.py @@ -0,0 +1,52 @@ +# 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.tiger import Tiger # noqa: E501 + +class TestTiger(unittest.TestCase): + """Tiger unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Tiger: + """Test Tiger + 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 `Tiger` + """ + model = Tiger() # noqa: E501 + if include_optional: + return Tiger( + skill = '' + ) + else: + return Tiger( + ) + """ + + def testTiger(self): + """Test Tiger""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_user.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_user.py new file mode 100644 index 00000000000..a1ce46e87a1 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_user.py @@ -0,0 +1,59 @@ +# 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.user import User # noqa: E501 + +class TestUser(unittest.TestCase): + """User unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> User: + """Test User + 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 `User` + """ + model = User() # noqa: E501 + if include_optional: + return User( + id = 56, + username = '', + first_name = '', + last_name = '', + email = '', + password = '', + phone = '', + user_status = 56 + ) + else: + return User( + ) + """ + + def testUser(self): + """Test User""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_user_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_user_api.py new file mode 100644 index 00000000000..28103bb27ea --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_user_api.py @@ -0,0 +1,87 @@ +# 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.api.user_api import UserApi # noqa: E501 + + +class TestUserApi(unittest.TestCase): + """UserApi unit test stubs""" + + def setUp(self) -> None: + self.api = UserApi() # noqa: E501 + + def tearDown(self) -> None: + pass + + def test_create_user(self) -> None: + """Test case for create_user + + Create user # noqa: E501 + """ + pass + + def test_create_users_with_array_input(self) -> None: + """Test case for create_users_with_array_input + + Creates list of users with given input array # noqa: E501 + """ + pass + + def test_create_users_with_list_input(self) -> None: + """Test case for create_users_with_list_input + + Creates list of users with given input array # noqa: E501 + """ + pass + + def test_delete_user(self) -> None: + """Test case for delete_user + + Delete user # noqa: E501 + """ + pass + + def test_get_user_by_name(self) -> None: + """Test case for get_user_by_name + + Get user by user name # noqa: E501 + """ + pass + + def test_login_user(self) -> None: + """Test case for login_user + + Logs user into the system # noqa: E501 + """ + pass + + def test_logout_user(self) -> None: + """Test case for logout_user + + Logs out current logged in user session # noqa: E501 + """ + pass + + def test_update_user(self) -> None: + """Test case for update_user + + Updated user # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_with_nested_one_of.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_with_nested_one_of.py new file mode 100644 index 00000000000..43c4a69a29b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_with_nested_one_of.py @@ -0,0 +1,54 @@ +# 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.with_nested_one_of import WithNestedOneOf # noqa: E501 + +class TestWithNestedOneOf(unittest.TestCase): + """WithNestedOneOf unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> WithNestedOneOf: + """Test WithNestedOneOf + 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 `WithNestedOneOf` + """ + model = WithNestedOneOf() # noqa: E501 + if include_optional: + return WithNestedOneOf( + size = 56, + nested_pig = None, + nested_oneof_enum_string = None + ) + else: + return WithNestedOneOf( + ) + """ + + def testWithNestedOneOf(self): + """Test WithNestedOneOf""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/tox.ini b/samples/openapi3/client/petstore/python-pydantic-v1/tox.ini new file mode 100644 index 00000000000..8989fc3c4d9 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/tox.ini @@ -0,0 +1,9 @@ +[tox] +envlist = py3 + +[testenv] +deps=-r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + +commands= + pytest --cov=petstore_api