From 9fc33f6a73b6eeef39d896d7b10d2ce6c917cfdd Mon Sep 17 00:00:00 2001 From: agilob Date: Thu, 25 Feb 2021 09:11:16 +0000 Subject: [PATCH] [Dart] Add configuration to add new generators and add json_serializable (#8789) * Add Dart configuration flag to set new generator * Change templates to add json_serializable generator * Fix dart tests * Add custom serialization for standard generator * this change opens us a way to allow adding more than 2 generators * Add sample project for json_serializer * Use basename for json field name * Update samples with basename as json key * Update dart generator docs * Create AbstractDartCodegen class * Update docs, dart-dio and dart-jaguar dont get json_serializable yet * Deduplicate method calls * Dix dart-dio generation * Revert formatting change in dart mustache * Fix formatting changes again * Improve dart serialization documentation specify default serializer * Better name for cli option * Rename default dart generator to 'native' * Another attempt to reduce whitespace noise * Fix api-client and api-helper * Rename default serialization mode to include word serialization * Remove trailing whitespace in enums --- ...ore-json-serializable-client-lib-fake.yaml | 7 + docs/generators/dart.md | 1 + .../languages/AbstractDartCodegen.java | 686 ++++++++ .../codegen/languages/DartClientCodegen.java | 709 +-------- .../languages/DartDioClientCodegen.java | 44 +- .../languages/DartJaguarClientCodegen.java | 37 +- .../main/resources/dart2/api_client.mustache | 3 +- .../main/resources/dart2/api_helper.mustache | 3 +- .../src/main/resources/dart2/apilib.mustache | 8 + .../main/resources/dart2/build.yaml.mustache | 19 + .../src/main/resources/dart2/class.mustache | 53 +- .../src/main/resources/dart2/enum.mustache | 11 +- .../main/resources/dart2/enum_inline.mustache | 10 +- .../src/main/resources/dart2/pubspec.mustache | 5 + .../options/DartClientOptionsProvider.java | 1 + .../dart2/petstore_client_lib/lib/api.dart | 2 + .../dart2/petstore_client_lib/pubspec.yaml | 2 + .../dart2/petstore_client_lib/lib/api.dart | 2 + .../dart2/petstore_client_lib/pubspec.yaml | 2 + .../petstore_client_lib_fake/lib/api.dart | 2 + .../lib/api_client.dart | 5 + .../lib/api_helper.dart | 5 + .../petstore_client_lib_fake/pubspec.yaml | 2 + .../.gitignore | 27 + .../.openapi-generator-ignore | 23 + .../.openapi-generator/FILES | 115 ++ .../.openapi-generator/VERSION | 1 + .../.travis.yml | 14 + .../README.md | 189 +++ .../build.yaml | 19 + .../doc/AdditionalPropertiesClass.md | 16 + .../doc/Animal.md | 16 + .../doc/AnotherFakeApi.md | 57 + .../doc/ApiResponse.md | 17 + .../doc/ArrayOfArrayOfNumberOnly.md | 15 + .../doc/ArrayOfNumberOnly.md | 15 + .../doc/ArrayTest.md | 17 + .../doc/Capitalization.md | 20 + .../doc/Cat.md | 17 + .../doc/CatAllOf.md | 15 + .../doc/Category.md | 16 + .../doc/ClassModel.md | 15 + .../doc/DefaultApi.md | 51 + .../doc/Dog.md | 17 + .../doc/DogAllOf.md | 15 + .../doc/EnumArrays.md | 16 + .../doc/EnumClass.md | 14 + .../doc/EnumTest.md | 22 + .../doc/FakeApi.md | 725 +++++++++ .../doc/FakeClassnameTags123Api.md | 61 + .../doc/FileSchemaTestClass.md | 16 + .../doc/Foo.md | 15 + .../doc/FormatTest.md | 30 + .../doc/HasOnlyReadOnly.md | 16 + .../doc/HealthCheckResult.md | 15 + .../doc/InlineResponseDefault.md | 15 + .../doc/MapTest.md | 18 + ...dPropertiesAndAdditionalPropertiesClass.md | 17 + .../doc/Model200Response.md | 16 + .../doc/ModelClient.md | 15 + .../doc/ModelFile.md | 15 + .../doc/ModelList.md | 15 + .../doc/ModelReturn.md | 15 + .../doc/Name.md | 18 + .../doc/NullableClass.md | 26 + .../doc/NumberOnly.md | 15 + .../doc/Order.md | 20 + .../doc/OuterComposite.md | 17 + .../doc/OuterEnum.md | 14 + .../doc/OuterEnumDefaultValue.md | 14 + .../doc/OuterEnumInteger.md | 14 + .../doc/OuterEnumIntegerDefaultValue.md | 14 + .../doc/Pet.md | 20 + .../doc/PetApi.md | 427 +++++ .../doc/ReadOnlyFirst.md | 16 + .../doc/SpecialModelName.md | 15 + .../doc/StoreApi.md | 186 +++ .../doc/Tag.md | 16 + .../doc/User.md | 22 + .../doc/UserApi.md | 349 +++++ .../git_push.sh | 58 + .../lib/api.dart | 92 ++ .../lib/api/another_fake_api.dart | 91 ++ .../lib/api/default_api.dart | 69 + .../lib/api/fake_api.dart | 1374 +++++++++++++++++ .../lib/api/fake_classname_tags123_api.dart | 91 ++ .../lib/api/pet_api.dart | 729 +++++++++ .../lib/api/store_api.dart | 289 ++++ .../lib/api/user_api.dart | 556 +++++++ .../lib/api_client.dart | 309 ++++ .../lib/api_exception.dart | 31 + .../lib/api_helper.dart | 91 ++ .../lib/auth/api_key_auth.dart | 35 + .../lib/auth/authentication.dart | 15 + .../lib/auth/http_basic_auth.dart | 21 + .../lib/auth/http_bearer_auth.dart | 38 + .../lib/auth/oauth.dart | 23 + .../model/additional_properties_class.dart | 60 + .../lib/model/animal.dart | 60 + .../lib/model/api_response.dart | 70 + .../model/array_of_array_of_number_only.dart | 50 + .../lib/model/array_of_number_only.dart | 50 + .../lib/model/array_test.dart | 70 + .../lib/model/capitalization.dart | 101 ++ .../lib/model/cat.dart | 70 + .../lib/model/cat_all_of.dart | 50 + .../lib/model/category.dart | 60 + .../lib/model/class_model.dart | 50 + .../lib/model/dog.dart | 70 + .../lib/model/dog_all_of.dart | 50 + .../lib/model/enum_arrays.dart | 74 + .../lib/model/enum_class.dart | 19 + .../lib/model/enum_test.dart | 150 ++ .../lib/model/file_schema_test_class.dart | 60 + .../lib/model/foo.dart | 50 + .../lib/model/format_test.dart | 208 +++ .../lib/model/has_only_read_only.dart | 60 + .../lib/model/health_check_result.dart | 50 + .../lib/model/inline_response_default.dart | 50 + .../lib/model/map_test.dart | 87 ++ ...rties_and_additional_properties_class.dart | 70 + .../lib/model/model200_response.dart | 60 + .../lib/model/model_client.dart | 50 + .../lib/model/model_file.dart | 51 + .../lib/model/model_list.dart | 50 + .../lib/model/model_return.dart | 50 + .../lib/model/name.dart | 80 + .../lib/model/nullable_class.dart | 160 ++ .../lib/model/number_only.dart | 50 + .../lib/model/order.dart | 109 ++ .../lib/model/outer_composite.dart | 70 + .../lib/model/outer_enum.dart | 19 + .../lib/model/outer_enum_default_value.dart | 19 + .../lib/model/outer_enum_integer.dart | 19 + .../outer_enum_integer_default_value.dart | 19 + .../lib/model/pet.dart | 109 ++ .../lib/model/read_only_first.dart | 60 + .../lib/model/special_model_name.dart | 50 + .../lib/model/tag.dart | 60 + .../lib/model/user.dart | 121 ++ .../pubspec.yaml | 21 + .../additional_properties_class_test.dart | 22 + .../test/animal_test.dart | 22 + .../test/another_fake_api_test.dart | 29 + .../test/api_response_test.dart | 27 + .../array_of_array_of_number_only_test.dart | 17 + .../test/array_of_number_only_test.dart | 17 + .../test/array_test_test.dart | 27 + .../test/capitalization_test.dart | 43 + .../test/cat_all_of_test.dart | 17 + .../test/cat_test.dart | 27 + .../test/category_test.dart | 22 + .../test/class_model_test.dart | 17 + .../test/default_api_test.dart | 25 + .../test/dog_all_of_test.dart | 17 + .../test/dog_test.dart | 27 + .../test/enum_arrays_test.dart | 22 + .../test/enum_class_test.dart | 11 + .../test/enum_test_test.dart | 52 + .../test/fake_api_test.dart | 131 ++ .../test/fake_classname_tags123_api_test.dart | 29 + .../test/file_schema_test_class_test.dart | 22 + .../test/foo_test.dart | 17 + .../test/format_test_test.dart | 94 ++ .../test/has_only_read_only_test.dart | 22 + .../test/health_check_result_test.dart | 17 + .../test/inline_response_default_test.dart | 17 + .../test/map_test_test.dart | 32 + ..._and_additional_properties_class_test.dart | 27 + .../test/model200_response_test.dart | 22 + .../test/model_client_test.dart | 17 + .../test/model_file_test.dart | 18 + .../test/model_list_test.dart | 17 + .../test/model_return_test.dart | 17 + .../test/name_test.dart | 32 + .../test/nullable_class_test.dart | 72 + .../test/number_only_test.dart | 17 + .../test/order_test.dart | 43 + .../test/outer_composite_test.dart | 27 + .../test/outer_enum_default_value_test.dart | 11 + ...outer_enum_integer_default_value_test.dart | 11 + .../test/outer_enum_integer_test.dart | 11 + .../test/outer_enum_test.dart | 11 + .../test/pet_api_test.dart | 89 ++ .../test/pet_test.dart | 43 + .../test/read_only_first_test.dart | 22 + .../test/special_model_name_test.dart | 17 + .../test/store_api_test.dart | 54 + .../test/tag_test.dart | 22 + .../test/user_api_test.dart | 82 + .../test/user_test.dart | 53 + 191 files changed, 12222 insertions(+), 748 deletions(-) create mode 100644 bin/configs/dart-petstore-json-serializable-client-lib-fake.yaml create mode 100644 modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java create mode 100644 modules/openapi-generator/src/main/resources/dart2/build.yaml.mustache create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.gitignore create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator-ignore create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator/FILES create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator/VERSION create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.travis.yml create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/README.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/build.yaml create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/AdditionalPropertiesClass.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Animal.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/AnotherFakeApi.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ApiResponse.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ArrayOfNumberOnly.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ArrayTest.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Capitalization.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Cat.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/CatAllOf.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Category.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ClassModel.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/DefaultApi.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Dog.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/DogAllOf.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/EnumArrays.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/EnumClass.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/EnumTest.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeApi.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeClassnameTags123Api.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FileSchemaTestClass.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Foo.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FormatTest.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/HasOnlyReadOnly.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/HealthCheckResult.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/InlineResponseDefault.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/MapTest.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/MixedPropertiesAndAdditionalPropertiesClass.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Model200Response.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelClient.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelFile.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelList.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelReturn.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Name.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/NullableClass.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/NumberOnly.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Order.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterComposite.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnum.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnumDefaultValue.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnumInteger.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnumIntegerDefaultValue.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Pet.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/PetApi.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ReadOnlyFirst.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/SpecialModelName.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/StoreApi.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Tag.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/User.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/UserApi.md create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/git_push.sh create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/another_fake_api.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/default_api.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_api.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_classname_tags123_api.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/pet_api.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/store_api.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/user_api.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_client.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_exception.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_helper.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/api_key_auth.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/authentication.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_basic_auth.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_bearer_auth.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/oauth.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/additional_properties_class.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/animal.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/api_response.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_array_of_number_only.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_number_only.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/capitalization.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat_all_of.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/category.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/class_model.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog_all_of.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_arrays.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_class.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/file_schema_test_class.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/foo.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/format_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/has_only_read_only.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/health_check_result.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/inline_response_default.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/map_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model200_response.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_client.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_file.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_list.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_return.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/name.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/nullable_class.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/number_only.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/order.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_composite.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_default_value.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer_default_value.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/pet.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/read_only_first.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/special_model_name.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/tag.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/user.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/pubspec.yaml create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/additional_properties_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/animal_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/another_fake_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/api_response_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_of_array_of_number_only_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_of_number_only_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_test_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/capitalization_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/cat_all_of_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/cat_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/category_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/class_model_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/default_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/dog_all_of_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/dog_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_arrays_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_test_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/fake_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/fake_classname_tags123_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/file_schema_test_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/foo_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/format_test_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/has_only_read_only_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/health_check_result_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/inline_response_default_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/map_test_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model200_response_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_client_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_file_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_list_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_return_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/name_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/nullable_class_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/number_only_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/order_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_composite_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_default_value_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_integer_default_value_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_integer_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/pet_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/pet_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/read_only_first_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/special_model_name_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/store_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/tag_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/user_api_test.dart create mode 100644 samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/user_test.dart diff --git a/bin/configs/dart-petstore-json-serializable-client-lib-fake.yaml b/bin/configs/dart-petstore-json-serializable-client-lib-fake.yaml new file mode 100644 index 00000000000..cb943d3d957 --- /dev/null +++ b/bin/configs/dart-petstore-json-serializable-client-lib-fake.yaml @@ -0,0 +1,7 @@ +generatorName: dart +outputDir: samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake +inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml +templateDir: modules/openapi-generator/src/main/resources/dart2 +additionalProperties: + hideGenerationTimestamp: "true" + serializationLibrary: json_serializable diff --git a/docs/generators/dart.md b/docs/generators/dart.md index e7dae224efc..115126907ea 100644 --- a/docs/generators/dart.md +++ b/docs/generators/dart.md @@ -19,6 +19,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |pubLibrary|Library name in generated code| |null| |pubName|Name in generated pubspec| |null| |pubVersion|Version in generated pubspec| |null| +|serializationLibrary|Specify serialization library|
**native_serialization**
Use native serializer, backwards compatible
**json_serializable**
Use json_serializable
|native_serialization| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| |sourceFolder|Source folder for generated code| |null| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java new file mode 100644 index 00000000000..0322228f975 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractDartCodegen.java @@ -0,0 +1,686 @@ +package org.openapitools.codegen.languages; + +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.media.ArraySchema; +import io.swagger.v3.oas.models.media.Schema; +import io.swagger.v3.oas.models.media.StringSchema; +import io.swagger.v3.oas.models.servers.Server; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang3.StringUtils; +import org.openapitools.codegen.*; +import org.openapitools.codegen.meta.features.*; +import org.openapitools.codegen.utils.ModelUtils; + +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import java.util.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static org.openapitools.codegen.utils.StringUtils.*; +import static org.openapitools.codegen.utils.StringUtils.camelize; + +public abstract class AbstractDartCodegen extends DefaultCodegen { + + private static final Logger LOGGER = LoggerFactory.getLogger(AbstractDartCodegen.class); + + public static final String PUB_LIBRARY = "pubLibrary"; + public static final String PUB_NAME = "pubName"; + public static final String PUB_VERSION = "pubVersion"; + public static final String PUB_DESCRIPTION = "pubDescription"; + public static final String PUB_AUTHOR = "pubAuthor"; + public static final String PUB_AUTHOR_EMAIL = "pubAuthorEmail"; + public static final String PUB_HOMEPAGE = "pubHomepage"; + public static final String USE_ENUM_EXTENSION = "useEnumExtension"; + + protected String pubLibrary = "openapi.api"; + protected String pubName = "openapi"; + protected String pubVersion = "1.0.0"; + protected String pubDescription = "OpenAPI API client"; + protected String pubAuthor = "Author"; + protected String pubAuthorEmail = "author@homepage"; + protected String pubHomepage = "homepage"; + protected boolean useEnumExtension = false; + protected String sourceFolder = ""; + protected String apiDocPath = "doc" + File.separator; + protected String modelDocPath = "doc" + File.separator; + protected String apiTestPath = "test" + File.separator; + protected String modelTestPath = "test" + File.separator; + + // Names that must not be used as model names because they clash with existing + // default imports (dart:io, dart:async, package:http etc.) but are not basic dataTypes. + protected Set additionalReservedWords; + + public AbstractDartCodegen() { + super(); + + modifyFeatureSet(features -> features + .includeDocumentationFeatures(DocumentationFeature.Readme) + .securityFeatures(EnumSet.of( + SecurityFeature.OAuth2_Implicit, + SecurityFeature.BasicAuth, + SecurityFeature.ApiKey + )) + .excludeGlobalFeatures( + GlobalFeature.XMLStructureDefinitions, + GlobalFeature.Callbacks, + GlobalFeature.LinkObjects, + GlobalFeature.ParameterStyling + ) + .excludeSchemaSupportFeatures( + SchemaSupportFeature.Polymorphism + ) + .includeParameterFeatures( + ParameterFeature.Cookie + ) + .includeClientModificationFeatures( + ClientModificationFeature.BasePath + ) + ); + + outputFolder = "generated-code/dart"; + modelTemplateFiles.put("model.mustache", ".dart"); + apiTemplateFiles.put("api.mustache", ".dart"); + embeddedTemplateDir = templateDir = "dart2"; + apiPackage = "lib.api"; + modelPackage = "lib.model"; + modelDocTemplateFiles.put("object_doc.mustache", ".md"); + apiDocTemplateFiles.put("api_doc.mustache", ".md"); + + modelTestTemplateFiles.put("model_test.mustache", ".dart"); + apiTestTemplateFiles.put("api_test.mustache", ".dart"); + + final List reservedWordsList = new ArrayList<>(); + try(BufferedReader reader = new BufferedReader( + new InputStreamReader(DartClientCodegen.class.getResourceAsStream("/dart/dart-keywords.txt"), + StandardCharsets.UTF_8))) { + while (reader.ready()) { + reservedWordsList.add(reader.readLine()); + } + } catch (Exception e) { + LOGGER.error("Error reading dart keywords. Exception: {}", e.getMessage()); + } + setReservedWordsLowerCase(reservedWordsList); + + languageSpecificPrimitives = Sets.newHashSet( + "String", + "bool", + "int", + "num", + "double", + "dynamic" + ); + + typeMapping = new HashMap<>(); + typeMapping.put("Array", "List"); + typeMapping.put("array", "List"); + typeMapping.put("map", "Map"); + typeMapping.put("List", "List"); + typeMapping.put("set", "Set"); + typeMapping.put("boolean", "bool"); + typeMapping.put("string", "String"); + typeMapping.put("char", "String"); + typeMapping.put("int", "int"); + typeMapping.put("long", "int"); + typeMapping.put("short", "int"); + typeMapping.put("number", "num"); + typeMapping.put("float", "double"); + typeMapping.put("double", "double"); + typeMapping.put("decimal", "double"); + typeMapping.put("integer", "int"); + typeMapping.put("Date", "DateTime"); + typeMapping.put("date", "DateTime"); + typeMapping.put("DateTime", "DateTime"); + typeMapping.put("file", "MultipartFile"); + typeMapping.put("binary", "MultipartFile"); + typeMapping.put("UUID", "String"); + typeMapping.put("URI", "String"); + typeMapping.put("ByteArray", "String"); + typeMapping.put("object", "Object"); + typeMapping.put("AnyType", "Object"); + + // DataTypes of the above values which are automatically imported. + // They are also not allowed to be model names. + defaultIncludes = Sets.newHashSet( + "String", + "bool", + "int", + "num", + "double", + "dynamic", + "List", + "Set", + "Map", + "DateTime", + "Object", + "MultipartFile" + ); + + additionalReservedWords = Sets.newHashSet( + "File", + "Client", + "Future", + "Response" + ); + + cliOptions.add(new CliOption(PUB_LIBRARY, "Library name in generated code")); + cliOptions.add(new CliOption(PUB_NAME, "Name in generated pubspec")); + cliOptions.add(new CliOption(PUB_VERSION, "Version in generated pubspec")); + cliOptions.add(new CliOption(PUB_DESCRIPTION, "Description in generated pubspec")); + cliOptions.add(new CliOption(PUB_AUTHOR, "Author name in generated pubspec")); + cliOptions.add(new CliOption(PUB_AUTHOR_EMAIL, "Email address of the author in generated pubspec")); + cliOptions.add(new CliOption(PUB_HOMEPAGE, "Homepage in generated pubspec")); + cliOptions.add(new CliOption(USE_ENUM_EXTENSION, "Allow the 'x-enum-values' extension for enums")); + cliOptions.add(new CliOption(CodegenConstants.SOURCE_FOLDER, "Source folder for generated code")); + + } + + @Override + public CodegenType getTag() { + return CodegenType.CLIENT; + } + + @Override + public String getName() { + return "dart"; + } + + @Override + public String getHelp() { + return "Generates a Dart 2.x client library."; + } + + @Override + public void processOpts() { + super.processOpts(); + + if (StringUtils.isEmpty(System.getenv("DART_POST_PROCESS_FILE"))) { + LOGGER.info("Environment variable DART_POST_PROCESS_FILE not defined so the Dart code may not be properly formatted. To define it, try `export DART_POST_PROCESS_FILE=\"/usr/local/bin/dartfmt -w\"` (Linux/Mac)"); + LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI)."); + } + + if (additionalProperties.containsKey(PUB_NAME)) { + this.setPubName((String) additionalProperties.get(PUB_NAME)); + } else { + //not set, use to be passed to template + additionalProperties.put(PUB_NAME, pubName); + } + + if (additionalProperties.containsKey(PUB_LIBRARY)) { + this.setPubLibrary((String) additionalProperties.get(PUB_LIBRARY)); + } else { + //not set, use to be passed to template + additionalProperties.put(PUB_LIBRARY, pubLibrary); + } + + if (additionalProperties.containsKey(PUB_VERSION)) { + this.setPubVersion((String) additionalProperties.get(PUB_VERSION)); + } else { + //not set, use to be passed to template + additionalProperties.put(PUB_VERSION, pubVersion); + } + + if (additionalProperties.containsKey(PUB_DESCRIPTION)) { + this.setPubDescription((String) additionalProperties.get(PUB_DESCRIPTION)); + } else { + //not set, use to be passed to template + additionalProperties.put(PUB_DESCRIPTION, pubDescription); + } + + if (additionalProperties.containsKey(PUB_AUTHOR)) { + this.setPubAuthor((String) additionalProperties.get(PUB_AUTHOR)); + } else { + //not set, use to be passed to template + additionalProperties.put(PUB_AUTHOR, pubAuthor); + } + + if (additionalProperties.containsKey(PUB_AUTHOR_EMAIL)) { + this.setPubAuthorEmail((String) additionalProperties.get(PUB_AUTHOR_EMAIL)); + } else { + //not set, use to be passed to template + additionalProperties.put(PUB_AUTHOR_EMAIL, pubAuthorEmail); + } + + if (additionalProperties.containsKey(PUB_HOMEPAGE)) { + this.setPubHomepage((String) additionalProperties.get(PUB_HOMEPAGE)); + } else { + //not set, use to be passed to template + additionalProperties.put(PUB_HOMEPAGE, pubHomepage); + } + + if (additionalProperties.containsKey(USE_ENUM_EXTENSION)) { + this.setUseEnumExtension(convertPropertyToBooleanAndWriteBack(USE_ENUM_EXTENSION)); + } else { + // Not set, use to be passed to template. + additionalProperties.put(USE_ENUM_EXTENSION, useEnumExtension); + } + + if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) { + this.setSourceFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER)); + } + + // make api and model doc path available in mustache template + additionalProperties.put("apiDocPath", apiDocPath); + additionalProperties.put("modelDocPath", modelDocPath); + + // check to not overwrite a custom templateDir + if (templateDir == null) { + embeddedTemplateDir = templateDir = "dart2"; + } + } + + @Override + protected boolean isReservedWord(String word) { + // consider everything as reserved that is either a keyword, + // a default included type, or a type include through some library + return super.isReservedWord(word) || + defaultIncludes().contains(word) || + additionalReservedWords.contains(word); + } + + @Override + public String escapeReservedWord(String name) { + return name + "_"; + } + + @Override + public String apiFileFolder() { + return outputFolder + File.separator + sourceFolder + File.separator + apiPackage().replace('.', File.separatorChar); + } + + @Override + public String modelFileFolder() { + return outputFolder + File.separator + sourceFolder + File.separator + modelPackage().replace('.', File.separatorChar); + } + + @Override + public String apiTestFileFolder() { + return outputFolder + File.separator + apiTestPath.replace('/', File.separatorChar); + } + + @Override + public String modelTestFileFolder() { + return outputFolder + File.separator + modelTestPath.replace('/', File.separatorChar); + } + + @Override + public String apiDocFileFolder() { + return outputFolder + File.separator + apiDocPath.replace('/', File.separatorChar); + } + + @Override + public String modelDocFileFolder() { + return outputFolder + File.separator + modelDocPath.replace('/', File.separatorChar); + } + + @Override + public String toVarName(String name) { + // replace - with _ e.g. created-at => created_at + name = name.replace("-", "_"); + + // always need to replace leading underscores first + name = name.replaceAll("^_", ""); + + // if it's all upper case, do nothing + if (name.matches("^[A-Z_]*$")) { + return name; + } + + // replace all characters that have a mapping but ignore underscores + // append an underscore to each replacement so that it can be camelized + if (name.chars().anyMatch(character -> specialCharReplacements.containsKey("" + ((char) character)))) { + name = escape(name, specialCharReplacements, Lists.newArrayList("_"), "_"); + } + // remove the rest + name = sanitizeName(name); + + // camelize (lower first character) the variable name + // pet_id => petId + name = camelize(name, true); + + if (name.matches("^\\d.*")) { + name = "n" + name; + } + + if (isReservedWord(name)) { + name = escapeReservedWord(name); + } + + return name; + } + + @Override + public String toParamName(String name) { + // should be the same as variable name + return toVarName(name); + } + + @Override + public String toModelName(final String name) { + String nameWithPrefixSuffix = sanitizeName(name); + if (!StringUtils.isEmpty(modelNamePrefix)) { + // add '_' so that model name can be camelized correctly + nameWithPrefixSuffix = modelNamePrefix + "_" + nameWithPrefixSuffix; + } + + if (!StringUtils.isEmpty(modelNameSuffix)) { + // add '_' so that model name can be camelized correctly + nameWithPrefixSuffix = nameWithPrefixSuffix + "_" + modelNameSuffix; + } + + // camelize the model name + // phone_number => PhoneNumber + final String camelizedName = camelize(nameWithPrefixSuffix); + + // model name cannot use reserved keyword, e.g. return + if (isReservedWord(camelizedName)) { + final String modelName = "Model" + camelizedName; + LOGGER.warn(camelizedName + " (reserved word) cannot be used as model name. Renamed to " + modelName); + return modelName; + } + + // model name starts with number + if (camelizedName.matches("^\\d.*")) { + final String modelName = "Model" + camelizedName; // e.g. 200Response => Model200Response (after camelize) + LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName); + return modelName; + } + + return camelizedName; + } + + @Override + public String toModelFilename(String name) { + return underscore(toModelName(name)); + } + + @Override public String toModelDocFilename(String name) { + return toModelName(name); + } + + @Override + public String toApiFilename(String name) { + return underscore(toApiName(name)); + } + + @Override + public String toApiTestFilename(String name) { + return toApiFilename(name) + "_test"; + } + + @Override + public String toModelTestFilename(String name) { + return toModelFilename(name) + "_test"; + } + + @Override + public String toDefaultValue(Schema schema) { + if (ModelUtils.isMapSchema(schema) || ModelUtils.isSet(schema)) { + return "const {}"; + } + if (ModelUtils.isArraySchema(schema)) { + return "const []"; + } + + if (schema.getDefault() != null) { + if (ModelUtils.isDateSchema(schema) || ModelUtils.isDateTimeSchema(schema)) { + // this is currently not supported and would create compile errors + return null; + } + if (ModelUtils.isStringSchema(schema)) { + return "'" + schema.getDefault().toString().replace("'", "\\'") + "'"; + } + return schema.getDefault().toString(); + } + return null; + } + + @Override + public String getTypeDeclaration(Schema p) { + Schema schema = ModelUtils.unaliasSchema(this.openAPI, p, importMapping); + Schema target = ModelUtils.isGenerateAliasAsModel() ? p : schema; + if (ModelUtils.isArraySchema(target)) { + Schema items = getSchemaItems((ArraySchema) schema); + return getSchemaType(target) + "<" + getTypeDeclaration(items) + ">"; + } + if (ModelUtils.isMapSchema(target)) { + // Note: ModelUtils.isMapSchema(p) returns true when p is a composed schema that also defines + // additionalproperties: true + Schema inner = getAdditionalProperties(target); + if (inner == null) { + LOGGER.error("`{}` (map property) does not have a proper inner type defined. Default to type:string", p.getName()); + inner = new StringSchema().description("TODO default missing map inner type to string"); + p.setAdditionalProperties(inner); + } + return getSchemaType(target) + ""; + } + return super.getTypeDeclaration(p); + } + + @Override + public String getSchemaType(Schema p) { + String openAPIType = super.getSchemaType(p); + if (openAPIType == null) { + LOGGER.error("No Type defined for Schema " + p); + } + if (typeMapping.containsKey(openAPIType)) { + return typeMapping.get(openAPIType); + } + if (languageSpecificPrimitives.contains(openAPIType)) { + return openAPIType; + } + return toModelName(openAPIType); + } + + @Override + public Map postProcessModels(Map objs) { + return postProcessModelsEnum(objs); + } + + @Override + public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { + super.postProcessModelProperty(model, property); + if (!model.isEnum && property.isEnum) { + // These are inner enums, enums which do not exist as models, just as properties. + // They are handled via the enum_inline template and and are generated in the + // same file as the containing class. To prevent name clashes the inline enum classes + // are prefix with the classname of the containing class in the template. + // Here the datatypeWithEnum template variable gets updated to match that scheme. + // Also taking into account potential collection types e.g. List -> List + final String enumName = model.classname + property.enumName; + if (property.items != null) { + // inner items e.g. enums in collections, only works for one level + // but same is the case for DefaultCodegen + property.setDatatypeWithEnum(property.datatypeWithEnum.replace(property.items.datatypeWithEnum, enumName)); + property.items.setDatatypeWithEnum(enumName); + property.items.setEnumName(enumName); + } else { + // plain enum property + property.setDatatypeWithEnum(property.datatypeWithEnum.replace(property.enumName, enumName)); + } + property.setEnumName(enumName); + } + } + + @Override + public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, List servers) { + final CodegenOperation op = super.fromOperation(path, httpMethod, operation, servers); + for (CodegenResponse r : op.responses) { + // By default only set types are automatically added to operation imports, not sure why. + // Add all container type imports here, by default 'dart:core' imports are skipped + // but other sub classes may required specific container type imports. + if (r.containerType != null && typeMapping().containsKey(r.containerType)) { + final String value = typeMapping().get(r.containerType); + if (needToImport(value)) { + op.imports.add(value); + } + } + } + for (CodegenParameter p : op.allParams) { + if (p.isContainer) { + final String type = p.isArray ? "array" : "map"; + if (typeMapping().containsKey(type)) { + final String value = typeMapping().get(type); + // Also add container imports for parameters. + if (needToImport(value)) { + op.imports.add(value); + } + } + } + } + return op; + } + + @Override + protected void updateEnumVarsWithExtensions(List> enumVars, Map vendorExtensions, String dataType) { + if (vendorExtensions != null && useEnumExtension && vendorExtensions.containsKey("x-enum-values")) { + // Use the x-enum-values extension for this enum + // Existing enumVars added by the default handling need to be removed first + enumVars.clear(); + + Object extension = vendorExtensions.get("x-enum-values"); + List> values = (List>) extension; + for (Map value : values) { + Map enumVar = new HashMap<>(); + enumVar.put("name", toEnumVarName((String) value.get("identifier"), dataType)); + enumVar.put("value", toEnumValue(value.get("numericValue").toString(), dataType)); + enumVar.put("isString", isDataTypeString(dataType)); + if (value.containsKey("description")) { + enumVar.put("description", value.get("description").toString()); + } + enumVars.add(enumVar); + } + } else { + super.updateEnumVarsWithExtensions(enumVars, vendorExtensions, dataType); + } + } + + @Override + public String toEnumVarName(String value, String datatype) { + if (value.length() == 0) { + return "empty"; + } + if (("number".equalsIgnoreCase(datatype) || + "double".equalsIgnoreCase(datatype) || + "int".equalsIgnoreCase(datatype)) && + value.matches("^-?\\d.*")) { + // Only rename numeric values when the datatype is numeric + // AND the name is not changed by enum extensions (matches a numeric value). + boolean isNegative = value.startsWith("-"); + return toVarName("number" + (isNegative ? "_negative" : "") + value); + } + return toVarName(value); + } + + @Override + public String toEnumValue(String value, String datatype) { + if ("number".equalsIgnoreCase(datatype) || + "int".equalsIgnoreCase(datatype)) { + return value; + } else { + return "'" + escapeText(value) + "'"; + } + } + + @Override + public String toOperationId(String operationId) { + operationId = super.toOperationId(operationId); + + operationId = camelize(sanitizeName(operationId), true); + + // method name cannot use reserved keyword, e.g. return + if (isReservedWord(operationId)) { + String newOperationId = camelize("call_" + operationId, true); + LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + newOperationId); + return newOperationId; + } + + // operationId starts with a number + if (operationId.matches("^\\d.*")) { + LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize("call_" + operationId), true); + operationId = camelize("call_" + operationId, true); + } + + return operationId; + } + + public void setPubLibrary(String pubLibrary) { + this.pubLibrary = pubLibrary; + } + + public void setPubName(String pubName) { + this.pubName = pubName; + } + + public void setPubVersion(String pubVersion) { + this.pubVersion = pubVersion; + } + + public void setPubDescription(String pubDescription) { + this.pubDescription = pubDescription; + } + + public void setPubAuthor(String pubAuthor) { + this.pubAuthor = pubAuthor; + } + + public void setPubAuthorEmail(String pubAuthorEmail) { + this.pubAuthorEmail = pubAuthorEmail; + } + + public void setPubHomepage(String pubHomepage) { + this.pubHomepage = pubHomepage; + } + + public void setUseEnumExtension(boolean useEnumExtension) { + this.useEnumExtension = useEnumExtension; + } + + public void setSourceFolder(String sourceFolder) { + this.sourceFolder = sourceFolder; + } + + @Override + public String escapeQuotationMark(String input) { + // remove " to avoid code injection + return input.replace("\"", ""); + } + + @Override + public String escapeUnsafeCharacters(String input) { + return input.replace("*/", "*_/").replace("/*", "/_*"); + } + + @Override + public void postProcessFile(File file, String fileType) { + if (file == null) { + return; + } + + String dartPostProcessFile = System.getenv("DART_POST_PROCESS_FILE"); + if (StringUtils.isEmpty(dartPostProcessFile)) { + return; // skip if DART_POST_PROCESS_FILE env variable is not defined + } + + // process all files with dart extension + if ("dart".equals(FilenameUtils.getExtension(file.toString()))) { + // currently only support "dartfmt -w yourcode.dart" + String command = dartPostProcessFile + " " + file.toString(); + try { + Process p = Runtime.getRuntime().exec(command); + int exitValue = p.waitFor(); + if (exitValue != 0) { + LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue); + } else { + LOGGER.info("Successfully executed: {}", command); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + } + } + } +} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java index 15dc154e1f3..266fbee0136 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java @@ -17,290 +17,51 @@ package org.openapitools.codegen.languages; -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.URI; -import java.net.URISyntaxException; -import java.nio.charset.StandardCharsets; -import java.nio.file.*; -import java.util.*; -import java.util.stream.Collectors; - -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; - -import io.swagger.v3.oas.models.Operation; -import io.swagger.v3.oas.models.media.StringSchema; -import io.swagger.v3.oas.models.servers.Server; -import org.apache.commons.io.FilenameUtils; -import org.apache.commons.lang3.StringUtils; -import org.openapitools.codegen.*; -import org.openapitools.codegen.meta.features.ClientModificationFeature; -import org.openapitools.codegen.meta.features.DocumentationFeature; -import org.openapitools.codegen.meta.features.GlobalFeature; -import org.openapitools.codegen.meta.features.ParameterFeature; -import org.openapitools.codegen.meta.features.SchemaSupportFeature; -import org.openapitools.codegen.meta.features.SecurityFeature; -import org.openapitools.codegen.utils.ModelUtils; +import org.openapitools.codegen.CliOption; +import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.SupportingFile; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import io.swagger.v3.oas.models.media.ArraySchema; -import io.swagger.v3.oas.models.media.Schema; +import java.io.File; +import java.util.HashMap; +import java.util.Map; -import static org.openapitools.codegen.utils.StringUtils.*; +public class DartClientCodegen extends AbstractDartCodegen { -public class DartClientCodegen extends DefaultCodegen { private final Logger LOGGER = LoggerFactory.getLogger(DartClientCodegen.class); - public static final String PUB_LIBRARY = "pubLibrary"; - public static final String PUB_NAME = "pubName"; - public static final String PUB_VERSION = "pubVersion"; - public static final String PUB_DESCRIPTION = "pubDescription"; - public static final String PUB_AUTHOR = "pubAuthor"; - public static final String PUB_AUTHOR_EMAIL = "pubAuthorEmail"; - public static final String PUB_HOMEPAGE = "pubHomepage"; - public static final String USE_ENUM_EXTENSION = "useEnumExtension"; - - protected String pubLibrary = "openapi.api"; - protected String pubName = "openapi"; - protected String pubVersion = "1.0.0"; - protected String pubDescription = "OpenAPI API client"; - protected String pubAuthor = "Author"; - protected String pubAuthorEmail = "author@homepage"; - protected String pubHomepage = "homepage"; - protected boolean useEnumExtension = false; - protected String sourceFolder = ""; - protected String apiDocPath = "doc" + File.separator; - protected String modelDocPath = "doc" + File.separator; - protected String apiTestPath = "test" + File.separator; - protected String modelTestPath = "test" + File.separator; - - // Names that must not be used as model names because they clash with existing - // default imports (dart:io, dart:async, package:http etc.) but are not basic dataTypes. - protected Set additionalReservedWords; + public static final String SERIALIZATION_LIBRARY_NATIVE = "native_serialization"; + public static final String SERIALIZATION_LIBRARY_JSON_SERIALIZABLE = "json_serializable"; public DartClientCodegen() { super(); - modifyFeatureSet(features -> features - .includeDocumentationFeatures(DocumentationFeature.Readme) - .securityFeatures(EnumSet.of( - SecurityFeature.OAuth2_Implicit, - SecurityFeature.BasicAuth, - SecurityFeature.ApiKey - )) - .excludeGlobalFeatures( - GlobalFeature.XMLStructureDefinitions, - GlobalFeature.Callbacks, - GlobalFeature.LinkObjects, - GlobalFeature.ParameterStyling - ) - .excludeSchemaSupportFeatures( - SchemaSupportFeature.Polymorphism - ) - .includeParameterFeatures( - ParameterFeature.Cookie - ) - .includeClientModificationFeatures( - ClientModificationFeature.BasePath - ) - ); + final CliOption serializationLibrary = new CliOption(CodegenConstants.SERIALIZATION_LIBRARY, + "Specify serialization library"); + serializationLibrary.setDefault(SERIALIZATION_LIBRARY_NATIVE); + serializationLibrary.setType("String"); - outputFolder = "generated-code/dart"; - modelTemplateFiles.put("model.mustache", ".dart"); - apiTemplateFiles.put("api.mustache", ".dart"); - embeddedTemplateDir = templateDir = "dart2"; - apiPackage = "lib.api"; - modelPackage = "lib.model"; - modelDocTemplateFiles.put("object_doc.mustache", ".md"); - apiDocTemplateFiles.put("api_doc.mustache", ".md"); - - modelTestTemplateFiles.put("model_test.mustache", ".dart"); - apiTestTemplateFiles.put("api_test.mustache", ".dart"); - - final List reservedWordsList = new ArrayList<>(); - try(BufferedReader reader = new BufferedReader( - new InputStreamReader(DartClientCodegen.class.getResourceAsStream("/dart/dart-keywords.txt"), - StandardCharsets.UTF_8))) { - while (reader.ready()) { - reservedWordsList.add(reader.readLine()); - } - } catch (Exception e) { - LOGGER.error("Error reading dart keywords. Exception: {}", e.getMessage()); - } - setReservedWordsLowerCase(reservedWordsList); - - languageSpecificPrimitives = Sets.newHashSet( - "String", - "bool", - "int", - "num", - "double", - "dynamic" - ); - - typeMapping = new HashMap<>(); - typeMapping.put("Array", "List"); - typeMapping.put("array", "List"); - typeMapping.put("map", "Map"); - typeMapping.put("List", "List"); - typeMapping.put("set", "Set"); - typeMapping.put("boolean", "bool"); - typeMapping.put("string", "String"); - typeMapping.put("char", "String"); - typeMapping.put("int", "int"); - typeMapping.put("long", "int"); - typeMapping.put("short", "int"); - typeMapping.put("number", "num"); - typeMapping.put("float", "double"); - typeMapping.put("double", "double"); - typeMapping.put("decimal", "double"); - typeMapping.put("integer", "int"); - typeMapping.put("Date", "DateTime"); - typeMapping.put("date", "DateTime"); - typeMapping.put("DateTime", "DateTime"); - typeMapping.put("file", "MultipartFile"); - typeMapping.put("binary", "MultipartFile"); - typeMapping.put("UUID", "String"); - typeMapping.put("URI", "String"); - typeMapping.put("ByteArray", "String"); - typeMapping.put("object", "Object"); - typeMapping.put("AnyType", "Object"); - - // DataTypes of the above values which are automatically imported. - // They are also not allowed to be model names. - defaultIncludes = Sets.newHashSet( - "String", - "bool", - "int", - "num", - "double", - "dynamic", - "List", - "Set", - "Map", - "DateTime", - "Object", - "MultipartFile" - ); - - additionalReservedWords = Sets.newHashSet( - "File", - "Client", - "Future", - "Response" - ); - - cliOptions.add(new CliOption(PUB_LIBRARY, "Library name in generated code")); - cliOptions.add(new CliOption(PUB_NAME, "Name in generated pubspec")); - cliOptions.add(new CliOption(PUB_VERSION, "Version in generated pubspec")); - cliOptions.add(new CliOption(PUB_DESCRIPTION, "Description in generated pubspec")); - cliOptions.add(new CliOption(PUB_AUTHOR, "Author name in generated pubspec")); - cliOptions.add(new CliOption(PUB_AUTHOR_EMAIL, "Email address of the author in generated pubspec")); - cliOptions.add(new CliOption(PUB_HOMEPAGE, "Homepage in generated pubspec")); - cliOptions.add(new CliOption(USE_ENUM_EXTENSION, "Allow the 'x-enum-values' extension for enums")); - cliOptions.add(new CliOption(CodegenConstants.SOURCE_FOLDER, "Source folder for generated code")); - } - - @Override - public CodegenType getTag() { - return CodegenType.CLIENT; - } - - @Override - public String getName() { - return "dart"; - } - - @Override - public String getHelp() { - return "Generates a Dart 2.x client library."; - } - - protected void defaultProcessOpts() { - super.processOpts(); + final Map serializationOptions = new HashMap<>(); + serializationOptions.put(SERIALIZATION_LIBRARY_NATIVE, "Use native serializer, backwards compatible"); + serializationOptions.put(SERIALIZATION_LIBRARY_JSON_SERIALIZABLE, "Use json_serializable"); + serializationLibrary.setEnum(serializationOptions); + cliOptions.add(serializationLibrary); } @Override public void processOpts() { - defaultProcessOpts(); + super.processOpts(); - if (StringUtils.isEmpty(System.getenv("DART_POST_PROCESS_FILE"))) { - LOGGER.info("Environment variable DART_POST_PROCESS_FILE not defined so the Dart code may not be properly formatted. To define it, try `export DART_POST_PROCESS_FILE=\"/usr/local/bin/dartfmt -w\"` (Linux/Mac)"); - LOGGER.info("NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI)."); - } - - if (additionalProperties.containsKey(PUB_NAME)) { - this.setPubName((String) additionalProperties.get(PUB_NAME)); + // handle library not being set + if(additionalProperties.get(CodegenConstants.SERIALIZATION_LIBRARY) == null) { + this.library = SERIALIZATION_LIBRARY_NATIVE; + LOGGER.debug("Serialization library not set, using default {}", SERIALIZATION_LIBRARY_NATIVE); } else { - //not set, use to be passed to template - additionalProperties.put(PUB_NAME, pubName); + this.library = additionalProperties.get(CodegenConstants.SERIALIZATION_LIBRARY).toString(); } - if (additionalProperties.containsKey(PUB_LIBRARY)) { - this.setPubLibrary((String) additionalProperties.get(PUB_LIBRARY)); - } else { - //not set, use to be passed to template - additionalProperties.put(PUB_LIBRARY, pubLibrary); - } - - if (additionalProperties.containsKey(PUB_VERSION)) { - this.setPubVersion((String) additionalProperties.get(PUB_VERSION)); - } else { - //not set, use to be passed to template - additionalProperties.put(PUB_VERSION, pubVersion); - } - - if (additionalProperties.containsKey(PUB_DESCRIPTION)) { - this.setPubDescription((String) additionalProperties.get(PUB_DESCRIPTION)); - } else { - //not set, use to be passed to template - additionalProperties.put(PUB_DESCRIPTION, pubDescription); - } - - if (additionalProperties.containsKey(PUB_AUTHOR)) { - this.setPubAuthor((String) additionalProperties.get(PUB_AUTHOR)); - } else { - //not set, use to be passed to template - additionalProperties.put(PUB_AUTHOR, pubAuthor); - } - - if (additionalProperties.containsKey(PUB_AUTHOR_EMAIL)) { - this.setPubAuthorEmail((String) additionalProperties.get(PUB_AUTHOR_EMAIL)); - } else { - //not set, use to be passed to template - additionalProperties.put(PUB_AUTHOR_EMAIL, pubAuthorEmail); - } - - if (additionalProperties.containsKey(PUB_HOMEPAGE)) { - this.setPubHomepage((String) additionalProperties.get(PUB_HOMEPAGE)); - } else { - //not set, use to be passed to template - additionalProperties.put(PUB_HOMEPAGE, pubHomepage); - } - - if (additionalProperties.containsKey(USE_ENUM_EXTENSION)) { - this.setUseEnumExtension(convertPropertyToBooleanAndWriteBack(USE_ENUM_EXTENSION)); - } else { - // Not set, use to be passed to template. - additionalProperties.put(USE_ENUM_EXTENSION, useEnumExtension); - } - - if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) { - this.setSourceFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER)); - } - - // make api and model doc path available in mustache template - additionalProperties.put("apiDocPath", apiDocPath); - additionalProperties.put("modelDocPath", modelDocPath); - - // check to not overwrite a custom templateDir - if (templateDir == null) { - embeddedTemplateDir = templateDir = "dart2"; - } + this.setSerializationLibrary(); final String libFolder = sourceFolder + File.separator + "lib"; supportingFiles.add(new SupportingFile("pubspec.mustache", "", "pubspec.yaml")); @@ -319,416 +80,26 @@ public class DartClientCodegen extends DefaultCodegen { supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); supportingFiles.add(new SupportingFile("travis.mustache", "", ".travis.yml")); + } - @Override - protected boolean isReservedWord(String word) { - // consider everything as reserved that is either a keyword, - // a default included type, or a type include through some library - return super.isReservedWord(word) || - defaultIncludes().contains(word) || - additionalReservedWords.contains(word); - } + private void setSerializationLibrary() { + final String serialization_library = getLibrary(); + LOGGER.info("Using serialization library {}", serialization_library); - @Override - public String escapeReservedWord(String name) { - return name + "_"; - } + switch (serialization_library) { + case SERIALIZATION_LIBRARY_JSON_SERIALIZABLE: + additionalProperties.put(SERIALIZATION_LIBRARY_JSON_SERIALIZABLE, "true"); + // json_serializable requires build.yaml + supportingFiles.add(new SupportingFile("build.yaml.mustache", + "" /* main project dir */, + "build.yaml")); + break; - @Override - public String apiFileFolder() { - return outputFolder + File.separator + sourceFolder + File.separator + apiPackage().replace('.', File.separatorChar); - } + case SERIALIZATION_LIBRARY_NATIVE: // fall trough to default backwards compatible generator + default: + additionalProperties.put(SERIALIZATION_LIBRARY_NATIVE, "true"); - @Override - public String modelFileFolder() { - return outputFolder + File.separator + sourceFolder + File.separator + modelPackage().replace('.', File.separatorChar); - } - - @Override - public String apiTestFileFolder() { - return outputFolder + File.separator + apiTestPath.replace('/', File.separatorChar); - } - - @Override - public String modelTestFileFolder() { - return outputFolder + File.separator + modelTestPath.replace('/', File.separatorChar); - } - - @Override - public String apiDocFileFolder() { - return outputFolder + File.separator + apiDocPath.replace('/', File.separatorChar); - } - - @Override - public String modelDocFileFolder() { - return outputFolder + File.separator + modelDocPath.replace('/', File.separatorChar); - } - - @Override - public String toVarName(String name) { - // replace - with _ e.g. created-at => created_at - name = name.replace("-", "_"); - - // always need to replace leading underscores first - name = name.replaceAll("^_", ""); - - // if it's all upper case, do nothing - if (name.matches("^[A-Z_]*$")) { - return name; - } - - // replace all characters that have a mapping but ignore underscores - // append an underscore to each replacement so that it can be camelized - if (name.chars().anyMatch(character -> specialCharReplacements.containsKey("" + ((char) character)))) { - name = escape(name, specialCharReplacements, Lists.newArrayList("_"), "_"); - } - // remove the rest - name = sanitizeName(name); - - // camelize (lower first character) the variable name - // pet_id => petId - name = camelize(name, true); - - if (name.matches("^\\d.*")) { - name = "n" + name; - } - - if (isReservedWord(name)) { - name = escapeReservedWord(name); - } - - return name; - } - - @Override - public String toParamName(String name) { - // should be the same as variable name - return toVarName(name); - } - - @Override - public String toModelName(final String name) { - String nameWithPrefixSuffix = sanitizeName(name); - if (!StringUtils.isEmpty(modelNamePrefix)) { - // add '_' so that model name can be camelized correctly - nameWithPrefixSuffix = modelNamePrefix + "_" + nameWithPrefixSuffix; - } - - if (!StringUtils.isEmpty(modelNameSuffix)) { - // add '_' so that model name can be camelized correctly - nameWithPrefixSuffix = nameWithPrefixSuffix + "_" + modelNameSuffix; - } - - // camelize the model name - // phone_number => PhoneNumber - final String camelizedName = camelize(nameWithPrefixSuffix); - - // model name cannot use reserved keyword, e.g. return - if (isReservedWord(camelizedName)) { - final String modelName = "Model" + camelizedName; - LOGGER.warn(camelizedName + " (reserved word) cannot be used as model name. Renamed to " + modelName); - return modelName; - } - - // model name starts with number - if (camelizedName.matches("^\\d.*")) { - final String modelName = "Model" + camelizedName; // e.g. 200Response => Model200Response (after camelize) - LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName); - return modelName; - } - - return camelizedName; - } - - @Override - public String toModelFilename(String name) { - return underscore(toModelName(name)); - } - - @Override public String toModelDocFilename(String name) { - return toModelName(name); - } - - @Override - public String toApiFilename(String name) { - return underscore(toApiName(name)); - } - - @Override - public String toApiTestFilename(String name) { - return toApiFilename(name) + "_test"; - } - - @Override - public String toModelTestFilename(String name) { - return toModelFilename(name) + "_test"; - } - - @Override - public String toDefaultValue(Schema schema) { - if (ModelUtils.isMapSchema(schema) || ModelUtils.isSet(schema)) { - return "const {}"; - } - if (ModelUtils.isArraySchema(schema)) { - return "const []"; - } - - if (schema.getDefault() != null) { - if (ModelUtils.isDateSchema(schema) || ModelUtils.isDateTimeSchema(schema)) { - // this is currently not supported and would create compile errors - return null; - } - if (ModelUtils.isStringSchema(schema)) { - return "'" + schema.getDefault().toString().replace("'", "\\'") + "'"; - } - return schema.getDefault().toString(); - } - return null; - } - - @Override - public String getTypeDeclaration(Schema p) { - Schema schema = ModelUtils.unaliasSchema(this.openAPI, p, importMapping); - Schema target = ModelUtils.isGenerateAliasAsModel() ? p : schema; - if (ModelUtils.isArraySchema(target)) { - Schema items = getSchemaItems((ArraySchema) schema); - return getSchemaType(target) + "<" + getTypeDeclaration(items) + ">"; - } - if (ModelUtils.isMapSchema(target)) { - // Note: ModelUtils.isMapSchema(p) returns true when p is a composed schema that also defines - // additionalproperties: true - Schema inner = getAdditionalProperties(target); - if (inner == null) { - LOGGER.error("`{}` (map property) does not have a proper inner type defined. Default to type:string", p.getName()); - inner = new StringSchema().description("TODO default missing map inner type to string"); - p.setAdditionalProperties(inner); - } - return getSchemaType(target) + ""; - } - return super.getTypeDeclaration(p); - } - - @Override - public String getSchemaType(Schema p) { - String openAPIType = super.getSchemaType(p); - if (openAPIType == null) { - LOGGER.error("No Type defined for Schema " + p); - } - if (typeMapping.containsKey(openAPIType)) { - return typeMapping.get(openAPIType); - } - if (languageSpecificPrimitives.contains(openAPIType)) { - return openAPIType; - } - return toModelName(openAPIType); - } - - @Override - public Map postProcessModels(Map objs) { - return postProcessModelsEnum(objs); - } - - @Override - public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { - super.postProcessModelProperty(model, property); - if (!model.isEnum && property.isEnum) { - // These are inner enums, enums which do not exist as models, just as properties. - // They are handled via the enum_inline template and and are generated in the - // same file as the containing class. To prevent name clashes the inline enum classes - // are prefix with the classname of the containing class in the template. - // Here the datatypeWithEnum template variable gets updated to match that scheme. - // Also taking into account potential collection types e.g. List -> List - final String enumName = model.classname + property.enumName; - if (property.items != null) { - // inner items e.g. enums in collections, only works for one level - // but same is the case for DefaultCodegen - property.setDatatypeWithEnum(property.datatypeWithEnum.replace(property.items.datatypeWithEnum, enumName)); - property.items.setDatatypeWithEnum(enumName); - property.items.setEnumName(enumName); - } else { - // plain enum property - property.setDatatypeWithEnum(property.datatypeWithEnum.replace(property.enumName, enumName)); - } - property.setEnumName(enumName); - } - } - - @Override - public CodegenOperation fromOperation(String path, String httpMethod, Operation operation, List servers) { - final CodegenOperation op = super.fromOperation(path, httpMethod, operation, servers); - for (CodegenResponse r : op.responses) { - // By default only set types are automatically added to operation imports, not sure why. - // Add all container type imports here, by default 'dart:core' imports are skipped - // but other sub classes may required specific container type imports. - if (r.containerType != null && typeMapping().containsKey(r.containerType)) { - final String value = typeMapping().get(r.containerType); - if (needToImport(value)) { - op.imports.add(value); - } - } - } - for (CodegenParameter p : op.allParams) { - if (p.isContainer) { - final String type = p.isArray ? "array" : "map"; - if (typeMapping().containsKey(type)) { - final String value = typeMapping().get(type); - // Also add container imports for parameters. - if (needToImport(value)) { - op.imports.add(value); - } - } - } - } - return op; - } - - @Override - protected void updateEnumVarsWithExtensions(List> enumVars, Map vendorExtensions, String dataType) { - if (vendorExtensions != null && useEnumExtension && vendorExtensions.containsKey("x-enum-values")) { - // Use the x-enum-values extension for this enum - // Existing enumVars added by the default handling need to be removed first - enumVars.clear(); - - Object extension = vendorExtensions.get("x-enum-values"); - List> values = (List>) extension; - for (Map value : values) { - Map enumVar = new HashMap<>(); - enumVar.put("name", toEnumVarName((String) value.get("identifier"), dataType)); - enumVar.put("value", toEnumValue(value.get("numericValue").toString(), dataType)); - enumVar.put("isString", isDataTypeString(dataType)); - if (value.containsKey("description")) { - enumVar.put("description", value.get("description").toString()); - } - enumVars.add(enumVar); - } - } else { - super.updateEnumVarsWithExtensions(enumVars, vendorExtensions, dataType); - } - } - - @Override - public String toEnumVarName(String value, String datatype) { - if (value.length() == 0) { - return "empty"; - } - if (("number".equalsIgnoreCase(datatype) || - "double".equalsIgnoreCase(datatype) || - "int".equalsIgnoreCase(datatype)) && - value.matches("^-?\\d.*")) { - // Only rename numeric values when the datatype is numeric - // AND the name is not changed by enum extensions (matches a numeric value). - boolean isNegative = value.startsWith("-"); - return toVarName("number" + (isNegative ? "_negative" : "") + value); - } - return toVarName(value); - } - - @Override - public String toEnumValue(String value, String datatype) { - if ("number".equalsIgnoreCase(datatype) || - "int".equalsIgnoreCase(datatype)) { - return value; - } else { - return "'" + escapeText(value) + "'"; - } - } - - @Override - public String toOperationId(String operationId) { - operationId = super.toOperationId(operationId); - - operationId = camelize(sanitizeName(operationId), true); - - // method name cannot use reserved keyword, e.g. return - if (isReservedWord(operationId)) { - String newOperationId = camelize("call_" + operationId, true); - LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + newOperationId); - return newOperationId; - } - - // operationId starts with a number - if (operationId.matches("^\\d.*")) { - LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize("call_" + operationId), true); - operationId = camelize("call_" + operationId, true); - } - - return operationId; - } - - public void setPubLibrary(String pubLibrary) { - this.pubLibrary = pubLibrary; - } - - public void setPubName(String pubName) { - this.pubName = pubName; - } - - public void setPubVersion(String pubVersion) { - this.pubVersion = pubVersion; - } - - public void setPubDescription(String pubDescription) { - this.pubDescription = pubDescription; - } - - public void setPubAuthor(String pubAuthor) { - this.pubAuthor = pubAuthor; - } - - public void setPubAuthorEmail(String pubAuthorEmail) { - this.pubAuthorEmail = pubAuthorEmail; - } - - public void setPubHomepage(String pubHomepage) { - this.pubHomepage = pubHomepage; - } - - public void setUseEnumExtension(boolean useEnumExtension) { - this.useEnumExtension = useEnumExtension; - } - - public void setSourceFolder(String sourceFolder) { - this.sourceFolder = sourceFolder; - } - - @Override - public String escapeQuotationMark(String input) { - // remove " to avoid code injection - return input.replace("\"", ""); - } - - @Override - public String escapeUnsafeCharacters(String input) { - return input.replace("*/", "*_/").replace("/*", "/_*"); - } - - @Override - public void postProcessFile(File file, String fileType) { - if (file == null) { - return; - } - - String dartPostProcessFile = System.getenv("DART_POST_PROCESS_FILE"); - if (StringUtils.isEmpty(dartPostProcessFile)) { - return; // skip if DART_POST_PROCESS_FILE env variable is not defined - } - - // process all files with dart extension - if ("dart".equals(FilenameUtils.getExtension(file.toString()))) { - // currently only support "dartfmt -w yourcode.dart" - String command = dartPostProcessFile + " " + file.toString(); - try { - Process p = Runtime.getRuntime().exec(command); - int exitValue = p.waitFor(); - if (exitValue != 0) { - LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue); - } else { - LOGGER.info("Successfully executed: {}", command); - } - } catch (Exception e) { - LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); - } } } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java index 0e1057a6a3c..54d94d7f1cc 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartDioClientCodegen.java @@ -32,7 +32,8 @@ import java.util.*; import static org.openapitools.codegen.utils.StringUtils.underscore; -public class DartDioClientCodegen extends DartClientCodegen { +public class DartDioClientCodegen extends AbstractDartCodegen { + private final Logger LOGGER = LoggerFactory.getLogger(DartDioClientCodegen.class); public static final String NULLABLE_FIELDS = "nullableFields"; @@ -149,7 +150,7 @@ public class DartDioClientCodegen extends DartClientCodegen { @Override public void processOpts() { - defaultProcessOpts(); + super.processOpts(); if (StringUtils.isEmpty(System.getenv("DART_POST_PROCESS_FILE"))) { LOGGER.info("Environment variable DART_POST_PROCESS_FILE not defined so the Dart code may not be properly formatted. To define it, try `export DART_POST_PROCESS_FILE=\"/usr/local/bin/dartfmt -w\"` (Linux/Mac)"); @@ -163,49 +164,10 @@ public class DartDioClientCodegen extends DartClientCodegen { additionalProperties.put(NULLABLE_FIELDS, nullableFields); } - if (additionalProperties.containsKey(PUB_LIBRARY)) { - this.setPubLibrary((String) additionalProperties.get(PUB_LIBRARY)); - } else { - //not set, use to be passed to template - additionalProperties.put(PUB_LIBRARY, pubLibrary); - } - - if (additionalProperties.containsKey(PUB_NAME)) { - this.setPubName((String) additionalProperties.get(PUB_NAME)); - } else { - //not set, use to be passed to template - additionalProperties.put(PUB_NAME, pubName); - } - if (!additionalProperties.containsKey(CLIENT_NAME)) { additionalProperties.put(CLIENT_NAME, org.openapitools.codegen.utils.StringUtils.camelize(pubName)); } - if (additionalProperties.containsKey(PUB_VERSION)) { - this.setPubVersion((String) additionalProperties.get(PUB_VERSION)); - } else { - //not set, use to be passed to template - additionalProperties.put(PUB_VERSION, pubVersion); - } - - if (additionalProperties.containsKey(PUB_DESCRIPTION)) { - this.setPubDescription((String) additionalProperties.get(PUB_DESCRIPTION)); - } else { - //not set, use to be passed to template - additionalProperties.put(PUB_DESCRIPTION, pubDescription); - } - - if (additionalProperties.containsKey(USE_ENUM_EXTENSION)) { - this.setUseEnumExtension(convertPropertyToBooleanAndWriteBack(USE_ENUM_EXTENSION)); - } else { - // Not set, use to be passed to template. - additionalProperties.put(USE_ENUM_EXTENSION, useEnumExtension); - } - - if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) { - this.setSourceFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER)); - } - if (additionalProperties.containsKey(DATE_LIBRARY)) { this.setDateLibrary(additionalProperties.get(DATE_LIBRARY).toString()); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartJaguarClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartJaguarClientCodegen.java index ea764a2982c..279bc4523b8 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartJaguarClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartJaguarClientCodegen.java @@ -32,7 +32,8 @@ import java.util.*; import static org.openapitools.codegen.utils.StringUtils.underscore; -public class DartJaguarClientCodegen extends DartClientCodegen { +public class DartJaguarClientCodegen extends AbstractDartCodegen { + private final Logger LOGGER = LoggerFactory.getLogger(DartJaguarClientCodegen.class); private static final String NULLABLE_FIELDS = "nullableFields"; @@ -150,7 +151,8 @@ public class DartJaguarClientCodegen extends DartClientCodegen { @Override public void processOpts() { - defaultProcessOpts(); + super.processOpts(); + if (additionalProperties.containsKey(NULLABLE_FIELDS)) { nullableFields = convertPropertyToBooleanAndWriteBack(NULLABLE_FIELDS); } else { @@ -172,35 +174,8 @@ public class DartJaguarClientCodegen extends DartClientCodegen { additionalProperties.put(IS_FORMAT_PROTO, false); } - if (additionalProperties.containsKey(PUB_LIBRARY)) { - this.setPubLibrary((String) additionalProperties.get(PUB_LIBRARY)); - } else { - //not set, use to be passed to template - additionalProperties.put(PUB_LIBRARY, pubLibrary); - } - - if (additionalProperties.containsKey(PUB_NAME)) { - this.setPubName((String) additionalProperties.get(PUB_NAME)); - } else { - //not set, use to be passed to template - additionalProperties.put(PUB_NAME, pubName); - } additionalProperties.put(CLIENT_NAME, org.openapitools.codegen.utils.StringUtils.camelize(pubName)); - if (additionalProperties.containsKey(PUB_VERSION)) { - this.setPubVersion((String) additionalProperties.get(PUB_VERSION)); - } else { - //not set, use to be passed to template - additionalProperties.put(PUB_VERSION, pubVersion); - } - - if (additionalProperties.containsKey(PUB_DESCRIPTION)) { - this.setPubDescription((String) additionalProperties.get(PUB_DESCRIPTION)); - } else { - //not set, use to be passed to template - additionalProperties.put(PUB_DESCRIPTION, pubDescription); - } - if (additionalProperties.containsKey(USE_ENUM_EXTENSION)) { this.setUseEnumExtension(convertPropertyToBooleanAndWriteBack(USE_ENUM_EXTENSION)); } else { @@ -208,10 +183,6 @@ public class DartJaguarClientCodegen extends DartClientCodegen { additionalProperties.put(USE_ENUM_EXTENSION, useEnumExtension); } - if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) { - this.setSourceFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER)); - } - // make api and model doc path available in mustache template additionalProperties.put("apiDocPath", apiDocPath); additionalProperties.put("modelDocPath", modelDocPath); diff --git a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache index e289a31b63a..e231ff72859 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache @@ -179,7 +179,8 @@ class ApiClient { {{#model}} case '{{{classname}}}': {{#isEnum}} - return {{{classname}}}TypeTransformer().decode(value); + {{#native_serialization}}return {{{classname}}}TypeTransformer().decode(value);{{/native_serialization}} + {{#json_serializable}} return _$enumDecode(_${{{classname}}}EnumMap, value);{{/json_serializable}} {{/isEnum}} {{^isEnum}} return {{{classname}}}.fromJson(value); diff --git a/modules/openapi-generator/src/main/resources/dart2/api_helper.mustache b/modules/openapi-generator/src/main/resources/dart2/api_helper.mustache index 4ca7af11651..823829acd9c 100644 --- a/modules/openapi-generator/src/main/resources/dart2/api_helper.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/api_helper.mustache @@ -53,7 +53,8 @@ String parameterToString(dynamic value) { {{#model}} {{#isEnum}} if (value is {{{classname}}}) { - return {{{classname}}}TypeTransformer().encode(value).toString(); +{{#native_serialization}} return {{{classname}}}TypeTransformer().encode(value).toString();{{/native_serialization}} +{{#json_serializable}} return _${{{classname}}}EnumMap[value];{{/json_serializable}} } {{/isEnum}} {{/model}} diff --git a/modules/openapi-generator/src/main/resources/dart2/apilib.mustache b/modules/openapi-generator/src/main/resources/dart2/apilib.mustache index 5329912c5a2..e17f4ed139a 100644 --- a/modules/openapi-generator/src/main/resources/dart2/apilib.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/apilib.mustache @@ -7,7 +7,11 @@ import 'dart:io'; import 'package:http/http.dart'; import 'package:intl/intl.dart'; + import 'package:meta/meta.dart'; +{{#json_serializable}} +import 'package:json_annotation/json_annotation.dart'; +{{/json_serializable}} part 'api_client.dart'; part 'api_helper.dart'; @@ -22,6 +26,10 @@ part 'auth/http_bearer_auth.dart'; {{/apis}}{{/apiInfo}} {{#models}}{{#model}}part 'model/{{{classFilename}}}.dart'; {{/model}}{{/models}} + +{{#json_serializable}} +part 'api.g.dart'; +{{/json_serializable}} const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; const _dateEpochMarker = 'epoch'; final _dateFormatter = DateFormat('yyyy-MM-dd'); diff --git a/modules/openapi-generator/src/main/resources/dart2/build.yaml.mustache b/modules/openapi-generator/src/main/resources/dart2/build.yaml.mustache new file mode 100644 index 00000000000..b5399b955db --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart2/build.yaml.mustache @@ -0,0 +1,19 @@ +targets: + $default: + builders: + json_serializable: + options: + # Options configure how source code is generated for every + # `@JsonSerializable`-annotated class in the package. + # + # The default value for each is listed. + any_map: false + checked: true + create_factory: true + create_to_json: true + disallow_unrecognized_keys: true + explicit_to_json: true + field_rename: none + ignore_unannotated: false + include_if_null: false + nullable: true diff --git a/modules/openapi-generator/src/main/resources/dart2/class.mustache b/modules/openapi-generator/src/main/resources/dart2/class.mustache index 1f2397923d6..636aab61b89 100644 --- a/modules/openapi-generator/src/main/resources/dart2/class.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/class.mustache @@ -1,3 +1,11 @@ +{{#json_serializable}} +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +{{/json_serializable}} class {{{classname}}} { /// Returns a new [{{{classname}}}] instance. {{{classname}}}({ @@ -10,6 +18,7 @@ class {{{classname}}} { {{/vars}} }); +{{^json_serializable}} {{#vars}} {{#description}} /// {{{description}}} @@ -25,6 +34,34 @@ class {{{classname}}} { {{{datatypeWithEnum}}} {{{name}}}; {{/vars}} +{{/json_serializable}} +{{#json_serializable}} +{{#vars}} + {{#description}} + /// {{{description}}} + {{/description}} + {{^isEnum}} + {{#minimum}} + // minimum: {{{minimum}}} + {{/minimum}} + {{#maximum}} + // maximum: {{{maximum}}} + {{/maximum}} + {{/isEnum}} + {{^isBinary}} + @JsonKey( + nullable: {{#nullable}}true{{/nullable}}{{^nullable}}false{{/nullable}}, + name: r'{{{baseName}}}', + required: {{#required}}true{{/required}}{{^required}}false{{/required}}, + ) + {{/isBinary}} + {{#isBinary}} + @JsonKey(ignore: true) + {{/isBinary}} + {{{datatypeWithEnum}}} {{{name}}}; + +{{/vars}} +{{/json_serializable}} @override bool operator ==(Object other) => identical(this, other) || other is {{{classname}}} && {{#vars}} @@ -37,6 +74,7 @@ class {{{classname}}} { ({{{name}}} == null ? 0 : {{{name}}}.hashCode){{^-last}} +{{/-last}}{{#-last}};{{/-last}} {{/vars}} +{{^json_serializable}} @override String toString() => '{{{classname}}}[{{#vars}}{{{name}}}=${{{name}}}{{^-last}}, {{/-last}}{{/vars}}]'; @@ -218,6 +256,19 @@ class {{{classname}}} { } return map; } +{{/json_serializable}} +{{#json_serializable}} + + factory {{{classname}}}.fromJson(Map json) => _${{{classname}}}FromJson(json); + + Map toJson() => _${{{classname}}}ToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +{{/json_serializable}} } {{#vars}} {{#isEnum}} @@ -232,4 +283,4 @@ class {{{classname}}} { {{/mostInnerItems}} {{/isContainer}} {{/isEnum}} -{{/vars}} +{{/vars}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart2/enum.mustache b/modules/openapi-generator/src/main/resources/dart2/enum.mustache index d3ba3f350a8..6035ec4897e 100644 --- a/modules/openapi-generator/src/main/resources/dart2/enum.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/enum.mustache @@ -1,4 +1,5 @@ {{#description}}/// {{{description}}}{{/description}} +{{^json_serializable}} class {{{classname}}} { /// Instantiate a new enum with the provided [value]. const {{{classname}}}._(this.value); @@ -71,4 +72,12 @@ class {{{classname}}}TypeTransformer { /// Singleton [{{{classname}}}TypeTransformer] instance. static {{{classname}}}TypeTransformer _instance; -} \ No newline at end of file +}{{/json_serializable}}{{#json_serializable}} +enum {{{classname}}} { + {{#allowableValues}} + {{#enumVars}} + {{{name}}}, + {{/enumVars}} + {{/allowableValues}} +} +{{/json_serializable}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart2/enum_inline.mustache b/modules/openapi-generator/src/main/resources/dart2/enum_inline.mustache index d14c5a5648a..2aebe1b2a91 100644 --- a/modules/openapi-generator/src/main/resources/dart2/enum_inline.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/enum_inline.mustache @@ -1,4 +1,5 @@ {{#description}}/// {{{description}}}{{/description}} +{{^json_serializable}} class {{{enumName}}} { /// Instantiate a new enum with the provided [value]. const {{{enumName}}}._(this.value); @@ -71,4 +72,11 @@ class {{{enumName}}}TypeTransformer { /// Singleton [{{{enumName}}}TypeTransformer] instance. static {{{enumName}}}TypeTransformer _instance; -} \ No newline at end of file +}{{/json_serializable}}{{#json_serializable}} +enum {{{enumName}}} { +{{#allowableValues}} +{{#enumVars}} + {{{name}}}, +{{/enumVars}} +{{/allowableValues}} +}{{/json_serializable}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart2/pubspec.mustache b/modules/openapi-generator/src/main/resources/dart2/pubspec.mustache index c2389c89c4d..9de3cbd2314 100644 --- a/modules/openapi-generator/src/main/resources/dart2/pubspec.mustache +++ b/modules/openapi-generator/src/main/resources/dart2/pubspec.mustache @@ -14,5 +14,10 @@ dependencies: http: '>=0.12.0 <0.13.0' intl: '^0.16.1' meta: '^1.1.8' +{{#json_serializable}} + json_annotation: '^3.1.1'{{/json_serializable}} dev_dependencies: test: '>=1.3.0 <1.16.0' +{{#json_serializable}} + build_runner: '^1.0.0' + json_serializable: '^3.5.1'{{/json_serializable}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartClientOptionsProvider.java index 90d0ede4d00..464560449f0 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartClientOptionsProvider.java @@ -64,6 +64,7 @@ public class DartClientOptionsProvider implements OptionsProvider { .put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, PREPEND_FORM_OR_BODY_PARAMETERS_VALUE) .put(CodegenConstants.LEGACY_DISCRIMINATOR_BEHAVIOR, "true") .put(CodegenConstants.DISALLOW_ADDITIONAL_PROPERTIES_IF_NOT_PRESENT, "true") + .put("serializationLibrary", "custom") .build(); } diff --git a/samples/client/petstore/dart2/petstore_client_lib/lib/api.dart b/samples/client/petstore/dart2/petstore_client_lib/lib/api.dart index bfa6db0fd38..ba25916af59 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/lib/api.dart +++ b/samples/client/petstore/dart2/petstore_client_lib/lib/api.dart @@ -15,6 +15,7 @@ import 'dart:io'; import 'package:http/http.dart'; import 'package:intl/intl.dart'; + import 'package:meta/meta.dart'; part 'api_client.dart'; @@ -37,6 +38,7 @@ part 'model/pet.dart'; part 'model/tag.dart'; part 'model/user.dart'; + const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; const _dateEpochMarker = 'epoch'; final _dateFormatter = DateFormat('yyyy-MM-dd'); diff --git a/samples/client/petstore/dart2/petstore_client_lib/pubspec.yaml b/samples/client/petstore/dart2/petstore_client_lib/pubspec.yaml index a37ec11b632..06e77263172 100644 --- a/samples/client/petstore/dart2/petstore_client_lib/pubspec.yaml +++ b/samples/client/petstore/dart2/petstore_client_lib/pubspec.yaml @@ -14,5 +14,7 @@ dependencies: http: '>=0.12.0 <0.13.0' intl: '^0.16.1' meta: '^1.1.8' + dev_dependencies: test: '>=1.3.0 <1.16.0' + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api.dart index bfa6db0fd38..ba25916af59 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/lib/api.dart @@ -15,6 +15,7 @@ import 'dart:io'; import 'package:http/http.dart'; import 'package:intl/intl.dart'; + import 'package:meta/meta.dart'; part 'api_client.dart'; @@ -37,6 +38,7 @@ part 'model/pet.dart'; part 'model/tag.dart'; part 'model/user.dart'; + const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; const _dateEpochMarker = 'epoch'; final _dateFormatter = DateFormat('yyyy-MM-dd'); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib/pubspec.yaml b/samples/openapi3/client/petstore/dart2/petstore_client_lib/pubspec.yaml index a37ec11b632..06e77263172 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib/pubspec.yaml +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib/pubspec.yaml @@ -14,5 +14,7 @@ dependencies: http: '>=0.12.0 <0.13.0' intl: '^0.16.1' meta: '^1.1.8' + dev_dependencies: test: '>=1.3.0 <1.16.0' + diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart index 8d406863994..b54bf96e188 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart @@ -15,6 +15,7 @@ import 'dart:io'; import 'package:http/http.dart'; import 'package:intl/intl.dart'; + import 'package:meta/meta.dart'; part 'api_client.dart'; @@ -78,6 +79,7 @@ part 'model/special_model_name.dart'; part 'model/tag.dart'; part 'model/user.dart'; + const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; const _dateEpochMarker = 'epoch'; final _dateFormatter = DateFormat('yyyy-MM-dd'); diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart index 585c9038dea..864e189b21a 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart @@ -201,6 +201,7 @@ class ApiClient { return EnumArrays.fromJson(value); case 'EnumClass': return EnumClassTypeTransformer().decode(value); + case 'EnumTest': return EnumTest.fromJson(value); case 'FileSchemaTestClass': @@ -241,12 +242,16 @@ class ApiClient { return OuterComposite.fromJson(value); case 'OuterEnum': return OuterEnumTypeTransformer().decode(value); + case 'OuterEnumDefaultValue': return OuterEnumDefaultValueTypeTransformer().decode(value); + case 'OuterEnumInteger': return OuterEnumIntegerTypeTransformer().decode(value); + case 'OuterEnumIntegerDefaultValue': return OuterEnumIntegerDefaultValueTypeTransformer().decode(value); + case 'Pet': return Pet.fromJson(value); case 'ReadOnlyFirst': diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_helper.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_helper.dart index ececff49c4c..d307b920991 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_helper.dart +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_helper.dart @@ -60,18 +60,23 @@ String parameterToString(dynamic value) { } if (value is EnumClass) { return EnumClassTypeTransformer().encode(value).toString(); + } if (value is OuterEnum) { return OuterEnumTypeTransformer().encode(value).toString(); + } if (value is OuterEnumDefaultValue) { return OuterEnumDefaultValueTypeTransformer().encode(value).toString(); + } if (value is OuterEnumInteger) { return OuterEnumIntegerTypeTransformer().encode(value).toString(); + } if (value is OuterEnumIntegerDefaultValue) { return OuterEnumIntegerDefaultValueTypeTransformer().encode(value).toString(); + } return value.toString(); } diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pubspec.yaml b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pubspec.yaml index a37ec11b632..06e77263172 100644 --- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pubspec.yaml +++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/pubspec.yaml @@ -14,5 +14,7 @@ dependencies: http: '>=0.12.0 <0.13.0' intl: '^0.16.1' meta: '^1.1.8' + dev_dependencies: test: '>=1.3.0 <1.16.0' + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.gitignore b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.gitignore new file mode 100644 index 00000000000..7c280441649 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.gitignore @@ -0,0 +1,27 @@ +# See https://www.dartlang.org/tools/private-files.html + +# Files and directories created by pub +.buildlog +.packages +.project +.pub/ +build/ +**/packages/ + +# Files created by dart2js +# (Most Dart developers will use pub build to compile Dart, use/modify these +# rules if you intend to use dart2js directly +# Convention is to use extension '.dart.js' for Dart compiled to Javascript to +# differentiate from explicit Javascript files) +*.dart.js +*.part.js +*.js.deps +*.js.map +*.info.json + +# Directory created by dartdoc +doc/api/ + +# Don't commit pubspec lock file +# (Library packages only! Remove pattern if developing an application package) +pubspec.lock diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator-ignore b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.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/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator/FILES new file mode 100644 index 00000000000..22ebe91a520 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator/FILES @@ -0,0 +1,115 @@ +.gitignore +.travis.yml +README.md +build.yaml +doc/AdditionalPropertiesClass.md +doc/Animal.md +doc/AnotherFakeApi.md +doc/ApiResponse.md +doc/ArrayOfArrayOfNumberOnly.md +doc/ArrayOfNumberOnly.md +doc/ArrayTest.md +doc/Capitalization.md +doc/Cat.md +doc/CatAllOf.md +doc/Category.md +doc/ClassModel.md +doc/DefaultApi.md +doc/Dog.md +doc/DogAllOf.md +doc/EnumArrays.md +doc/EnumClass.md +doc/EnumTest.md +doc/FakeApi.md +doc/FakeClassnameTags123Api.md +doc/FileSchemaTestClass.md +doc/Foo.md +doc/FormatTest.md +doc/HasOnlyReadOnly.md +doc/HealthCheckResult.md +doc/InlineResponseDefault.md +doc/MapTest.md +doc/MixedPropertiesAndAdditionalPropertiesClass.md +doc/Model200Response.md +doc/ModelClient.md +doc/ModelFile.md +doc/ModelList.md +doc/ModelReturn.md +doc/Name.md +doc/NullableClass.md +doc/NumberOnly.md +doc/Order.md +doc/OuterComposite.md +doc/OuterEnum.md +doc/OuterEnumDefaultValue.md +doc/OuterEnumInteger.md +doc/OuterEnumIntegerDefaultValue.md +doc/Pet.md +doc/PetApi.md +doc/ReadOnlyFirst.md +doc/SpecialModelName.md +doc/StoreApi.md +doc/Tag.md +doc/User.md +doc/UserApi.md +git_push.sh +lib/api.dart +lib/api/another_fake_api.dart +lib/api/default_api.dart +lib/api/fake_api.dart +lib/api/fake_classname_tags123_api.dart +lib/api/pet_api.dart +lib/api/store_api.dart +lib/api/user_api.dart +lib/api_client.dart +lib/api_exception.dart +lib/api_helper.dart +lib/auth/api_key_auth.dart +lib/auth/authentication.dart +lib/auth/http_basic_auth.dart +lib/auth/http_bearer_auth.dart +lib/auth/oauth.dart +lib/model/additional_properties_class.dart +lib/model/animal.dart +lib/model/api_response.dart +lib/model/array_of_array_of_number_only.dart +lib/model/array_of_number_only.dart +lib/model/array_test.dart +lib/model/capitalization.dart +lib/model/cat.dart +lib/model/cat_all_of.dart +lib/model/category.dart +lib/model/class_model.dart +lib/model/dog.dart +lib/model/dog_all_of.dart +lib/model/enum_arrays.dart +lib/model/enum_class.dart +lib/model/enum_test.dart +lib/model/file_schema_test_class.dart +lib/model/foo.dart +lib/model/format_test.dart +lib/model/has_only_read_only.dart +lib/model/health_check_result.dart +lib/model/inline_response_default.dart +lib/model/map_test.dart +lib/model/mixed_properties_and_additional_properties_class.dart +lib/model/model200_response.dart +lib/model/model_client.dart +lib/model/model_file.dart +lib/model/model_list.dart +lib/model/model_return.dart +lib/model/name.dart +lib/model/nullable_class.dart +lib/model/number_only.dart +lib/model/order.dart +lib/model/outer_composite.dart +lib/model/outer_enum.dart +lib/model/outer_enum_default_value.dart +lib/model/outer_enum_integer.dart +lib/model/outer_enum_integer_default_value.dart +lib/model/pet.dart +lib/model/read_only_first.dart +lib/model/special_model_name.dart +lib/model/tag.dart +lib/model/user.dart +pubspec.yaml diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator/VERSION b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator/VERSION new file mode 100644 index 00000000000..c30f0ec2be7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator/VERSION @@ -0,0 +1 @@ +5.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.travis.yml b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.travis.yml new file mode 100644 index 00000000000..1a3af66d54c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.travis.yml @@ -0,0 +1,14 @@ +# +# AUTO-GENERATED FILE, DO NOT MODIFY! +# +# https://docs.travis-ci.com/user/languages/dart/ +# +language: dart +dart: +# Install a specific stable release +- "2.2.0" +install: +- pub get + +script: +- pub run test diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/README.md new file mode 100644 index 00000000000..6e050e1ead8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/README.md @@ -0,0 +1,189 @@ +# openapi +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 Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 1.0.0 +- Build package: org.openapitools.codegen.languages.DartClientCodegen + +## Requirements + +Dart 2.0 or later + +## Installation & Usage + +### Github +If this Dart package is published to Github, add the following dependency to your pubspec.yaml +``` +dependencies: + openapi: + git: https://github.com/GIT_USER_ID/GIT_REPO_ID.git +``` + +### Local +To use the package in your local drive, add the following dependency to your pubspec.yaml +``` +dependencies: + openapi: + path: /path/to/openapi +``` + +## Tests + +TODO + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```dart +import 'package:openapi/api.dart'; + + +final api_instance = AnotherFakeApi(); +final modelClient = ModelClient(); // ModelClient | client model + +try { + final result = api_instance.call123testSpecialTags(modelClient); + print(result); +} catch (e) { + print('Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n'); +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AnotherFakeApi* | [**call123testSpecialTags**](doc//AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +*DefaultApi* | [**fooGet**](doc//DefaultApi.md#fooget) | **GET** /foo | +*FakeApi* | [**fakeHealthGet**](doc//FakeApi.md#fakehealthget) | **GET** /fake/health | Health check endpoint +*FakeApi* | [**fakeHttpSignatureTest**](doc//FakeApi.md#fakehttpsignaturetest) | **GET** /fake/http-signature-test | test http signature authentication +*FakeApi* | [**fakeOuterBooleanSerialize**](doc//FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +*FakeApi* | [**fakeOuterCompositeSerialize**](doc//FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +*FakeApi* | [**fakeOuterNumberSerialize**](doc//FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | +*FakeApi* | [**fakeOuterStringSerialize**](doc//FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | +*FakeApi* | [**testBodyWithFileSchema**](doc//FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | +*FakeApi* | [**testBodyWithQueryParams**](doc//FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | +*FakeApi* | [**testClientModel**](doc//FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model +*FakeApi* | [**testEndpointParameters**](doc//FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +*FakeApi* | [**testEnumParameters**](doc//FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters +*FakeApi* | [**testGroupParameters**](doc//FakeApi.md#testgroupparameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +*FakeApi* | [**testInlineAdditionalProperties**](doc//FakeApi.md#testinlineadditionalproperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +*FakeApi* | [**testJsonFormData**](doc//FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data +*FakeApi* | [**testQueryParameterCollectionFormat**](doc//FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-paramters | +*FakeClassnameTags123Api* | [**testClassname**](doc//FakeClassnameTags123Api.md#testclassname) | **PATCH** /fake_classname_test | To test class name in snake case +*PetApi* | [**addPet**](doc//PetApi.md#addpet) | **POST** /pet | Add a new pet to the store +*PetApi* | [**deletePet**](doc//PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet +*PetApi* | [**findPetsByStatus**](doc//PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status +*PetApi* | [**findPetsByTags**](doc//PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags +*PetApi* | [**getPetById**](doc//PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetApi* | [**updatePet**](doc//PetApi.md#updatepet) | **PUT** /pet | Update an existing pet +*PetApi* | [**updatePetWithForm**](doc//PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**uploadFile**](doc//PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**uploadFileWithRequiredFile**](doc//PetApi.md#uploadfilewithrequiredfile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) +*StoreApi* | [**deleteOrder**](doc//StoreApi.md#deleteorder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +*StoreApi* | [**getInventory**](doc//StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +*StoreApi* | [**getOrderById**](doc//StoreApi.md#getorderbyid) | **GET** /store/order/{order_id} | Find purchase order by ID +*StoreApi* | [**placeOrder**](doc//StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet +*UserApi* | [**createUser**](doc//UserApi.md#createuser) | **POST** /user | Create user +*UserApi* | [**createUsersWithArrayInput**](doc//UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**createUsersWithListInput**](doc//UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**deleteUser**](doc//UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**getUserByName**](doc//UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +*UserApi* | [**loginUser**](doc//UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +*UserApi* | [**logoutUser**](doc//UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**updateUser**](doc//UserApi.md#updateuser) | **PUT** /user/{username} | Updated user + + +## Documentation For Models + + - [AdditionalPropertiesClass](doc//AdditionalPropertiesClass.md) + - [Animal](doc//Animal.md) + - [ApiResponse](doc//ApiResponse.md) + - [ArrayOfArrayOfNumberOnly](doc//ArrayOfArrayOfNumberOnly.md) + - [ArrayOfNumberOnly](doc//ArrayOfNumberOnly.md) + - [ArrayTest](doc//ArrayTest.md) + - [Capitalization](doc//Capitalization.md) + - [Cat](doc//Cat.md) + - [CatAllOf](doc//CatAllOf.md) + - [Category](doc//Category.md) + - [ClassModel](doc//ClassModel.md) + - [Dog](doc//Dog.md) + - [DogAllOf](doc//DogAllOf.md) + - [EnumArrays](doc//EnumArrays.md) + - [EnumClass](doc//EnumClass.md) + - [EnumTest](doc//EnumTest.md) + - [FileSchemaTestClass](doc//FileSchemaTestClass.md) + - [Foo](doc//Foo.md) + - [FormatTest](doc//FormatTest.md) + - [HasOnlyReadOnly](doc//HasOnlyReadOnly.md) + - [HealthCheckResult](doc//HealthCheckResult.md) + - [InlineResponseDefault](doc//InlineResponseDefault.md) + - [MapTest](doc//MapTest.md) + - [MixedPropertiesAndAdditionalPropertiesClass](doc//MixedPropertiesAndAdditionalPropertiesClass.md) + - [Model200Response](doc//Model200Response.md) + - [ModelClient](doc//ModelClient.md) + - [ModelFile](doc//ModelFile.md) + - [ModelList](doc//ModelList.md) + - [ModelReturn](doc//ModelReturn.md) + - [Name](doc//Name.md) + - [NullableClass](doc//NullableClass.md) + - [NumberOnly](doc//NumberOnly.md) + - [Order](doc//Order.md) + - [OuterComposite](doc//OuterComposite.md) + - [OuterEnum](doc//OuterEnum.md) + - [OuterEnumDefaultValue](doc//OuterEnumDefaultValue.md) + - [OuterEnumInteger](doc//OuterEnumInteger.md) + - [OuterEnumIntegerDefaultValue](doc//OuterEnumIntegerDefaultValue.md) + - [Pet](doc//Pet.md) + - [ReadOnlyFirst](doc//ReadOnlyFirst.md) + - [SpecialModelName](doc//SpecialModelName.md) + - [Tag](doc//Tag.md) + - [User](doc//User.md) + + +## Documentation For Authorization + + +## 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 + +## bearer_test + +- **Type**: HTTP Bearer authentication + +## http_basic_test + +- **Type**: HTTP Basic authentication + +## http_signature_test + + +## 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 + + +## Author + + + + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/build.yaml b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/build.yaml new file mode 100644 index 00000000000..b5399b955db --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/build.yaml @@ -0,0 +1,19 @@ +targets: + $default: + builders: + json_serializable: + options: + # Options configure how source code is generated for every + # `@JsonSerializable`-annotated class in the package. + # + # The default value for each is listed. + any_map: false + checked: true + create_factory: true + create_to_json: true + disallow_unrecognized_keys: true + explicit_to_json: true + field_rename: none + ignore_unannotated: false + include_if_null: false + nullable: true diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/AdditionalPropertiesClass.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/AdditionalPropertiesClass.md new file mode 100644 index 00000000000..859d4d0b7a0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/AdditionalPropertiesClass.md @@ -0,0 +1,16 @@ +# openapi.model.AdditionalPropertiesClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapProperty** | **Map** | | [optional] [default to const {}] +**mapOfMapProperty** | [**Map>**](Map.md) | | [optional] [default to const {}] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/Animal.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Animal.md new file mode 100644 index 00000000000..415b56e9bc2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Animal.md @@ -0,0 +1,16 @@ +# openapi.model.Animal + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] [default to 'red'] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/AnotherFakeApi.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/AnotherFakeApi.md new file mode 100644 index 00000000000..c3781f38137 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/AnotherFakeApi.md @@ -0,0 +1,57 @@ +# openapi.api.AnotherFakeApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**call123testSpecialTags**](AnotherFakeApi.md#call123testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags + + +# **call123testSpecialTags** +> ModelClient call123testSpecialTags(modelClient) + +To test special tags + +To test special tags and operation ID starting with number + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = AnotherFakeApi(); +final modelClient = ModelClient(); // ModelClient | client model + +try { + final result = api_instance.call123testSpecialTags(modelClient); + print(result); +} catch (e) { + print('Exception when calling AnotherFakeApi->call123testSpecialTags: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **modelClient** | [**ModelClient**](ModelClient.md)| client model | + +### Return type + +[**ModelClient**](ModelClient.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/ApiResponse.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ApiResponse.md new file mode 100644 index 00000000000..7ad5da0f89e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ApiResponse.md @@ -0,0 +1,17 @@ +# openapi.model.ApiResponse + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | [optional] +**type** | **String** | | [optional] +**message** | **String** | | [optional] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 00000000000..0a0dc2a7b75 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.ArrayOfArrayOfNumberOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayArrayNumber** | [**List>**](List.md) | | [optional] [default to const []] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/ArrayOfNumberOnly.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ArrayOfNumberOnly.md new file mode 100644 index 00000000000..01b6f58870f --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ArrayOfNumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.ArrayOfNumberOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayNumber** | **List** | | [optional] [default to const []] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/ArrayTest.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ArrayTest.md new file mode 100644 index 00000000000..598a895bb20 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ArrayTest.md @@ -0,0 +1,17 @@ +# openapi.model.ArrayTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayOfString** | **List** | | [optional] [default to const []] +**arrayArrayOfInteger** | [**List>**](List.md) | | [optional] [default to const []] +**arrayArrayOfModel** | [**List>**](List.md) | | [optional] [default to const []] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/Capitalization.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Capitalization.md new file mode 100644 index 00000000000..4a07b4eb820 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Capitalization.md @@ -0,0 +1,20 @@ +# openapi.model.Capitalization + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**smallCamel** | **String** | | [optional] +**capitalCamel** | **String** | | [optional] +**smallSnake** | **String** | | [optional] +**capitalSnake** | **String** | | [optional] +**sCAETHFlowPoints** | **String** | | [optional] +**ATT_NAME** | **String** | Name of the pet | [optional] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/Cat.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Cat.md new file mode 100644 index 00000000000..6552eea4b43 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Cat.md @@ -0,0 +1,17 @@ +# openapi.model.Cat + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] [default to 'red'] +**declawed** | **bool** | | [optional] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/CatAllOf.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/CatAllOf.md new file mode 100644 index 00000000000..36b2ae0e8ab --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/CatAllOf.md @@ -0,0 +1,15 @@ +# openapi.model.CatAllOf + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | **bool** | | [optional] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/Category.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Category.md new file mode 100644 index 00000000000..ae6bc52e89d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Category.md @@ -0,0 +1,16 @@ +# openapi.model.Category + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **String** | | [default to 'default-name'] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/ClassModel.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ClassModel.md new file mode 100644 index 00000000000..13ae5d3a470 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ClassModel.md @@ -0,0 +1,15 @@ +# openapi.model.ClassModel + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**class_** | **String** | | [optional] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/DefaultApi.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/DefaultApi.md new file mode 100644 index 00000000000..fb0ca9b2012 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/DefaultApi.md @@ -0,0 +1,51 @@ +# openapi.api.DefaultApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fooGet**](DefaultApi.md#fooGet) | **GET** /foo | + + +# **fooGet** +> InlineResponseDefault fooGet() + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = DefaultApi(); + +try { + final result = api_instance.fooGet(); + print(result); +} catch (e) { + print('Exception when calling DefaultApi->fooGet: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**InlineResponseDefault**](InlineResponseDefault.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/Dog.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Dog.md new file mode 100644 index 00000000000..d36439b767b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Dog.md @@ -0,0 +1,17 @@ +# openapi.model.Dog + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] [default to 'red'] +**breed** | **String** | | [optional] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/DogAllOf.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/DogAllOf.md new file mode 100644 index 00000000000..97a7c8fba49 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/DogAllOf.md @@ -0,0 +1,15 @@ +# openapi.model.DogAllOf + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | **String** | | [optional] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/EnumArrays.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/EnumArrays.md new file mode 100644 index 00000000000..2c12a0e6168 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/EnumArrays.md @@ -0,0 +1,16 @@ +# openapi.model.EnumArrays + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justSymbol** | **String** | | [optional] +**arrayEnum** | **List** | | [optional] [default to const []] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/EnumClass.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/EnumClass.md new file mode 100644 index 00000000000..a9ed4c1f0c8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/EnumClass.md @@ -0,0 +1,14 @@ +# openapi.model.EnumClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## 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/dart2/petstore_json_serializable_client_lib_fake/doc/EnumTest.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/EnumTest.md new file mode 100644 index 00000000000..7c24fe2347b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/EnumTest.md @@ -0,0 +1,22 @@ +# openapi.model.EnumTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enumString** | **String** | | [optional] +**enumStringRequired** | **String** | | +**enumInteger** | **int** | | [optional] +**enumNumber** | **double** | | [optional] +**outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] +**outerEnumInteger** | [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional] +**outerEnumDefaultValue** | [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] +**outerEnumIntegerDefaultValue** | [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/FakeApi.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeApi.md new file mode 100644 index 00000000000..d8dfaf9329c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeApi.md @@ -0,0 +1,725 @@ +# openapi.api.FakeApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fakeHealthGet**](FakeApi.md#fakeHealthGet) | **GET** /fake/health | Health check endpoint +[**fakeHttpSignatureTest**](FakeApi.md#fakeHttpSignatureTest) | **GET** /fake/http-signature-test | test http signature authentication +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +[**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | +[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | +[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model +[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +[**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters +[**testGroupParameters**](FakeApi.md#testGroupParameters) | **DELETE** /fake | Fake endpoint to test group parameters (optional) +[**testInlineAdditionalProperties**](FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties +[**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data +[**testQueryParameterCollectionFormat**](FakeApi.md#testQueryParameterCollectionFormat) | **PUT** /fake/test-query-paramters | + + +# **fakeHealthGet** +> HealthCheckResult fakeHealthGet() + +Health check endpoint + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); + +try { + final result = api_instance.fakeHealthGet(); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakeHealthGet: $e\n'); +} +``` + +### 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 + +[[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) + +# **fakeHttpSignatureTest** +> fakeHttpSignatureTest(pet, query1, header1) + +test http signature authentication + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final pet = Pet(); // Pet | Pet object that needs to be added to the store +final query1 = query1_example; // String | query parameter +final header1 = header1_example; // String | header parameter + +try { + api_instance.fakeHttpSignatureTest(pet, query1, header1); +} catch (e) { + print('Exception when calling FakeApi->fakeHttpSignatureTest: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **query1** | **String**| query parameter | [optional] + **header1** | **String**| 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 + +[[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) + +# **fakeOuterBooleanSerialize** +> bool fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final body = bool(); // bool | Input boolean as post body + +try { + final result = api_instance.fakeOuterBooleanSerialize(body); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakeOuterBooleanSerialize: $e\n'); +} +``` + +### 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**: */* + +[[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) + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(outerComposite) + + + +Test serialization of object with outer number type + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final outerComposite = OuterComposite(); // OuterComposite | Input composite as post body + +try { + final result = api_instance.fakeOuterCompositeSerialize(outerComposite); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakeOuterCompositeSerialize: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **outerComposite** | [**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**: */* + +[[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) + +# **fakeOuterNumberSerialize** +> num fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final body = num(); // num | Input number as post body + +try { + final result = api_instance.fakeOuterNumberSerialize(body); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakeOuterNumberSerialize: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **num**| Input number as post body | [optional] + +### Return type + +**num** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[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) + +# **fakeOuterStringSerialize** +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final body = String(); // String | Input string as post body + +try { + final result = api_instance.fakeOuterStringSerialize(body); + print(result); +} catch (e) { + print('Exception when calling FakeApi->fakeOuterStringSerialize: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **String**| Input string as post body | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + +[[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) + +# **testBodyWithFileSchema** +> testBodyWithFileSchema(fileSchemaTestClass) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final fileSchemaTestClass = FileSchemaTestClass(); // FileSchemaTestClass | + +try { + api_instance.testBodyWithFileSchema(fileSchemaTestClass); +} catch (e) { + print('Exception when calling FakeApi->testBodyWithFileSchema: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[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) + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(query, user) + + + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final query = query_example; // String | +final user = User(); // User | + +try { + api_instance.testBodyWithQueryParams(query, user); +} catch (e) { + print('Exception when calling FakeApi->testBodyWithQueryParams: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query** | **String**| | + **user** | [**User**](User.md)| | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[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) + +# **testClientModel** +> ModelClient testClientModel(modelClient) + +To test \"client\" model + +To test \"client\" model + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final modelClient = ModelClient(); // ModelClient | client model + +try { + final result = api_instance.testClientModel(modelClient); + print(result); +} catch (e) { + print('Exception when calling FakeApi->testClientModel: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **modelClient** | [**ModelClient**](ModelClient.md)| client model | + +### Return type + +[**ModelClient**](ModelClient.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[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) + +# **testEndpointParameters** +> testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback) + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure HTTP basic authorization: http_basic_test +//defaultApiClient.getAuthentication('http_basic_test').username = 'YOUR_USERNAME' +//defaultApiClient.getAuthentication('http_basic_test').password = 'YOUR_PASSWORD'; + +final api_instance = FakeApi(); +final number = 8.14; // num | None +final double_ = 1.2; // double | None +final patternWithoutDelimiter = patternWithoutDelimiter_example; // String | None +final byte = BYTE_ARRAY_DATA_HERE; // String | None +final integer = 56; // int | None +final int32 = 56; // int | None +final int64 = 789; // int | None +final float = 3.4; // double | None +final string = string_example; // String | None +final binary = BINARY_DATA_HERE; // MultipartFile | None +final date = 2013-10-20; // DateTime | None +final dateTime = 2013-10-20T19:20:30+01:00; // DateTime | None +final password = password_example; // String | None +final callback = callback_example; // String | None + +try { + api_instance.testEndpointParameters(number, double_, patternWithoutDelimiter, byte, integer, int32, int64, float, string, binary, date, dateTime, password, callback); +} catch (e) { + print('Exception when calling FakeApi->testEndpointParameters: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **num**| None | + **double_** | **double**| None | + **patternWithoutDelimiter** | **String**| None | + **byte** | **String**| None | + **integer** | **int**| None | [optional] + **int32** | **int**| None | [optional] + **int64** | **int**| None | [optional] + **float** | **double**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **MultipartFile**| None | [optional] + **date** | **DateTime**| None | [optional] + **dateTime** | **DateTime**| None | [optional] + **password** | **String**| None | [optional] + **callback** | **String**| 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 + +[[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) + +# **testEnumParameters** +> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) + +To test enum parameters + +To test enum parameters + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final enumHeaderStringArray = []; // List | Header parameter enum test (string array) +final enumHeaderString = enumHeaderString_example; // String | Header parameter enum test (string) +final enumQueryStringArray = []; // List | Query parameter enum test (string array) +final enumQueryString = enumQueryString_example; // String | Query parameter enum test (string) +final enumQueryInteger = 56; // int | Query parameter enum test (double) +final enumQueryDouble = 1.2; // double | Query parameter enum test (double) +final enumFormStringArray = [enumFormStringArray_example]; // List | Form parameter enum test (string array) +final enumFormString = enumFormString_example; // String | Form parameter enum test (string) + +try { + api_instance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); +} catch (e) { + print('Exception when calling FakeApi->testEnumParameters: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumHeaderStringArray** | [**List**](String.md)| Header parameter enum test (string array) | [optional] [default to const []] + **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to '-efg'] + **enumQueryStringArray** | [**List**](String.md)| Query parameter enum test (string array) | [optional] [default to const []] + **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to '-efg'] + **enumQueryInteger** | **int**| Query parameter enum test (double) | [optional] + **enumQueryDouble** | **double**| Query parameter enum test (double) | [optional] + **enumFormStringArray** | [**List**](String.md)| Form parameter enum test (string array) | [optional] [default to '$'] + **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to '-efg'] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[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) + +# **testGroupParameters** +> testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group) + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure HTTP Bearer authorization: bearer_test +// Case 1. Use String Token +//defaultApiClient.getAuthentication('bearer_test').setAccessToken('YOUR_ACCESS_TOKEN'); +// Case 2. Use Function which generate token. +// String yourTokenGeneratorFunction() { ... } +//defaultApiClient.getAuthentication('bearer_test').setAccessToken(yourTokenGeneratorFunction); + +final api_instance = FakeApi(); +final requiredStringGroup = 56; // int | Required String in group parameters +final requiredBooleanGroup = true; // bool | Required Boolean in group parameters +final requiredInt64Group = 789; // int | Required Integer in group parameters +final stringGroup = 56; // int | String in group parameters +final booleanGroup = true; // bool | Boolean in group parameters +final int64Group = 789; // int | Integer in group parameters + +try { + api_instance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); +} catch (e) { + print('Exception when calling FakeApi->testGroupParameters: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requiredStringGroup** | **int**| Required String in group parameters | + **requiredBooleanGroup** | **bool**| Required Boolean in group parameters | + **requiredInt64Group** | **int**| Required Integer in group parameters | + **stringGroup** | **int**| String in group parameters | [optional] + **booleanGroup** | **bool**| Boolean in group parameters | [optional] + **int64Group** | **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 + +[[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) + +# **testInlineAdditionalProperties** +> testInlineAdditionalProperties(requestBody) + +test inline additionalProperties + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final requestBody = Map(); // Map | request body + +try { + api_instance.testInlineAdditionalProperties(requestBody); +} catch (e) { + print('Exception when calling FakeApi->testInlineAdditionalProperties: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**Map**](String.md)| request body | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[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) + +# **testJsonFormData** +> testJsonFormData(param, param2) + +test json serialization of form data + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final param = param_example; // String | field1 +final param2 = param2_example; // String | field2 + +try { + api_instance.testJsonFormData(param, param2); +} catch (e) { + print('Exception when calling FakeApi->testJsonFormData: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | **String**| field1 | + **param2** | **String**| field2 | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + +[[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) + +# **testQueryParameterCollectionFormat** +> testQueryParameterCollectionFormat(pipe, ioutil, http, url, context) + + + +To test the collection format in query parameters + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = FakeApi(); +final pipe = []; // List | +final ioutil = []; // List | +final http = []; // List | +final url = []; // List | +final context = []; // List | + +try { + api_instance.testQueryParameterCollectionFormat(pipe, ioutil, http, url, context); +} catch (e) { + print('Exception when calling FakeApi->testQueryParameterCollectionFormat: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pipe** | [**List**](String.md)| | [default to const []] + **ioutil** | [**List**](String.md)| | [default to const []] + **http** | [**List**](String.md)| | [default to const []] + **url** | [**List**](String.md)| | [default to const []] + **context** | [**List**](String.md)| | [default to const []] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeClassnameTags123Api.md new file mode 100644 index 00000000000..e1045471420 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeClassnameTags123Api.md @@ -0,0 +1,61 @@ +# openapi.api.FakeClassnameTags123Api + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testClassname**](FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case + + +# **testClassname** +> ModelClient testClassname(modelClient) + +To test class name in snake case + +To test class name in snake case + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key_query +//defaultApiClient.getAuthentication('api_key_query').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key_query').apiKeyPrefix = 'Bearer'; + +final api_instance = FakeClassnameTags123Api(); +final modelClient = ModelClient(); // ModelClient | client model + +try { + final result = api_instance.testClassname(modelClient); + print(result); +} catch (e) { + print('Exception when calling FakeClassnameTags123Api->testClassname: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **modelClient** | [**ModelClient**](ModelClient.md)| client model | + +### Return type + +[**ModelClient**](ModelClient.md) + +### Authorization + +[api_key_query](../README.md#api_key_query) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/FileSchemaTestClass.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FileSchemaTestClass.md new file mode 100644 index 00000000000..eae1dfbe979 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FileSchemaTestClass.md @@ -0,0 +1,16 @@ +# openapi.model.FileSchemaTestClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | [**ModelFile**](ModelFile.md) | | [optional] +**files** | [**List**](ModelFile.md) | | [optional] [default to const []] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/Foo.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Foo.md new file mode 100644 index 00000000000..185b76e3f5b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Foo.md @@ -0,0 +1,15 @@ +# openapi.model.Foo + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [default to 'bar'] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/FormatTest.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FormatTest.md new file mode 100644 index 00000000000..83b60545eb6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FormatTest.md @@ -0,0 +1,30 @@ +# openapi.model.FormatTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **int** | | [optional] +**int32** | **int** | | [optional] +**int64** | **int** | | [optional] +**number** | **num** | | +**float** | **double** | | [optional] +**double_** | **double** | | [optional] +**decimal** | **double** | | [optional] +**string** | **String** | | [optional] +**byte** | **String** | | +**binary** | [**MultipartFile**](MultipartFile.md) | | [optional] +**date** | [**DateTime**](DateTime.md) | | +**dateTime** | [**DateTime**](DateTime.md) | | [optional] +**uuid** | **String** | | [optional] +**password** | **String** | | +**patternWithDigits** | **String** | A string that is a 10 digit number. Can have leading zeros. | [optional] +**patternWithDigitsAndDelimiter** | **String** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/HasOnlyReadOnly.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/HasOnlyReadOnly.md new file mode 100644 index 00000000000..f2d30e9fb68 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/HasOnlyReadOnly.md @@ -0,0 +1,16 @@ +# openapi.model.HasOnlyReadOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [readonly] +**foo** | **String** | | [optional] [readonly] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/HealthCheckResult.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/HealthCheckResult.md new file mode 100644 index 00000000000..4d6aeb75d96 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/HealthCheckResult.md @@ -0,0 +1,15 @@ +# openapi.model.HealthCheckResult + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nullableMessage** | **String** | | [optional] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/InlineResponseDefault.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/InlineResponseDefault.md new file mode 100644 index 00000000000..c5e61e1162b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/InlineResponseDefault.md @@ -0,0 +1,15 @@ +# openapi.model.InlineResponseDefault + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | [**Foo**](Foo.md) | | [optional] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/MapTest.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/MapTest.md new file mode 100644 index 00000000000..a1732207bfc --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/MapTest.md @@ -0,0 +1,18 @@ +# openapi.model.MapTest + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapMapOfString** | [**Map>**](Map.md) | | [optional] [default to const {}] +**mapOfEnumString** | **Map** | | [optional] [default to const {}] +**directMap** | **Map** | | [optional] [default to const {}] +**indirectMap** | **Map** | | [optional] [default to const {}] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 00000000000..1f7f66b684f --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,17 @@ +# openapi.model.MixedPropertiesAndAdditionalPropertiesClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | **String** | | [optional] +**dateTime** | [**DateTime**](DateTime.md) | | [optional] +**map** | [**Map**](Animal.md) | | [optional] [default to const {}] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/Model200Response.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Model200Response.md new file mode 100644 index 00000000000..5aa3fb97c32 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Model200Response.md @@ -0,0 +1,16 @@ +# openapi.model.Model200Response + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | [optional] +**class_** | **String** | | [optional] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/ModelClient.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelClient.md new file mode 100644 index 00000000000..f7b922f4a39 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelClient.md @@ -0,0 +1,15 @@ +# openapi.model.ModelClient + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**client** | **String** | | [optional] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/ModelFile.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelFile.md new file mode 100644 index 00000000000..4be260e93f6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelFile.md @@ -0,0 +1,15 @@ +# openapi.model.ModelFile + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sourceURI** | **String** | Test capitalization | [optional] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/ModelList.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelList.md new file mode 100644 index 00000000000..283aa1f6b71 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelList.md @@ -0,0 +1,15 @@ +# openapi.model.ModelList + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**n123list** | **String** | | [optional] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/ModelReturn.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelReturn.md new file mode 100644 index 00000000000..bc02df7a369 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ModelReturn.md @@ -0,0 +1,15 @@ +# openapi.model.ModelReturn + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**return_** | **int** | | [optional] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/Name.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Name.md new file mode 100644 index 00000000000..9da6e75fbf5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Name.md @@ -0,0 +1,18 @@ +# openapi.model.Name + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **int** | | +**snakeCase** | **int** | | [optional] [readonly] +**property** | **String** | | [optional] +**n123number** | **int** | | [optional] [readonly] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/NullableClass.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/NullableClass.md new file mode 100644 index 00000000000..9b2e46df0a0 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/NullableClass.md @@ -0,0 +1,26 @@ +# openapi.model.NullableClass + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integerProp** | **int** | | [optional] +**numberProp** | **num** | | [optional] +**booleanProp** | **bool** | | [optional] +**stringProp** | **String** | | [optional] +**dateProp** | [**DateTime**](DateTime.md) | | [optional] +**datetimeProp** | [**DateTime**](DateTime.md) | | [optional] +**arrayNullableProp** | [**List**](Object.md) | | [optional] [default to const []] +**arrayAndItemsNullableProp** | [**List**](Object.md) | | [optional] [default to const []] +**arrayItemsNullable** | [**List**](Object.md) | | [optional] [default to const []] +**objectNullableProp** | [**Map**](Object.md) | | [optional] [default to const {}] +**objectAndItemsNullableProp** | [**Map**](Object.md) | | [optional] [default to const {}] +**objectItemsNullable** | [**Map**](Object.md) | | [optional] [default to const {}] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/NumberOnly.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/NumberOnly.md new file mode 100644 index 00000000000..d8096a3db37 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/NumberOnly.md @@ -0,0 +1,15 @@ +# openapi.model.NumberOnly + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justNumber** | **num** | | [optional] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/Order.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Order.md new file mode 100644 index 00000000000..bde5ffe51a2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Order.md @@ -0,0 +1,20 @@ +# openapi.model.Order + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**petId** | **int** | | [optional] +**quantity** | **int** | | [optional] +**shipDate** | [**DateTime**](DateTime.md) | | [optional] +**status** | **String** | Order Status | [optional] +**complete** | **bool** | | [optional] [default to false] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/OuterComposite.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterComposite.md new file mode 100644 index 00000000000..04bab7eff5d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterComposite.md @@ -0,0 +1,17 @@ +# openapi.model.OuterComposite + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | **num** | | [optional] +**myString** | **String** | | [optional] +**myBoolean** | **bool** | | [optional] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnum.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnum.md new file mode 100644 index 00000000000..af62ad87ab2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnum.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnum + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## 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/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnumDefaultValue.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnumDefaultValue.md new file mode 100644 index 00000000000..c1bf8b0dec4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnumDefaultValue.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumDefaultValue + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## 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/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnumInteger.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnumInteger.md new file mode 100644 index 00000000000..8c80a9e5c85 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnumInteger.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumInteger + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## 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/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnumIntegerDefaultValue.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnumIntegerDefaultValue.md new file mode 100644 index 00000000000..eb8b55d7024 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,14 @@ +# openapi.model.OuterEnumIntegerDefaultValue + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## 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/dart2/petstore_json_serializable_client_lib_fake/doc/Pet.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Pet.md new file mode 100644 index 00000000000..b6fdea5299b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Pet.md @@ -0,0 +1,20 @@ +# openapi.model.Pet + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**category** | [**Category**](Category.md) | | [optional] +**name** | **String** | | +**photoUrls** | **Set** | | [default to const {}] +**tags** | [**List**](Tag.md) | | [optional] [default to const []] +**status** | **String** | pet status in the store | [optional] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/PetApi.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/PetApi.md new file mode 100644 index 00000000000..aeb082c9686 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/PetApi.md @@ -0,0 +1,427 @@ +# openapi.api.PetApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet +[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status +[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags +[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID +[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet +[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data +[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image +[**uploadFileWithRequiredFile**](PetApi.md#uploadFileWithRequiredFile) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) + + +# **addPet** +> addPet(pet) + +Add a new pet to the store + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = PetApi(); +final pet = Pet(); // Pet | Pet object that needs to be added to the store + +try { + api_instance.addPet(pet); +} catch (e) { + print('Exception when calling PetApi->addPet: $e\n'); +} +``` + +### 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 request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +[[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) + +# **deletePet** +> deletePet(petId, apiKey) + +Deletes a pet + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = PetApi(); +final petId = 789; // int | Pet id to delete +final apiKey = apiKey_example; // String | + +try { + api_instance.deletePet(petId, apiKey); +} catch (e) { + print('Exception when calling PetApi->deletePet: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| Pet id to delete | + **apiKey** | **String**| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[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) + +# **findPetsByStatus** +> List findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = PetApi(); +final status = []; // List | Status values that need to be considered for filter + +try { + final result = api_instance.findPetsByStatus(status); + print(result); +} catch (e) { + print('Exception when calling PetApi->findPetsByStatus: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**List**](String.md)| Status values that need to be considered for filter | [default to const []] + +### Return type + +[**List**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[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) + +# **findPetsByTags** +> Set findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = PetApi(); +final tags = []; // Set | Tags to filter by + +try { + final result = api_instance.findPetsByTags(tags); + print(result); +} catch (e) { + print('Exception when calling PetApi->findPetsByTags: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**Set**](String.md)| Tags to filter by | [default to const {}] + +### Return type + +[**Set**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[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) + +# **getPetById** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; + +final api_instance = PetApi(); +final petId = 789; // int | ID of pet to return + +try { + final result = api_instance.getPetById(petId); + print(result); +} catch (e) { + print('Exception when calling PetApi->getPetById: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **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 + +[[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) + +# **updatePet** +> updatePet(pet) + +Update an existing pet + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = PetApi(); +final pet = Pet(); // Pet | Pet object that needs to be added to the store + +try { + api_instance.updatePet(pet); +} catch (e) { + print('Exception when calling PetApi->updatePet: $e\n'); +} +``` + +### 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 request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + +[[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) + +# **updatePetWithForm** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = PetApi(); +final petId = 789; // int | ID of pet that needs to be updated +final name = name_example; // String | Updated name of the pet +final status = status_example; // String | Updated status of the pet + +try { + api_instance.updatePetWithForm(petId, name, status); +} catch (e) { + print('Exception when calling PetApi->updatePetWithForm: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet that needs to be updated | + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| 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 + +[[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) + +# **uploadFile** +> ApiResponse uploadFile(petId, additionalMetadata, file) + +uploads an image + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = PetApi(); +final petId = 789; // int | ID of pet to update +final additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server +final file = BINARY_DATA_HERE; // MultipartFile | file to upload + +try { + final result = api_instance.uploadFile(petId, additionalMetadata, file); + print(result); +} catch (e) { + print('Exception when calling PetApi->uploadFile: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to update | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **MultipartFile**| 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 + +[[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) + +# **uploadFileWithRequiredFile** +> ApiResponse uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) + +uploads an image (required) + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//defaultApiClient.getAuthentication('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN'; + +final api_instance = PetApi(); +final petId = 789; // int | ID of pet to update +final requiredFile = BINARY_DATA_HERE; // MultipartFile | file to upload +final additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server + +try { + final result = api_instance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + print(result); +} catch (e) { + print('Exception when calling PetApi->uploadFileWithRequiredFile: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to update | + **requiredFile** | **MultipartFile**| file to upload | + **additionalMetadata** | **String**| 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 + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/ReadOnlyFirst.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ReadOnlyFirst.md new file mode 100644 index 00000000000..fa6f9e4305d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/ReadOnlyFirst.md @@ -0,0 +1,16 @@ +# openapi.model.ReadOnlyFirst + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] [readonly] +**baz** | **String** | | [optional] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/SpecialModelName.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/SpecialModelName.md new file mode 100644 index 00000000000..5fcfa98e0b3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/SpecialModelName.md @@ -0,0 +1,15 @@ +# openapi.model.SpecialModelName + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket** | **int** | | [optional] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/StoreApi.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/StoreApi.md new file mode 100644 index 00000000000..258b08e898c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/StoreApi.md @@ -0,0 +1,186 @@ +# openapi.api.StoreApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID +[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status +[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID +[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet + + +# **deleteOrder** +> deleteOrder(orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = StoreApi(); +final orderId = orderId_example; // String | ID of the order that needs to be deleted + +try { + api_instance.deleteOrder(orderId); +} catch (e) { + print('Exception when calling StoreApi->deleteOrder: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **String**| 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 + +[[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) + +# **getInventory** +> Map getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; + +final api_instance = StoreApi(); + +try { + final result = api_instance.getInventory(); + print(result); +} catch (e) { + print('Exception when calling StoreApi->getInventory: $e\n'); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**Map** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[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) + +# **getOrderById** +> Order getOrderById(orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = StoreApi(); +final orderId = 789; // int | ID of pet that needs to be fetched + +try { + final result = api_instance.getOrderById(orderId); + print(result); +} catch (e) { + print('Exception when calling StoreApi->getOrderById: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **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 + +[[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) + +# **placeOrder** +> Order placeOrder(order) + +Place an order for a pet + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = StoreApi(); +final order = Order(); // Order | order placed for purchasing the pet + +try { + final result = api_instance.placeOrder(order); + print(result); +} catch (e) { + print('Exception when calling StoreApi->placeOrder: $e\n'); +} +``` + +### 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 + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/Tag.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Tag.md new file mode 100644 index 00000000000..c219f987c19 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/Tag.md @@ -0,0 +1,16 @@ +# openapi.model.Tag + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**name** | **String** | | [optional] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/User.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/User.md new file mode 100644 index 00000000000..fa87e64d859 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/User.md @@ -0,0 +1,22 @@ +# openapi.model.User + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] +**username** | **String** | | [optional] +**firstName** | **String** | | [optional] +**lastName** | **String** | | [optional] +**email** | **String** | | [optional] +**password** | **String** | | [optional] +**phone** | **String** | | [optional] +**userStatus** | **int** | User Status | [optional] + +[[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/dart2/petstore_json_serializable_client_lib_fake/doc/UserApi.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/UserApi.md new file mode 100644 index 00000000000..1fcc5faa1cb --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/UserApi.md @@ -0,0 +1,349 @@ +# openapi.api.UserApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createUser**](UserApi.md#createUser) | **POST** /user | Create user +[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user +[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name +[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system +[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session +[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user + + +# **createUser** +> createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = UserApi(); +final user = User(); // User | Created user object + +try { + api_instance.createUser(user); +} catch (e) { + print('Exception when calling UserApi->createUser: $e\n'); +} +``` + +### 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 + +[[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) + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(user) + +Creates list of users with given input array + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = UserApi(); +final user = [List()]; // List | List of user object + +try { + api_instance.createUsersWithArrayInput(user); +} catch (e) { + print('Exception when calling UserApi->createUsersWithArrayInput: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List**](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 + +[[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) + +# **createUsersWithListInput** +> createUsersWithListInput(user) + +Creates list of users with given input array + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = UserApi(); +final user = [List()]; // List | List of user object + +try { + api_instance.createUsersWithListInput(user); +} catch (e) { + print('Exception when calling UserApi->createUsersWithListInput: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List**](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 + +[[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) + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = UserApi(); +final username = username_example; // String | The name that needs to be deleted + +try { + api_instance.deleteUser(username); +} catch (e) { + print('Exception when calling UserApi->deleteUser: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| 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 + +[[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) + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = UserApi(); +final username = username_example; // String | The name that needs to be fetched. Use user1 for testing. + +try { + final result = api_instance.getUserByName(username); + print(result); +} catch (e) { + print('Exception when calling UserApi->getUserByName: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| 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 + +[[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) + +# **loginUser** +> String loginUser(username, password) + +Logs user into the system + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = UserApi(); +final username = username_example; // String | The user name for login +final password = password_example; // String | The password for login in clear text + +try { + final result = api_instance.loginUser(username, password); + print(result); +} catch (e) { + print('Exception when calling UserApi->loginUser: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The user name for login | + **password** | **String**| The password for login in clear text | + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[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) + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = UserApi(); + +try { + api_instance.logoutUser(); +} catch (e) { + print('Exception when calling UserApi->logoutUser: $e\n'); +} +``` + +### 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 + +[[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) + +# **updateUser** +> updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +final api_instance = UserApi(); +final username = username_example; // String | name that need to be deleted +final user = User(); // User | Updated user object + +try { + api_instance.updateUser(username, user); +} catch (e) { + print('Exception when calling UserApi->updateUser: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| 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 + +[[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/dart2/petstore_json_serializable_client_lib_fake/git_push.sh b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/git_push.sh new file mode 100644 index 00000000000..ced3be2b0c7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/git_push.sh @@ -0,0 +1,58 @@ +#!/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-pestore-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/dart2/petstore_json_serializable_client_lib_fake/lib/api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api.dart new file mode 100644 index 00000000000..de2aea295d7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api.dart @@ -0,0 +1,92 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +library openapi.api; + +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; + +import 'package:http/http.dart'; +import 'package:intl/intl.dart'; + +import 'package:meta/meta.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'api_client.dart'; +part 'api_helper.dart'; +part 'api_exception.dart'; +part 'auth/authentication.dart'; +part 'auth/api_key_auth.dart'; +part 'auth/oauth.dart'; +part 'auth/http_basic_auth.dart'; +part 'auth/http_bearer_auth.dart'; + +part 'api/another_fake_api.dart'; +part 'api/default_api.dart'; +part 'api/fake_api.dart'; +part 'api/fake_classname_tags123_api.dart'; +part 'api/pet_api.dart'; +part 'api/store_api.dart'; +part 'api/user_api.dart'; + +part 'model/additional_properties_class.dart'; +part 'model/animal.dart'; +part 'model/api_response.dart'; +part 'model/array_of_array_of_number_only.dart'; +part 'model/array_of_number_only.dart'; +part 'model/array_test.dart'; +part 'model/capitalization.dart'; +part 'model/cat.dart'; +part 'model/cat_all_of.dart'; +part 'model/category.dart'; +part 'model/class_model.dart'; +part 'model/dog.dart'; +part 'model/dog_all_of.dart'; +part 'model/enum_arrays.dart'; +part 'model/enum_class.dart'; +part 'model/enum_test.dart'; +part 'model/file_schema_test_class.dart'; +part 'model/foo.dart'; +part 'model/format_test.dart'; +part 'model/has_only_read_only.dart'; +part 'model/health_check_result.dart'; +part 'model/inline_response_default.dart'; +part 'model/map_test.dart'; +part 'model/mixed_properties_and_additional_properties_class.dart'; +part 'model/model200_response.dart'; +part 'model/model_client.dart'; +part 'model/model_file.dart'; +part 'model/model_list.dart'; +part 'model/model_return.dart'; +part 'model/name.dart'; +part 'model/nullable_class.dart'; +part 'model/number_only.dart'; +part 'model/order.dart'; +part 'model/outer_composite.dart'; +part 'model/outer_enum.dart'; +part 'model/outer_enum_default_value.dart'; +part 'model/outer_enum_integer.dart'; +part 'model/outer_enum_integer_default_value.dart'; +part 'model/pet.dart'; +part 'model/read_only_first.dart'; +part 'model/special_model_name.dart'; +part 'model/tag.dart'; +part 'model/user.dart'; + + +part 'api.g.dart'; +const _delimiters = {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; +const _dateEpochMarker = 'epoch'; +final _dateFormatter = DateFormat('yyyy-MM-dd'); +final _regList = RegExp(r'^List<(.*)>$'); +final _regSet = RegExp(r'^Set<(.*)>$'); +final _regMap = RegExp(r'^Map$'); + +ApiClient defaultApiClient = ApiClient(); diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/another_fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/another_fake_api.dart new file mode 100644 index 00000000000..4427dbe17da --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/another_fake_api.dart @@ -0,0 +1,91 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class AnotherFakeApi { + AnotherFakeApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// To test special tags + /// + /// To test special tags and operation ID starting with number + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [ModelClient] modelClient (required): + /// client model + Future call123testSpecialTagsWithHttpInfo(ModelClient modelClient) async { + // Verify required params are set. + if (modelClient == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: modelClient'); + } + + final path = '/another-fake/dummy'.replaceAll('{format}', 'json'); + + Object postBody = modelClient; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'PATCH', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// To test special tags + /// + /// To test special tags and operation ID starting with number + /// + /// Parameters: + /// + /// * [ModelClient] modelClient (required): + /// client model + Future call123testSpecialTags(ModelClient modelClient) async { + final response = await call123testSpecialTagsWithHttpInfo(modelClient); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'ModelClient') as ModelClient; + } + return null; + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/default_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/default_api.dart new file mode 100644 index 00000000000..73861456c98 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/default_api.dart @@ -0,0 +1,69 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class DefaultApi { + DefaultApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// Performs an HTTP 'GET /foo' operation and returns the [Response]. + Future fooGetWithHttpInfo() async { + final path = '/foo'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + Future fooGet() async { + final response = await fooGetWithHttpInfo(); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'InlineResponseDefault') as InlineResponseDefault; + } + return null; + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_api.dart new file mode 100644 index 00000000000..af1425e338b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_api.dart @@ -0,0 +1,1374 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class FakeApi { + FakeApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// Health check endpoint + /// + /// Note: This method returns the HTTP [Response]. + Future fakeHealthGetWithHttpInfo() async { + final path = '/fake/health'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Health check endpoint + Future fakeHealthGet() async { + final response = await fakeHealthGetWithHttpInfo(); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'HealthCheckResult') as HealthCheckResult; + } + return null; + } + + /// test http signature authentication + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Pet] pet (required): + /// Pet object that needs to be added to the store + /// + /// * [String] query1: + /// query parameter + /// + /// * [String] header1: + /// header parameter + Future fakeHttpSignatureTestWithHttpInfo(Pet pet, { String query1, String header1 }) async { + // Verify required params are set. + if (pet == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: pet'); + } + + final path = '/fake/http-signature-test'.replaceAll('{format}', 'json'); + + Object postBody = pet; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + if (query1 != null) { + queryParams.addAll(_convertParametersForCollectionFormat('', 'query_1', query1)); + } + + if (header1 != null) { + headerParams[r'header_1'] = parameterToString(header1); + } + + final contentTypes = ['application/json', 'application/xml']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['http_signature_test']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// test http signature authentication + /// + /// Parameters: + /// + /// * [Pet] pet (required): + /// Pet object that needs to be added to the store + /// + /// * [String] query1: + /// query parameter + /// + /// * [String] header1: + /// header parameter + Future fakeHttpSignatureTest(Pet pet, { String query1, String header1 }) async { + final response = await fakeHttpSignatureTestWithHttpInfo(pet, query1: query1, header1: header1 ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Test serialization of outer boolean types + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [bool] body: + /// Input boolean as post body + Future fakeOuterBooleanSerializeWithHttpInfo({ bool body }) async { + // Verify required params are set. + + final path = '/fake/outer/boolean'.replaceAll('{format}', 'json'); + + Object postBody = body; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Test serialization of outer boolean types + /// + /// Parameters: + /// + /// * [bool] body: + /// Input boolean as post body + Future fakeOuterBooleanSerialize({ bool body }) async { + final response = await fakeOuterBooleanSerializeWithHttpInfo( body: body ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'bool') as bool; + } + return null; + } + + /// Test serialization of object with outer number type + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [OuterComposite] outerComposite: + /// Input composite as post body + Future fakeOuterCompositeSerializeWithHttpInfo({ OuterComposite outerComposite }) async { + // Verify required params are set. + + final path = '/fake/outer/composite'.replaceAll('{format}', 'json'); + + Object postBody = outerComposite; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Test serialization of object with outer number type + /// + /// Parameters: + /// + /// * [OuterComposite] outerComposite: + /// Input composite as post body + Future fakeOuterCompositeSerialize({ OuterComposite outerComposite }) async { + final response = await fakeOuterCompositeSerializeWithHttpInfo( outerComposite: outerComposite ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'OuterComposite') as OuterComposite; + } + return null; + } + + /// Test serialization of outer number types + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [num] body: + /// Input number as post body + Future fakeOuterNumberSerializeWithHttpInfo({ num body }) async { + // Verify required params are set. + + final path = '/fake/outer/number'.replaceAll('{format}', 'json'); + + Object postBody = body; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Test serialization of outer number types + /// + /// Parameters: + /// + /// * [num] body: + /// Input number as post body + Future fakeOuterNumberSerialize({ num body }) async { + final response = await fakeOuterNumberSerializeWithHttpInfo( body: body ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'num') as num; + } + return null; + } + + /// Test serialization of outer string types + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] body: + /// Input string as post body + Future fakeOuterStringSerializeWithHttpInfo({ String body }) async { + // Verify required params are set. + + final path = '/fake/outer/string'.replaceAll('{format}', 'json'); + + Object postBody = body; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Test serialization of outer string types + /// + /// Parameters: + /// + /// * [String] body: + /// Input string as post body + Future fakeOuterStringSerialize({ String body }) async { + final response = await fakeOuterStringSerializeWithHttpInfo( body: body ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; + } + return null; + } + + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [FileSchemaTestClass] fileSchemaTestClass (required): + Future testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass) async { + // Verify required params are set. + if (fileSchemaTestClass == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: fileSchemaTestClass'); + } + + final path = '/fake/body-with-file-schema'.replaceAll('{format}', 'json'); + + Object postBody = fileSchemaTestClass; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'PUT', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Parameters: + /// + /// * [FileSchemaTestClass] fileSchemaTestClass (required): + Future testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) async { + final response = await testBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Performs an HTTP 'PUT /fake/body-with-query-params' operation and returns the [Response]. + /// Parameters: + /// + /// * [String] query (required): + /// + /// * [User] user (required): + Future testBodyWithQueryParamsWithHttpInfo(String query, User user) async { + // Verify required params are set. + if (query == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: query'); + } + if (user == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); + } + + final path = '/fake/body-with-query-params'.replaceAll('{format}', 'json'); + + Object postBody = user; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + queryParams.addAll(_convertParametersForCollectionFormat('', 'query', query)); + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'PUT', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Parameters: + /// + /// * [String] query (required): + /// + /// * [User] user (required): + Future testBodyWithQueryParams(String query, User user) async { + final response = await testBodyWithQueryParamsWithHttpInfo(query, user); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// To test \"client\" model + /// + /// To test \"client\" model + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [ModelClient] modelClient (required): + /// client model + Future testClientModelWithHttpInfo(ModelClient modelClient) async { + // Verify required params are set. + if (modelClient == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: modelClient'); + } + + final path = '/fake'.replaceAll('{format}', 'json'); + + Object postBody = modelClient; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'PATCH', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// To test \"client\" model + /// + /// To test \"client\" model + /// + /// Parameters: + /// + /// * [ModelClient] modelClient (required): + /// client model + Future testClientModel(ModelClient modelClient) async { + final response = await testClientModelWithHttpInfo(modelClient); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'ModelClient') as ModelClient; + } + return null; + } + + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [num] number (required): + /// None + /// + /// * [double] double_ (required): + /// None + /// + /// * [String] patternWithoutDelimiter (required): + /// None + /// + /// * [String] byte (required): + /// None + /// + /// * [int] integer: + /// None + /// + /// * [int] int32: + /// None + /// + /// * [int] int64: + /// None + /// + /// * [double] float: + /// None + /// + /// * [String] string: + /// None + /// + /// * [MultipartFile] binary: + /// None + /// + /// * [DateTime] date: + /// None + /// + /// * [DateTime] dateTime: + /// None + /// + /// * [String] password: + /// None + /// + /// * [String] callback: + /// None + Future testEndpointParametersWithHttpInfo(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback }) async { + // Verify required params are set. + if (number == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: number'); + } + if (double_ == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: double_'); + } + if (patternWithoutDelimiter == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: patternWithoutDelimiter'); + } + if (byte == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: byte'); + } + + final path = '/fake'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/x-www-form-urlencoded']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['http_basic_test']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (integer != null) { + hasFields = true; + mp.fields[r'integer'] = parameterToString(integer); + } + if (int32 != null) { + hasFields = true; + mp.fields[r'int32'] = parameterToString(int32); + } + if (int64 != null) { + hasFields = true; + mp.fields[r'int64'] = parameterToString(int64); + } + if (number != null) { + hasFields = true; + mp.fields[r'number'] = parameterToString(number); + } + if (float != null) { + hasFields = true; + mp.fields[r'float'] = parameterToString(float); + } + if (double_ != null) { + hasFields = true; + mp.fields[r'double'] = parameterToString(double_); + } + if (string != null) { + hasFields = true; + mp.fields[r'string'] = parameterToString(string); + } + if (patternWithoutDelimiter != null) { + hasFields = true; + mp.fields[r'pattern_without_delimiter'] = parameterToString(patternWithoutDelimiter); + } + if (byte != null) { + hasFields = true; + mp.fields[r'byte'] = parameterToString(byte); + } + if (binary != null) { + hasFields = true; + mp.fields[r'binary'] = binary.field; + mp.files.add(binary); + } + if (date != null) { + hasFields = true; + mp.fields[r'date'] = parameterToString(date); + } + if (dateTime != null) { + hasFields = true; + mp.fields[r'dateTime'] = parameterToString(dateTime); + } + if (password != null) { + hasFields = true; + mp.fields[r'password'] = parameterToString(password); + } + if (callback != null) { + hasFields = true; + mp.fields[r'callback'] = parameterToString(callback); + } + if (hasFields) { + postBody = mp; + } + } else { + if (integer != null) { + formParams[r'integer'] = parameterToString(integer); + } + if (int32 != null) { + formParams[r'int32'] = parameterToString(int32); + } + if (int64 != null) { + formParams[r'int64'] = parameterToString(int64); + } + if (number != null) { + formParams[r'number'] = parameterToString(number); + } + if (float != null) { + formParams[r'float'] = parameterToString(float); + } + if (double_ != null) { + formParams[r'double'] = parameterToString(double_); + } + if (string != null) { + formParams[r'string'] = parameterToString(string); + } + if (patternWithoutDelimiter != null) { + formParams[r'pattern_without_delimiter'] = parameterToString(patternWithoutDelimiter); + } + if (byte != null) { + formParams[r'byte'] = parameterToString(byte); + } + if (date != null) { + formParams[r'date'] = parameterToString(date); + } + if (dateTime != null) { + formParams[r'dateTime'] = parameterToString(dateTime); + } + if (password != null) { + formParams[r'password'] = parameterToString(password); + } + if (callback != null) { + formParams[r'callback'] = parameterToString(callback); + } + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Parameters: + /// + /// * [num] number (required): + /// None + /// + /// * [double] double_ (required): + /// None + /// + /// * [String] patternWithoutDelimiter (required): + /// None + /// + /// * [String] byte (required): + /// None + /// + /// * [int] integer: + /// None + /// + /// * [int] int32: + /// None + /// + /// * [int] int64: + /// None + /// + /// * [double] float: + /// None + /// + /// * [String] string: + /// None + /// + /// * [MultipartFile] binary: + /// None + /// + /// * [DateTime] date: + /// None + /// + /// * [DateTime] dateTime: + /// None + /// + /// * [String] password: + /// None + /// + /// * [String] callback: + /// None + Future testEndpointParameters(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback }) async { + final response = await testEndpointParametersWithHttpInfo(number, double_, patternWithoutDelimiter, byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// To test enum parameters + /// + /// To test enum parameters + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [List] enumHeaderStringArray: + /// Header parameter enum test (string array) + /// + /// * [String] enumHeaderString: + /// Header parameter enum test (string) + /// + /// * [List] enumQueryStringArray: + /// Query parameter enum test (string array) + /// + /// * [String] enumQueryString: + /// Query parameter enum test (string) + /// + /// * [int] enumQueryInteger: + /// Query parameter enum test (double) + /// + /// * [double] enumQueryDouble: + /// Query parameter enum test (double) + /// + /// * [List] enumFormStringArray: + /// Form parameter enum test (string array) + /// + /// * [String] enumFormString: + /// Form parameter enum test (string) + Future testEnumParametersWithHttpInfo({ List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List enumFormStringArray, String enumFormString }) async { + // Verify required params are set. + + final path = '/fake'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + if (enumQueryStringArray != null) { + queryParams.addAll(_convertParametersForCollectionFormat('multi', 'enum_query_string_array', enumQueryStringArray)); + } + if (enumQueryString != null) { + queryParams.addAll(_convertParametersForCollectionFormat('', 'enum_query_string', enumQueryString)); + } + if (enumQueryInteger != null) { + queryParams.addAll(_convertParametersForCollectionFormat('', 'enum_query_integer', enumQueryInteger)); + } + if (enumQueryDouble != null) { + queryParams.addAll(_convertParametersForCollectionFormat('', 'enum_query_double', enumQueryDouble)); + } + + if (enumHeaderStringArray != null) { + headerParams[r'enum_header_string_array'] = parameterToString(enumHeaderStringArray); + } + if (enumHeaderString != null) { + headerParams[r'enum_header_string'] = parameterToString(enumHeaderString); + } + + final contentTypes = ['application/x-www-form-urlencoded']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (enumFormStringArray != null) { + hasFields = true; + mp.fields[r'enum_form_string_array'] = parameterToString(enumFormStringArray); + } + if (enumFormString != null) { + hasFields = true; + mp.fields[r'enum_form_string'] = parameterToString(enumFormString); + } + if (hasFields) { + postBody = mp; + } + } else { + if (enumFormStringArray != null) { + formParams[r'enum_form_string_array'] = parameterToString(enumFormStringArray); + } + if (enumFormString != null) { + formParams[r'enum_form_string'] = parameterToString(enumFormString); + } + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// To test enum parameters + /// + /// To test enum parameters + /// + /// Parameters: + /// + /// * [List] enumHeaderStringArray: + /// Header parameter enum test (string array) + /// + /// * [String] enumHeaderString: + /// Header parameter enum test (string) + /// + /// * [List] enumQueryStringArray: + /// Query parameter enum test (string array) + /// + /// * [String] enumQueryString: + /// Query parameter enum test (string) + /// + /// * [int] enumQueryInteger: + /// Query parameter enum test (double) + /// + /// * [double] enumQueryDouble: + /// Query parameter enum test (double) + /// + /// * [List] enumFormStringArray: + /// Form parameter enum test (string array) + /// + /// * [String] enumFormString: + /// Form parameter enum test (string) + Future testEnumParameters({ List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List enumFormStringArray, String enumFormString }) async { + final response = await testEnumParametersWithHttpInfo( enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Fake endpoint to test group parameters (optional) + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] requiredStringGroup (required): + /// Required String in group parameters + /// + /// * [bool] requiredBooleanGroup (required): + /// Required Boolean in group parameters + /// + /// * [int] requiredInt64Group (required): + /// Required Integer in group parameters + /// + /// * [int] stringGroup: + /// String in group parameters + /// + /// * [bool] booleanGroup: + /// Boolean in group parameters + /// + /// * [int] int64Group: + /// Integer in group parameters + Future testGroupParametersWithHttpInfo(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group }) async { + // Verify required params are set. + if (requiredStringGroup == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: requiredStringGroup'); + } + if (requiredBooleanGroup == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: requiredBooleanGroup'); + } + if (requiredInt64Group == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: requiredInt64Group'); + } + + final path = '/fake'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + queryParams.addAll(_convertParametersForCollectionFormat('', 'required_string_group', requiredStringGroup)); + queryParams.addAll(_convertParametersForCollectionFormat('', 'required_int64_group', requiredInt64Group)); + if (stringGroup != null) { + queryParams.addAll(_convertParametersForCollectionFormat('', 'string_group', stringGroup)); + } + if (int64Group != null) { + queryParams.addAll(_convertParametersForCollectionFormat('', 'int64_group', int64Group)); + } + + headerParams[r'required_boolean_group'] = parameterToString(requiredBooleanGroup); + if (booleanGroup != null) { + headerParams[r'boolean_group'] = parameterToString(booleanGroup); + } + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['bearer_test']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'DELETE', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Fake endpoint to test group parameters (optional) + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Parameters: + /// + /// * [int] requiredStringGroup (required): + /// Required String in group parameters + /// + /// * [bool] requiredBooleanGroup (required): + /// Required Boolean in group parameters + /// + /// * [int] requiredInt64Group (required): + /// Required Integer in group parameters + /// + /// * [int] stringGroup: + /// String in group parameters + /// + /// * [bool] booleanGroup: + /// Boolean in group parameters + /// + /// * [int] int64Group: + /// Integer in group parameters + Future testGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group }) async { + final response = await testGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// test inline additionalProperties + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Map] requestBody (required): + /// request body + Future testInlineAdditionalPropertiesWithHttpInfo(Map requestBody) async { + // Verify required params are set. + if (requestBody == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: requestBody'); + } + + final path = '/fake/inline-additionalProperties'.replaceAll('{format}', 'json'); + + Object postBody = requestBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// test inline additionalProperties + /// + /// Parameters: + /// + /// * [Map] requestBody (required): + /// request body + Future testInlineAdditionalProperties(Map requestBody) async { + final response = await testInlineAdditionalPropertiesWithHttpInfo(requestBody); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// test json serialization of form data + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] param (required): + /// field1 + /// + /// * [String] param2 (required): + /// field2 + Future testJsonFormDataWithHttpInfo(String param, String param2) async { + // Verify required params are set. + if (param == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: param'); + } + if (param2 == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: param2'); + } + + final path = '/fake/jsonFormData'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/x-www-form-urlencoded']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (param != null) { + hasFields = true; + mp.fields[r'param'] = parameterToString(param); + } + if (param2 != null) { + hasFields = true; + mp.fields[r'param2'] = parameterToString(param2); + } + if (hasFields) { + postBody = mp; + } + } else { + if (param != null) { + formParams[r'param'] = parameterToString(param); + } + if (param2 != null) { + formParams[r'param2'] = parameterToString(param2); + } + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// test json serialization of form data + /// + /// Parameters: + /// + /// * [String] param (required): + /// field1 + /// + /// * [String] param2 (required): + /// field2 + Future testJsonFormData(String param, String param2) async { + final response = await testJsonFormDataWithHttpInfo(param, param2); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// To test the collection format in query parameters + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [List] pipe (required): + /// + /// * [List] ioutil (required): + /// + /// * [List] http (required): + /// + /// * [List] url (required): + /// + /// * [List] context (required): + Future testQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context) async { + // Verify required params are set. + if (pipe == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: pipe'); + } + if (ioutil == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: ioutil'); + } + if (http == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: http'); + } + if (url == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: url'); + } + if (context == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: context'); + } + + final path = '/fake/test-query-paramters'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + queryParams.addAll(_convertParametersForCollectionFormat('multi', 'pipe', pipe)); + queryParams.addAll(_convertParametersForCollectionFormat('csv', 'ioutil', ioutil)); + queryParams.addAll(_convertParametersForCollectionFormat('ssv', 'http', http)); + queryParams.addAll(_convertParametersForCollectionFormat('csv', 'url', url)); + queryParams.addAll(_convertParametersForCollectionFormat('multi', 'context', context)); + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'PUT', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// To test the collection format in query parameters + /// + /// Parameters: + /// + /// * [List] pipe (required): + /// + /// * [List] ioutil (required): + /// + /// * [List] http (required): + /// + /// * [List] url (required): + /// + /// * [List] context (required): + Future testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context) async { + final response = await testQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_classname_tags123_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_classname_tags123_api.dart new file mode 100644 index 00000000000..3743aa85c28 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_classname_tags123_api.dart @@ -0,0 +1,91 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class FakeClassnameTags123Api { + FakeClassnameTags123Api([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// To test class name in snake case + /// + /// To test class name in snake case + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [ModelClient] modelClient (required): + /// client model + Future testClassnameWithHttpInfo(ModelClient modelClient) async { + // Verify required params are set. + if (modelClient == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: modelClient'); + } + + final path = '/fake_classname_test'.replaceAll('{format}', 'json'); + + Object postBody = modelClient; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['api_key_query']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'PATCH', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// To test class name in snake case + /// + /// To test class name in snake case + /// + /// Parameters: + /// + /// * [ModelClient] modelClient (required): + /// client model + Future testClassname(ModelClient modelClient) async { + final response = await testClassnameWithHttpInfo(modelClient); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'ModelClient') as ModelClient; + } + return null; + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/pet_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/pet_api.dart new file mode 100644 index 00000000000..256bfd22f1d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/pet_api.dart @@ -0,0 +1,729 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class PetApi { + PetApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// Add a new pet to the store + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Pet] pet (required): + /// Pet object that needs to be added to the store + Future addPetWithHttpInfo(Pet pet) async { + // Verify required params are set. + if (pet == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: pet'); + } + + final path = '/pet'.replaceAll('{format}', 'json'); + + Object postBody = pet; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json', 'application/xml']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['petstore_auth']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Add a new pet to the store + /// + /// Parameters: + /// + /// * [Pet] pet (required): + /// Pet object that needs to be added to the store + Future addPet(Pet pet) async { + final response = await addPetWithHttpInfo(pet); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Deletes a pet + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] petId (required): + /// Pet id to delete + /// + /// * [String] apiKey: + Future deletePetWithHttpInfo(int petId, { String apiKey }) async { + // Verify required params are set. + if (petId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); + } + + final path = '/pet/{petId}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'petId' + '}', petId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + if (apiKey != null) { + headerParams[r'api_key'] = parameterToString(apiKey); + } + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['petstore_auth']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'DELETE', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Deletes a pet + /// + /// Parameters: + /// + /// * [int] petId (required): + /// Pet id to delete + /// + /// * [String] apiKey: + Future deletePet(int petId, { String apiKey }) async { + final response = await deletePetWithHttpInfo(petId, apiKey: apiKey ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Finds Pets by status + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [List] status (required): + /// Status values that need to be considered for filter + Future findPetsByStatusWithHttpInfo(List status) async { + // Verify required params are set. + if (status == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: status'); + } + + final path = '/pet/findByStatus'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + queryParams.addAll(_convertParametersForCollectionFormat('csv', 'status', status)); + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['petstore_auth']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Finds Pets by status + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Parameters: + /// + /// * [List] status (required): + /// Status values that need to be considered for filter + Future> findPetsByStatus(List status) async { + final response = await findPetsByStatusWithHttpInfo(status); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return (apiClient.deserialize(_decodeBodyBytes(response), 'List') as List) + .cast() + .toList(growable: false); + } + return null; + } + + /// Finds Pets by tags + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Set] tags (required): + /// Tags to filter by + Future findPetsByTagsWithHttpInfo(Set tags) async { + // Verify required params are set. + if (tags == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: tags'); + } + + final path = '/pet/findByTags'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + queryParams.addAll(_convertParametersForCollectionFormat('csv', 'tags', tags)); + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['petstore_auth']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Finds Pets by tags + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Parameters: + /// + /// * [Set] tags (required): + /// Tags to filter by + Future> findPetsByTags(Set tags) async { + final response = await findPetsByTagsWithHttpInfo(tags); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return (apiClient.deserialize(_decodeBodyBytes(response), 'Set') as List) + .cast() + .toSet(); + } + return null; + } + + /// Find pet by ID + /// + /// Returns a single pet + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to return + Future getPetByIdWithHttpInfo(int petId) async { + // Verify required params are set. + if (petId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); + } + + final path = '/pet/{petId}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'petId' + '}', petId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['api_key']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Find pet by ID + /// + /// Returns a single pet + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to return + Future getPetById(int petId) async { + final response = await getPetByIdWithHttpInfo(petId); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'Pet') as Pet; + } + return null; + } + + /// Update an existing pet + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Pet] pet (required): + /// Pet object that needs to be added to the store + Future updatePetWithHttpInfo(Pet pet) async { + // Verify required params are set. + if (pet == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: pet'); + } + + final path = '/pet'.replaceAll('{format}', 'json'); + + Object postBody = pet; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json', 'application/xml']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['petstore_auth']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'PUT', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Update an existing pet + /// + /// Parameters: + /// + /// * [Pet] pet (required): + /// Pet object that needs to be added to the store + Future updatePet(Pet pet) async { + final response = await updatePetWithHttpInfo(pet); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Updates a pet in the store with form data + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet that needs to be updated + /// + /// * [String] name: + /// Updated name of the pet + /// + /// * [String] status: + /// Updated status of the pet + Future updatePetWithFormWithHttpInfo(int petId, { String name, String status }) async { + // Verify required params are set. + if (petId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); + } + + final path = '/pet/{petId}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'petId' + '}', petId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/x-www-form-urlencoded']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['petstore_auth']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (name != null) { + hasFields = true; + mp.fields[r'name'] = parameterToString(name); + } + if (status != null) { + hasFields = true; + mp.fields[r'status'] = parameterToString(status); + } + if (hasFields) { + postBody = mp; + } + } else { + if (name != null) { + formParams[r'name'] = parameterToString(name); + } + if (status != null) { + formParams[r'status'] = parameterToString(status); + } + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Updates a pet in the store with form data + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet that needs to be updated + /// + /// * [String] name: + /// Updated name of the pet + /// + /// * [String] status: + /// Updated status of the pet + Future updatePetWithForm(int petId, { String name, String status }) async { + final response = await updatePetWithFormWithHttpInfo(petId, name: name, status: status ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// uploads an image + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to update + /// + /// * [String] additionalMetadata: + /// Additional data to pass to server + /// + /// * [MultipartFile] file: + /// file to upload + Future uploadFileWithHttpInfo(int petId, { String additionalMetadata, MultipartFile file }) async { + // Verify required params are set. + if (petId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); + } + + final path = '/pet/{petId}/uploadImage'.replaceAll('{format}', 'json') + .replaceAll('{' + 'petId' + '}', petId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['multipart/form-data']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['petstore_auth']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (additionalMetadata != null) { + hasFields = true; + mp.fields[r'additionalMetadata'] = parameterToString(additionalMetadata); + } + if (file != null) { + hasFields = true; + mp.fields[r'file'] = file.field; + mp.files.add(file); + } + if (hasFields) { + postBody = mp; + } + } else { + if (additionalMetadata != null) { + formParams[r'additionalMetadata'] = parameterToString(additionalMetadata); + } + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// uploads an image + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to update + /// + /// * [String] additionalMetadata: + /// Additional data to pass to server + /// + /// * [MultipartFile] file: + /// file to upload + Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async { + final response = await uploadFileWithHttpInfo(petId, additionalMetadata: additionalMetadata, file: file ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'ApiResponse') as ApiResponse; + } + return null; + } + + /// uploads an image (required) + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to update + /// + /// * [MultipartFile] requiredFile (required): + /// file to upload + /// + /// * [String] additionalMetadata: + /// Additional data to pass to server + Future uploadFileWithRequiredFileWithHttpInfo(int petId, MultipartFile requiredFile, { String additionalMetadata }) async { + // Verify required params are set. + if (petId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: petId'); + } + if (requiredFile == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: requiredFile'); + } + + final path = '/fake/{petId}/uploadImageWithRequiredFile'.replaceAll('{format}', 'json') + .replaceAll('{' + 'petId' + '}', petId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['multipart/form-data']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['petstore_auth']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (additionalMetadata != null) { + hasFields = true; + mp.fields[r'additionalMetadata'] = parameterToString(additionalMetadata); + } + if (requiredFile != null) { + hasFields = true; + mp.fields[r'requiredFile'] = requiredFile.field; + mp.files.add(requiredFile); + } + if (hasFields) { + postBody = mp; + } + } else { + if (additionalMetadata != null) { + formParams[r'additionalMetadata'] = parameterToString(additionalMetadata); + } + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// uploads an image (required) + /// + /// Parameters: + /// + /// * [int] petId (required): + /// ID of pet to update + /// + /// * [MultipartFile] requiredFile (required): + /// file to upload + /// + /// * [String] additionalMetadata: + /// Additional data to pass to server + Future uploadFileWithRequiredFile(int petId, MultipartFile requiredFile, { String additionalMetadata }) async { + final response = await uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata: additionalMetadata ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'ApiResponse') as ApiResponse; + } + return null; + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/store_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/store_api.dart new file mode 100644 index 00000000000..bc0c54eba86 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/store_api.dart @@ -0,0 +1,289 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class StoreApi { + StoreApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// Delete purchase order by ID + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] orderId (required): + /// ID of the order that needs to be deleted + Future deleteOrderWithHttpInfo(String orderId) async { + // Verify required params are set. + if (orderId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: orderId'); + } + + final path = '/store/order/{order_id}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'order_id' + '}', orderId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'DELETE', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Delete purchase order by ID + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Parameters: + /// + /// * [String] orderId (required): + /// ID of the order that needs to be deleted + Future deleteOrder(String orderId) async { + final response = await deleteOrderWithHttpInfo(orderId); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Returns pet inventories by status + /// + /// Returns a map of status codes to quantities + /// + /// Note: This method returns the HTTP [Response]. + Future getInventoryWithHttpInfo() async { + final path = '/store/inventory'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = ['api_key']; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Returns pet inventories by status + /// + /// Returns a map of status codes to quantities + Future> getInventory() async { + final response = await getInventoryWithHttpInfo(); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return Map.from(apiClient.deserialize(_decodeBodyBytes(response), 'Map')); + } + return null; + } + + /// Find purchase order by ID + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [int] orderId (required): + /// ID of pet that needs to be fetched + Future getOrderByIdWithHttpInfo(int orderId) async { + // Verify required params are set. + if (orderId == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: orderId'); + } + + final path = '/store/order/{order_id}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'order_id' + '}', orderId.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Find purchase order by ID + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// Parameters: + /// + /// * [int] orderId (required): + /// ID of pet that needs to be fetched + Future getOrderById(int orderId) async { + final response = await getOrderByIdWithHttpInfo(orderId); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order; + } + return null; + } + + /// Place an order for a pet + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [Order] order (required): + /// order placed for purchasing the pet + Future placeOrderWithHttpInfo(Order order) async { + // Verify required params are set. + if (order == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: order'); + } + + final path = '/store/order'.replaceAll('{format}', 'json'); + + Object postBody = order; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Place an order for a pet + /// + /// Parameters: + /// + /// * [Order] order (required): + /// order placed for purchasing the pet + Future placeOrder(Order order) async { + final response = await placeOrderWithHttpInfo(order); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'Order') as Order; + } + return null; + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/user_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/user_api.dart new file mode 100644 index 00000000000..d8346bcb3b7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/user_api.dart @@ -0,0 +1,556 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + +class UserApi { + UserApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + final ApiClient apiClient; + + /// Create user + /// + /// This can only be done by the logged in user. + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [User] user (required): + /// Created user object + Future createUserWithHttpInfo(User user) async { + // Verify required params are set. + if (user == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); + } + + final path = '/user'.replaceAll('{format}', 'json'); + + Object postBody = user; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Create user + /// + /// This can only be done by the logged in user. + /// + /// Parameters: + /// + /// * [User] user (required): + /// Created user object + Future createUser(User user) async { + final response = await createUserWithHttpInfo(user); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Creates list of users with given input array + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [List] user (required): + /// List of user object + Future createUsersWithArrayInputWithHttpInfo(List user) async { + // Verify required params are set. + if (user == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); + } + + final path = '/user/createWithArray'.replaceAll('{format}', 'json'); + + Object postBody = user; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Creates list of users with given input array + /// + /// Parameters: + /// + /// * [List] user (required): + /// List of user object + Future createUsersWithArrayInput(List user) async { + final response = await createUsersWithArrayInputWithHttpInfo(user); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Creates list of users with given input array + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [List] user (required): + /// List of user object + Future createUsersWithListInputWithHttpInfo(List user) async { + // Verify required params are set. + if (user == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); + } + + final path = '/user/createWithList'.replaceAll('{format}', 'json'); + + Object postBody = user; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Creates list of users with given input array + /// + /// Parameters: + /// + /// * [List] user (required): + /// List of user object + Future createUsersWithListInput(List user) async { + final response = await createUsersWithListInputWithHttpInfo(user); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Delete user + /// + /// This can only be done by the logged in user. + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] username (required): + /// The name that needs to be deleted + Future deleteUserWithHttpInfo(String username) async { + // Verify required params are set. + if (username == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); + } + + final path = '/user/{username}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'username' + '}', username.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'DELETE', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Delete user + /// + /// This can only be done by the logged in user. + /// + /// Parameters: + /// + /// * [String] username (required): + /// The name that needs to be deleted + Future deleteUser(String username) async { + final response = await deleteUserWithHttpInfo(username); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Get user by user name + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] username (required): + /// The name that needs to be fetched. Use user1 for testing. + Future getUserByNameWithHttpInfo(String username) async { + // Verify required params are set. + if (username == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); + } + + final path = '/user/{username}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'username' + '}', username.toString()); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Get user by user name + /// + /// Parameters: + /// + /// * [String] username (required): + /// The name that needs to be fetched. Use user1 for testing. + Future getUserByName(String username) async { + final response = await getUserByNameWithHttpInfo(username); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'User') as User; + } + return null; + } + + /// Logs user into the system + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] username (required): + /// The user name for login + /// + /// * [String] password (required): + /// The password for login in clear text + Future loginUserWithHttpInfo(String username, String password) async { + // Verify required params are set. + if (username == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); + } + if (password == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: password'); + } + + final path = '/user/login'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + queryParams.addAll(_convertParametersForCollectionFormat('', 'username', username)); + queryParams.addAll(_convertParametersForCollectionFormat('', 'password', password)); + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Logs user into the system + /// + /// Parameters: + /// + /// * [String] username (required): + /// The user name for login + /// + /// * [String] password (required): + /// The password for login in clear text + Future loginUser(String username, String password) async { + final response = await loginUserWithHttpInfo(username, password); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body != null && response.statusCode != HttpStatus.noContent) { + return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String; + } + return null; + } + + /// Logs out current logged in user session + /// + /// Note: This method returns the HTTP [Response]. + Future logoutUserWithHttpInfo() async { + final path = '/user/logout'.replaceAll('{format}', 'json'); + + Object postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = []; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Logs out current logged in user session + Future logoutUser() async { + final response = await logoutUserWithHttpInfo(); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } + + /// Updated user + /// + /// This can only be done by the logged in user. + /// + /// Note: This method returns the HTTP [Response]. + /// + /// Parameters: + /// + /// * [String] username (required): + /// name that need to be deleted + /// + /// * [User] user (required): + /// Updated user object + Future updateUserWithHttpInfo(String username, User user) async { + // Verify required params are set. + if (username == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: username'); + } + if (user == null) { + throw ApiException(HttpStatus.badRequest, 'Missing required param: user'); + } + + final path = '/user/{username}'.replaceAll('{format}', 'json') + .replaceAll('{' + 'username' + '}', username.toString()); + + Object postBody = user; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + final contentTypes = ['application/json']; + final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null; + final authNames = []; + + if ( + nullableContentType != null && + nullableContentType.toLowerCase().startsWith('multipart/form-data') + ) { + bool hasFields = false; + final mp = MultipartRequest(null, null); + if (hasFields) { + postBody = mp; + } + } else { + } + + return await apiClient.invokeAPI( + path, + 'PUT', + queryParams, + postBody, + headerParams, + formParams, + nullableContentType, + authNames, + ); + } + + /// Updated user + /// + /// This can only be done by the logged in user. + /// + /// Parameters: + /// + /// * [String] username (required): + /// name that need to be deleted + /// + /// * [User] user (required): + /// Updated user object + Future updateUser(String username, User user) async { + final response = await updateUserWithHttpInfo(username, user); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, _decodeBodyBytes(response)); + } + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_client.dart new file mode 100644 index 00000000000..435fdfc4b74 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_client.dart @@ -0,0 +1,309 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ApiClient { + ApiClient({this.basePath = 'http://petstore.swagger.io:80/v2'}) { + // Setup authentications (key: authentication name, value: authentication). + _authentications[r'api_key'] = ApiKeyAuth('header', 'api_key'); + _authentications[r'api_key_query'] = ApiKeyAuth('query', 'api_key_query'); + _authentications[r'bearer_test'] = HttpBearerAuth(); + _authentications[r'http_basic_test'] = HttpBasicAuth(); + _authentications[r'petstore_auth'] = OAuth(); + } + + final String basePath; + + var _client = Client(); + + /// Returns the current HTTP [Client] instance to use in this class. + /// + /// The return value is guaranteed to never be null. + Client get client => _client; + + /// Requests to use a new HTTP [Client] in this class. + /// + /// If the [newClient] is null, an [ArgumentError] is thrown. + set client(Client newClient) { + if (newClient == null) { + throw ArgumentError('New client instance cannot be null.'); + } + _client = newClient; + } + + final _defaultHeaderMap = {}; + final _authentications = {}; + + void addDefaultHeader(String key, String value) { + _defaultHeaderMap[key] = value; + } + + Map get defaultHeaderMap => _defaultHeaderMap; + + /// returns an unmodifiable view of the authentications, since none should be added + /// nor deleted + Map get authentications => + Map.unmodifiable(_authentications); + + dynamic deserialize(String json, String targetType, {bool growable}) { + // Remove all spaces. Necessary for reg expressions as well. + targetType = targetType.replaceAll(' ', ''); + + return targetType == 'String' + ? json + : _deserialize(jsonDecode(json), targetType, growable: true == growable); + } + + String serialize(Object obj) => obj == null ? '' : json.encode(obj); + + T getAuthentication(String name) { + final authentication = _authentications[name]; + return authentication is T ? authentication : null; + } + + // We don’t use a Map for queryParams. + // If collectionFormat is 'multi', a key might appear multiple times. + Future invokeAPI( + String path, + String method, + Iterable queryParams, + Object body, + Map headerParams, + Map formParams, + String nullableContentType, + List authNames, + ) async { + _updateParamsForAuth(authNames, queryParams, headerParams); + + headerParams.addAll(_defaultHeaderMap); + + final urlEncodedQueryParams = queryParams + .where((param) => param.value != null) + .map((param) => '$param'); + + final queryString = urlEncodedQueryParams.isNotEmpty + ? '?${urlEncodedQueryParams.join('&')}' + : ''; + + final url = '$basePath$path$queryString'; + + if (nullableContentType != null) { + headerParams['Content-Type'] = nullableContentType; + } + + try { + // Special case for uploading a single file which isn’t a 'multipart/form-data'. + if ( + body is MultipartFile && (nullableContentType == null || + !nullableContentType.toLowerCase().startsWith('multipart/form-data')) + ) { + final request = StreamedRequest(method, Uri.parse(url)); + request.headers.addAll(headerParams); + request.contentLength = body.length; + body.finalize().listen( + request.sink.add, + onDone: request.sink.close, + onError: (error, trace) => request.sink.close(), + cancelOnError: true, + ); + final response = await _client.send(request); + return Response.fromStream(response); + } + + if (body is MultipartRequest) { + final request = MultipartRequest(method, Uri.parse(url)); + request.fields.addAll(body.fields); + request.files.addAll(body.files); + request.headers.addAll(body.headers); + request.headers.addAll(headerParams); + final response = await _client.send(request); + return Response.fromStream(response); + } + + final msgBody = nullableContentType == 'application/x-www-form-urlencoded' + ? formParams + : serialize(body); + final nullableHeaderParams = headerParams.isEmpty ? null : headerParams; + + switch(method) { + case 'POST': return await _client.post(url, headers: nullableHeaderParams, body: msgBody,); + case 'PUT': return await _client.put(url, headers: nullableHeaderParams, body: msgBody,); + case 'DELETE': return await _client.delete(url, headers: nullableHeaderParams,); + case 'PATCH': return await _client.patch(url, headers: nullableHeaderParams, body: msgBody,); + case 'HEAD': return await _client.head(url, headers: nullableHeaderParams,); + case 'GET': return await _client.get(url, headers: nullableHeaderParams,); + } + } on SocketException catch (e, trace) { + throw ApiException.withInner(HttpStatus.badRequest, 'Socket operation failed: $method $path', e, trace,); + } on TlsException catch (e, trace) { + throw ApiException.withInner(HttpStatus.badRequest, 'TLS/SSL communication failed: $method $path', e, trace,); + } on IOException catch (e, trace) { + throw ApiException.withInner(HttpStatus.badRequest, 'I/O operation failed: $method $path', e, trace,); + } on ClientException catch (e, trace) { + throw ApiException.withInner(HttpStatus.badRequest, 'HTTP connection failed: $method $path', e, trace,); + } on Exception catch (e, trace) { + throw ApiException.withInner(HttpStatus.badRequest, 'Exception occurred: $method $path', e, trace,); + } + + throw ApiException(HttpStatus.badRequest, 'Invalid HTTP operation: $method $path',); + } + + dynamic _deserialize(dynamic value, String targetType, {bool growable}) { + try { + switch (targetType) { + case 'String': + return '$value'; + case 'int': + return value is int ? value : int.parse('$value'); + case 'bool': + if (value is bool) { + return value; + } + final valueString = '$value'.toLowerCase(); + return valueString == 'true' || valueString == '1'; + break; + case 'double': + return value is double ? value : double.parse('$value'); + case 'AdditionalPropertiesClass': + return AdditionalPropertiesClass.fromJson(value); + case 'Animal': + return Animal.fromJson(value); + case 'ApiResponse': + return ApiResponse.fromJson(value); + case 'ArrayOfArrayOfNumberOnly': + return ArrayOfArrayOfNumberOnly.fromJson(value); + case 'ArrayOfNumberOnly': + return ArrayOfNumberOnly.fromJson(value); + case 'ArrayTest': + return ArrayTest.fromJson(value); + case 'Capitalization': + return Capitalization.fromJson(value); + case 'Cat': + return Cat.fromJson(value); + case 'CatAllOf': + return CatAllOf.fromJson(value); + case 'Category': + return Category.fromJson(value); + case 'ClassModel': + return ClassModel.fromJson(value); + case 'Dog': + return Dog.fromJson(value); + case 'DogAllOf': + return DogAllOf.fromJson(value); + case 'EnumArrays': + return EnumArrays.fromJson(value); + case 'EnumClass': + + return _$enumDecode(_$EnumClassEnumMap, value); + case 'EnumTest': + return EnumTest.fromJson(value); + case 'FileSchemaTestClass': + return FileSchemaTestClass.fromJson(value); + case 'Foo': + return Foo.fromJson(value); + case 'FormatTest': + return FormatTest.fromJson(value); + case 'HasOnlyReadOnly': + return HasOnlyReadOnly.fromJson(value); + case 'HealthCheckResult': + return HealthCheckResult.fromJson(value); + case 'InlineResponseDefault': + return InlineResponseDefault.fromJson(value); + case 'MapTest': + return MapTest.fromJson(value); + case 'MixedPropertiesAndAdditionalPropertiesClass': + return MixedPropertiesAndAdditionalPropertiesClass.fromJson(value); + case 'Model200Response': + return Model200Response.fromJson(value); + case 'ModelClient': + return ModelClient.fromJson(value); + case 'ModelFile': + return ModelFile.fromJson(value); + case 'ModelList': + return ModelList.fromJson(value); + case 'ModelReturn': + return ModelReturn.fromJson(value); + case 'Name': + return Name.fromJson(value); + case 'NullableClass': + return NullableClass.fromJson(value); + case 'NumberOnly': + return NumberOnly.fromJson(value); + case 'Order': + return Order.fromJson(value); + case 'OuterComposite': + return OuterComposite.fromJson(value); + case 'OuterEnum': + + return _$enumDecode(_$OuterEnumEnumMap, value); + case 'OuterEnumDefaultValue': + + return _$enumDecode(_$OuterEnumDefaultValueEnumMap, value); + case 'OuterEnumInteger': + + return _$enumDecode(_$OuterEnumIntegerEnumMap, value); + case 'OuterEnumIntegerDefaultValue': + + return _$enumDecode(_$OuterEnumIntegerDefaultValueEnumMap, value); + case 'Pet': + return Pet.fromJson(value); + case 'ReadOnlyFirst': + return ReadOnlyFirst.fromJson(value); + case 'SpecialModelName': + return SpecialModelName.fromJson(value); + case 'Tag': + return Tag.fromJson(value); + case 'User': + return User.fromJson(value); + default: + Match match; + if (value is List && (match = _regList.firstMatch(targetType)) != null) { + final newTargetType = match[1]; + return value + .map((v) => _deserialize(v, newTargetType, growable: growable)) + .toList(growable: true == growable); + } + if (value is Set && (match = _regSet.firstMatch(targetType)) != null) { + final newTargetType = match[1]; + return value + .map((v) => _deserialize(v, newTargetType, growable: growable)) + .toSet(); + } + if (value is Map && (match = _regMap.firstMatch(targetType)) != null) { + final newTargetType = match[1]; + return Map.fromIterables( + value.keys, + value.values.map((v) => _deserialize(v, newTargetType, growable: growable)), + ); + } + break; + } + } on Exception catch (e, stack) { + throw ApiException.withInner(HttpStatus.internalServerError, 'Exception during deserialization.', e, stack,); + } + throw ApiException(HttpStatus.internalServerError, 'Could not find a suitable class for deserialization',); + } + + /// Update query and header parameters based on authentication settings. + /// @param authNames The authentications to apply + void _updateParamsForAuth( + List authNames, + List queryParams, + Map headerParams, + ) { + authNames.forEach((authName) { + final auth = _authentications[authName]; + if (auth == null) { + throw ArgumentError('Authentication undefined: $authName'); + } + auth.applyToParams(queryParams, headerParams); + }); + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_exception.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_exception.dart new file mode 100644 index 00000000000..1537c9769b2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_exception.dart @@ -0,0 +1,31 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ApiException implements Exception { + ApiException(this.code, this.message); + + ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace); + + int code = 0; + String message; + Exception innerException; + StackTrace stackTrace; + + String toString() { + if (message == null) { + return 'ApiException'; + } + if (innerException == null) { + return 'ApiException $code: $message'; + } + return 'ApiException $code: $message (Inner exception: $innerException)\n\n$stackTrace'; + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_helper.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_helper.dart new file mode 100644 index 00000000000..8e083e63f0a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_helper.dart @@ -0,0 +1,91 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class QueryParam { + const QueryParam(this.name, this.value); + + final String name; + final String value; + + @override + String toString() => '${Uri.encodeQueryComponent(name)}=${Uri.encodeQueryComponent(value)}'; +} + +// Ported from the Java version. +Iterable _convertParametersForCollectionFormat( + String collectionFormat, + String name, + dynamic value, +) { + final params = []; + + // preconditions + if (name != null && !name.isEmpty && value != null) { + if (value is List) { + // get the collection format, default: csv + collectionFormat = (collectionFormat == null || collectionFormat.isEmpty) + ? 'csv' + : collectionFormat; + + if (collectionFormat == 'multi') { + return value.map((v) => QueryParam(name, parameterToString(v))); + } + + final delimiter = _delimiters[collectionFormat] ?? ','; + + params.add(QueryParam(name, value.map((v) => parameterToString(v)).join(delimiter))); + } else { + params.add(QueryParam(name, parameterToString(value))); + } + } + + return params; +} + +/// Format the given parameter object into a [String]. +String parameterToString(dynamic value) { + if (value == null) { + return ''; + } + if (value is DateTime) { + return value.toUtc().toIso8601String(); + } + if (value is EnumClass) { + + return _$EnumClassEnumMap[value]; + } + if (value is OuterEnum) { + + return _$OuterEnumEnumMap[value]; + } + if (value is OuterEnumDefaultValue) { + + return _$OuterEnumDefaultValueEnumMap[value]; + } + if (value is OuterEnumInteger) { + + return _$OuterEnumIntegerEnumMap[value]; + } + if (value is OuterEnumIntegerDefaultValue) { + + return _$OuterEnumIntegerDefaultValueEnumMap[value]; + } + return value.toString(); +} + +/// Returns the decoded body as UTF-8 if the given headers indicate an 'application/json' +/// content type. Otherwise, returns the decoded body as decoded by dart:http package. +String _decodeBodyBytes(Response response) { + final contentType = response.headers['content-type']; + return contentType != null && contentType.toLowerCase().startsWith('application/json') + ? response.bodyBytes == null ? null : utf8.decode(response.bodyBytes) + : response.body; +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/api_key_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/api_key_auth.dart new file mode 100644 index 00000000000..41a4afd85d9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/api_key_auth.dart @@ -0,0 +1,35 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class ApiKeyAuth implements Authentication { + ApiKeyAuth(this.location, this.paramName); + + final String location; + final String paramName; + + String apiKeyPrefix; + String apiKey; + + @override + void applyToParams(List queryParams, Map headerParams) { + final value = apiKeyPrefix == null ? apiKey : '$apiKeyPrefix $apiKey'; + + if (location == 'query' && value != null) { + queryParams.add(QueryParam(paramName, value)); + } else if (location == 'header' && value != null) { + headerParams[paramName] = value; + } else if (location == 'cookie' && value != null) { + headerParams.update('Cookie', (String existingCookie) { + return '$existingCookie; $paramName=$value'; + }, ifAbsent: () => '$paramName=$value'); + } + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/authentication.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/authentication.dart new file mode 100644 index 00000000000..5ca198d41fd --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/authentication.dart @@ -0,0 +1,15 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +abstract class Authentication { + /// Apply authentication settings to header and query params. + void applyToParams(List queryParams, Map headerParams); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_basic_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_basic_auth.dart new file mode 100644 index 00000000000..6dc36a13f49 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_basic_auth.dart @@ -0,0 +1,21 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class HttpBasicAuth implements Authentication { + String username; + String password; + + @override + void applyToParams(List queryParams, Map headerParams) { + final credentials = (username ?? '') + ':' + (password ?? ''); + headerParams['Authorization'] = 'Basic ${base64.encode(utf8.encode(credentials))}'; + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_bearer_auth.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_bearer_auth.dart new file mode 100644 index 00000000000..a23b65fac5e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/http_bearer_auth.dart @@ -0,0 +1,38 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +typedef HttpBearerAuthProvider = String Function(); + +class HttpBearerAuth implements Authentication { + HttpBearerAuth(); + + dynamic _accessToken; + + dynamic get accessToken => _accessToken; + + set accessToken(dynamic accessToken) { + if (accessToken is! String && accessToken is! HttpBearerAuthProvider) { + throw ArgumentError('Type of Bearer accessToken should be a String or a String Function().'); + } + this._accessToken = accessToken; + } + + @override + void applyToParams(List queryParams, Map headerParams) { + if (_accessToken is String) { + headerParams['Authorization'] = 'Bearer $_accessToken'; + } else if (_accessToken is HttpBearerAuthProvider) { + headerParams['Authorization'] = 'Bearer ${_accessToken()}'; + } else { + throw ArgumentError('Type of Bearer accessToken should be a String or a String Function().'); + } + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/oauth.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/oauth.dart new file mode 100644 index 00000000000..c0463ad3900 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/auth/oauth.dart @@ -0,0 +1,23 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +class OAuth implements Authentication { + OAuth({this.accessToken}); + + String accessToken; + + @override + void applyToParams(List queryParams, Map headerParams) { + if (accessToken != null) { + headerParams['Authorization'] = 'Bearer $accessToken'; + } + } +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/additional_properties_class.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/additional_properties_class.dart new file mode 100644 index 00000000000..85a663f6b10 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/additional_properties_class.dart @@ -0,0 +1,60 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class AdditionalPropertiesClass { + /// Returns a new [AdditionalPropertiesClass] instance. + AdditionalPropertiesClass({ + this.mapProperty = const {}, + this.mapOfMapProperty = const {}, + }); + + @JsonKey( + nullable: false, + name: r'map_property', + required: false, + ) + Map mapProperty; + + @JsonKey( + nullable: false, + name: r'map_of_map_property', + required: false, + ) + Map> mapOfMapProperty; + + @override + bool operator ==(Object other) => identical(this, other) || other is AdditionalPropertiesClass && + other.mapProperty == mapProperty && + other.mapOfMapProperty == mapOfMapProperty; + + @override + int get hashCode => + (mapProperty == null ? 0 : mapProperty.hashCode) + + (mapOfMapProperty == null ? 0 : mapOfMapProperty.hashCode); + + + factory AdditionalPropertiesClass.fromJson(Map json) => _$AdditionalPropertiesClassFromJson(json); + + Map toJson() => _$AdditionalPropertiesClassToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/animal.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/animal.dart new file mode 100644 index 00000000000..f8d223ed50e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/animal.dart @@ -0,0 +1,60 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class Animal { + /// Returns a new [Animal] instance. + Animal({ + @required this.className, + this.color = 'red', + }); + + @JsonKey( + nullable: false, + name: r'className', + required: true, + ) + String className; + + @JsonKey( + nullable: false, + name: r'color', + required: false, + ) + String color; + + @override + bool operator ==(Object other) => identical(this, other) || other is Animal && + other.className == className && + other.color == color; + + @override + int get hashCode => + (className == null ? 0 : className.hashCode) + + (color == null ? 0 : color.hashCode); + + + factory Animal.fromJson(Map json) => _$AnimalFromJson(json); + + Map toJson() => _$AnimalToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/api_response.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/api_response.dart new file mode 100644 index 00000000000..414cd202987 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/api_response.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class ApiResponse { + /// Returns a new [ApiResponse] instance. + ApiResponse({ + this.code, + this.type, + this.message, + }); + + @JsonKey( + nullable: false, + name: r'code', + required: false, + ) + int code; + + @JsonKey( + nullable: false, + name: r'type', + required: false, + ) + String type; + + @JsonKey( + nullable: false, + name: r'message', + required: false, + ) + String message; + + @override + bool operator ==(Object other) => identical(this, other) || other is ApiResponse && + other.code == code && + other.type == type && + other.message == message; + + @override + int get hashCode => + (code == null ? 0 : code.hashCode) + + (type == null ? 0 : type.hashCode) + + (message == null ? 0 : message.hashCode); + + + factory ApiResponse.fromJson(Map json) => _$ApiResponseFromJson(json); + + Map toJson() => _$ApiResponseToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_array_of_number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_array_of_number_only.dart new file mode 100644 index 00000000000..969f1f788e6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_array_of_number_only.dart @@ -0,0 +1,50 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class ArrayOfArrayOfNumberOnly { + /// Returns a new [ArrayOfArrayOfNumberOnly] instance. + ArrayOfArrayOfNumberOnly({ + this.arrayArrayNumber = const [], + }); + + @JsonKey( + nullable: false, + name: r'ArrayArrayNumber', + required: false, + ) + List> arrayArrayNumber; + + @override + bool operator ==(Object other) => identical(this, other) || other is ArrayOfArrayOfNumberOnly && + other.arrayArrayNumber == arrayArrayNumber; + + @override + int get hashCode => + (arrayArrayNumber == null ? 0 : arrayArrayNumber.hashCode); + + + factory ArrayOfArrayOfNumberOnly.fromJson(Map json) => _$ArrayOfArrayOfNumberOnlyFromJson(json); + + Map toJson() => _$ArrayOfArrayOfNumberOnlyToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_number_only.dart new file mode 100644 index 00000000000..18c3e29792c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_of_number_only.dart @@ -0,0 +1,50 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class ArrayOfNumberOnly { + /// Returns a new [ArrayOfNumberOnly] instance. + ArrayOfNumberOnly({ + this.arrayNumber = const [], + }); + + @JsonKey( + nullable: false, + name: r'ArrayNumber', + required: false, + ) + List arrayNumber; + + @override + bool operator ==(Object other) => identical(this, other) || other is ArrayOfNumberOnly && + other.arrayNumber == arrayNumber; + + @override + int get hashCode => + (arrayNumber == null ? 0 : arrayNumber.hashCode); + + + factory ArrayOfNumberOnly.fromJson(Map json) => _$ArrayOfNumberOnlyFromJson(json); + + Map toJson() => _$ArrayOfNumberOnlyToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_test.dart new file mode 100644 index 00000000000..f96fca86296 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/array_test.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class ArrayTest { + /// Returns a new [ArrayTest] instance. + ArrayTest({ + this.arrayOfString = const [], + this.arrayArrayOfInteger = const [], + this.arrayArrayOfModel = const [], + }); + + @JsonKey( + nullable: false, + name: r'array_of_string', + required: false, + ) + List arrayOfString; + + @JsonKey( + nullable: false, + name: r'array_array_of_integer', + required: false, + ) + List> arrayArrayOfInteger; + + @JsonKey( + nullable: false, + name: r'array_array_of_model', + required: false, + ) + List> arrayArrayOfModel; + + @override + bool operator ==(Object other) => identical(this, other) || other is ArrayTest && + other.arrayOfString == arrayOfString && + other.arrayArrayOfInteger == arrayArrayOfInteger && + other.arrayArrayOfModel == arrayArrayOfModel; + + @override + int get hashCode => + (arrayOfString == null ? 0 : arrayOfString.hashCode) + + (arrayArrayOfInteger == null ? 0 : arrayArrayOfInteger.hashCode) + + (arrayArrayOfModel == null ? 0 : arrayArrayOfModel.hashCode); + + + factory ArrayTest.fromJson(Map json) => _$ArrayTestFromJson(json); + + Map toJson() => _$ArrayTestToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/capitalization.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/capitalization.dart new file mode 100644 index 00000000000..774e4a0aa04 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/capitalization.dart @@ -0,0 +1,101 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class Capitalization { + /// Returns a new [Capitalization] instance. + Capitalization({ + this.smallCamel, + this.capitalCamel, + this.smallSnake, + this.capitalSnake, + this.sCAETHFlowPoints, + this.ATT_NAME, + }); + + @JsonKey( + nullable: false, + name: r'smallCamel', + required: false, + ) + String smallCamel; + + @JsonKey( + nullable: false, + name: r'CapitalCamel', + required: false, + ) + String capitalCamel; + + @JsonKey( + nullable: false, + name: r'small_Snake', + required: false, + ) + String smallSnake; + + @JsonKey( + nullable: false, + name: r'Capital_Snake', + required: false, + ) + String capitalSnake; + + @JsonKey( + nullable: false, + name: r'SCA_ETH_Flow_Points', + required: false, + ) + String sCAETHFlowPoints; + + /// Name of the pet + @JsonKey( + nullable: false, + name: r'ATT_NAME', + required: false, + ) + String ATT_NAME; + + @override + bool operator ==(Object other) => identical(this, other) || other is Capitalization && + other.smallCamel == smallCamel && + other.capitalCamel == capitalCamel && + other.smallSnake == smallSnake && + other.capitalSnake == capitalSnake && + other.sCAETHFlowPoints == sCAETHFlowPoints && + other.ATT_NAME == ATT_NAME; + + @override + int get hashCode => + (smallCamel == null ? 0 : smallCamel.hashCode) + + (capitalCamel == null ? 0 : capitalCamel.hashCode) + + (smallSnake == null ? 0 : smallSnake.hashCode) + + (capitalSnake == null ? 0 : capitalSnake.hashCode) + + (sCAETHFlowPoints == null ? 0 : sCAETHFlowPoints.hashCode) + + (ATT_NAME == null ? 0 : ATT_NAME.hashCode); + + + factory Capitalization.fromJson(Map json) => _$CapitalizationFromJson(json); + + Map toJson() => _$CapitalizationToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat.dart new file mode 100644 index 00000000000..fe9ff5a5edd --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class Cat { + /// Returns a new [Cat] instance. + Cat({ + @required this.className, + this.color = 'red', + this.declawed, + }); + + @JsonKey( + nullable: false, + name: r'className', + required: true, + ) + String className; + + @JsonKey( + nullable: false, + name: r'color', + required: false, + ) + String color; + + @JsonKey( + nullable: false, + name: r'declawed', + required: false, + ) + bool declawed; + + @override + bool operator ==(Object other) => identical(this, other) || other is Cat && + other.className == className && + other.color == color && + other.declawed == declawed; + + @override + int get hashCode => + (className == null ? 0 : className.hashCode) + + (color == null ? 0 : color.hashCode) + + (declawed == null ? 0 : declawed.hashCode); + + + factory Cat.fromJson(Map json) => _$CatFromJson(json); + + Map toJson() => _$CatToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat_all_of.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat_all_of.dart new file mode 100644 index 00000000000..3fd7c8d0c49 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/cat_all_of.dart @@ -0,0 +1,50 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class CatAllOf { + /// Returns a new [CatAllOf] instance. + CatAllOf({ + this.declawed, + }); + + @JsonKey( + nullable: false, + name: r'declawed', + required: false, + ) + bool declawed; + + @override + bool operator ==(Object other) => identical(this, other) || other is CatAllOf && + other.declawed == declawed; + + @override + int get hashCode => + (declawed == null ? 0 : declawed.hashCode); + + + factory CatAllOf.fromJson(Map json) => _$CatAllOfFromJson(json); + + Map toJson() => _$CatAllOfToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/category.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/category.dart new file mode 100644 index 00000000000..7725d8f4598 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/category.dart @@ -0,0 +1,60 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class Category { + /// Returns a new [Category] instance. + Category({ + this.id, + this.name = 'default-name', + }); + + @JsonKey( + nullable: false, + name: r'id', + required: false, + ) + int id; + + @JsonKey( + nullable: false, + name: r'name', + required: true, + ) + String name; + + @override + bool operator ==(Object other) => identical(this, other) || other is Category && + other.id == id && + other.name == name; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (name == null ? 0 : name.hashCode); + + + factory Category.fromJson(Map json) => _$CategoryFromJson(json); + + Map toJson() => _$CategoryToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/class_model.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/class_model.dart new file mode 100644 index 00000000000..7aee6bcac8d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/class_model.dart @@ -0,0 +1,50 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class ClassModel { + /// Returns a new [ClassModel] instance. + ClassModel({ + this.class_, + }); + + @JsonKey( + nullable: false, + name: r'_class', + required: false, + ) + String class_; + + @override + bool operator ==(Object other) => identical(this, other) || other is ClassModel && + other.class_ == class_; + + @override + int get hashCode => + (class_ == null ? 0 : class_.hashCode); + + + factory ClassModel.fromJson(Map json) => _$ClassModelFromJson(json); + + Map toJson() => _$ClassModelToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog.dart new file mode 100644 index 00000000000..920424afa64 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class Dog { + /// Returns a new [Dog] instance. + Dog({ + @required this.className, + this.color = 'red', + this.breed, + }); + + @JsonKey( + nullable: false, + name: r'className', + required: true, + ) + String className; + + @JsonKey( + nullable: false, + name: r'color', + required: false, + ) + String color; + + @JsonKey( + nullable: false, + name: r'breed', + required: false, + ) + String breed; + + @override + bool operator ==(Object other) => identical(this, other) || other is Dog && + other.className == className && + other.color == color && + other.breed == breed; + + @override + int get hashCode => + (className == null ? 0 : className.hashCode) + + (color == null ? 0 : color.hashCode) + + (breed == null ? 0 : breed.hashCode); + + + factory Dog.fromJson(Map json) => _$DogFromJson(json); + + Map toJson() => _$DogToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog_all_of.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog_all_of.dart new file mode 100644 index 00000000000..ea5d4425121 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/dog_all_of.dart @@ -0,0 +1,50 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class DogAllOf { + /// Returns a new [DogAllOf] instance. + DogAllOf({ + this.breed, + }); + + @JsonKey( + nullable: false, + name: r'breed', + required: false, + ) + String breed; + + @override + bool operator ==(Object other) => identical(this, other) || other is DogAllOf && + other.breed == breed; + + @override + int get hashCode => + (breed == null ? 0 : breed.hashCode); + + + factory DogAllOf.fromJson(Map json) => _$DogAllOfFromJson(json); + + Map toJson() => _$DogAllOfToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_arrays.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_arrays.dart new file mode 100644 index 00000000000..1ca0a07a3fb --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_arrays.dart @@ -0,0 +1,74 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class EnumArrays { + /// Returns a new [EnumArrays] instance. + EnumArrays({ + this.justSymbol, + this.arrayEnum = const [], + }); + + @JsonKey( + nullable: false, + name: r'just_symbol', + required: false, + ) + EnumArraysJustSymbolEnum justSymbol; + + @JsonKey( + nullable: false, + name: r'array_enum', + required: false, + ) + List arrayEnum; + + @override + bool operator ==(Object other) => identical(this, other) || other is EnumArrays && + other.justSymbol == justSymbol && + other.arrayEnum == arrayEnum; + + @override + int get hashCode => + (justSymbol == null ? 0 : justSymbol.hashCode) + + (arrayEnum == null ? 0 : arrayEnum.hashCode); + + + factory EnumArrays.fromJson(Map json) => _$EnumArraysFromJson(json); + + Map toJson() => _$EnumArraysToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + + + +enum EnumArraysJustSymbolEnum { + greaterThanEqual, + dollar, +} + + + +enum EnumArraysArrayEnumEnum { + fish, + crab, +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_class.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_class.dart new file mode 100644 index 00000000000..ac886d3260c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_class.dart @@ -0,0 +1,19 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + + +enum EnumClass { + abc, + efg, + leftParenthesisXyzRightParenthesis, +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_test.dart new file mode 100644 index 00000000000..a6159e20830 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/enum_test.dart @@ -0,0 +1,150 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class EnumTest { + /// Returns a new [EnumTest] instance. + EnumTest({ + this.enumString, + @required this.enumStringRequired, + this.enumInteger, + this.enumNumber, + this.outerEnum, + this.outerEnumInteger, + this.outerEnumDefaultValue, + this.outerEnumIntegerDefaultValue, + }); + + @JsonKey( + nullable: false, + name: r'enum_string', + required: false, + ) + EnumTestEnumStringEnum enumString; + + @JsonKey( + nullable: false, + name: r'enum_string_required', + required: true, + ) + EnumTestEnumStringRequiredEnum enumStringRequired; + + @JsonKey( + nullable: false, + name: r'enum_integer', + required: false, + ) + EnumTestEnumIntegerEnum enumInteger; + + @JsonKey( + nullable: false, + name: r'enum_number', + required: false, + ) + EnumTestEnumNumberEnum enumNumber; + + @JsonKey( + nullable: false, + name: r'outerEnum', + required: false, + ) + OuterEnum outerEnum; + + @JsonKey( + nullable: false, + name: r'outerEnumInteger', + required: false, + ) + OuterEnumInteger outerEnumInteger; + + @JsonKey( + nullable: false, + name: r'outerEnumDefaultValue', + required: false, + ) + OuterEnumDefaultValue outerEnumDefaultValue; + + @JsonKey( + nullable: false, + name: r'outerEnumIntegerDefaultValue', + required: false, + ) + OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue; + + @override + bool operator ==(Object other) => identical(this, other) || other is EnumTest && + other.enumString == enumString && + other.enumStringRequired == enumStringRequired && + other.enumInteger == enumInteger && + other.enumNumber == enumNumber && + other.outerEnum == outerEnum && + other.outerEnumInteger == outerEnumInteger && + other.outerEnumDefaultValue == outerEnumDefaultValue && + other.outerEnumIntegerDefaultValue == outerEnumIntegerDefaultValue; + + @override + int get hashCode => + (enumString == null ? 0 : enumString.hashCode) + + (enumStringRequired == null ? 0 : enumStringRequired.hashCode) + + (enumInteger == null ? 0 : enumInteger.hashCode) + + (enumNumber == null ? 0 : enumNumber.hashCode) + + (outerEnum == null ? 0 : outerEnum.hashCode) + + (outerEnumInteger == null ? 0 : outerEnumInteger.hashCode) + + (outerEnumDefaultValue == null ? 0 : outerEnumDefaultValue.hashCode) + + (outerEnumIntegerDefaultValue == null ? 0 : outerEnumIntegerDefaultValue.hashCode); + + + factory EnumTest.fromJson(Map json) => _$EnumTestFromJson(json); + + Map toJson() => _$EnumTestToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + + + +enum EnumTestEnumStringEnum { + UPPER, + lower, + empty, +} + + + +enum EnumTestEnumStringRequiredEnum { + UPPER, + lower, + empty, +} + + + +enum EnumTestEnumIntegerEnum { + number1, + numberNegative1, +} + + + +enum EnumTestEnumNumberEnum { + number1Period1, + numberNegative1Period2, +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/file_schema_test_class.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/file_schema_test_class.dart new file mode 100644 index 00000000000..432ed75edb1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/file_schema_test_class.dart @@ -0,0 +1,60 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class FileSchemaTestClass { + /// Returns a new [FileSchemaTestClass] instance. + FileSchemaTestClass({ + this.file, + this.files = const [], + }); + + @JsonKey( + nullable: false, + name: r'file', + required: false, + ) + ModelFile file; + + @JsonKey( + nullable: false, + name: r'files', + required: false, + ) + List files; + + @override + bool operator ==(Object other) => identical(this, other) || other is FileSchemaTestClass && + other.file == file && + other.files == files; + + @override + int get hashCode => + (file == null ? 0 : file.hashCode) + + (files == null ? 0 : files.hashCode); + + + factory FileSchemaTestClass.fromJson(Map json) => _$FileSchemaTestClassFromJson(json); + + Map toJson() => _$FileSchemaTestClassToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/foo.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/foo.dart new file mode 100644 index 00000000000..90cecc2a17d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/foo.dart @@ -0,0 +1,50 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class Foo { + /// Returns a new [Foo] instance. + Foo({ + this.bar = 'bar', + }); + + @JsonKey( + nullable: false, + name: r'bar', + required: false, + ) + String bar; + + @override + bool operator ==(Object other) => identical(this, other) || other is Foo && + other.bar == bar; + + @override + int get hashCode => + (bar == null ? 0 : bar.hashCode); + + + factory Foo.fromJson(Map json) => _$FooFromJson(json); + + Map toJson() => _$FooToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/format_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/format_test.dart new file mode 100644 index 00000000000..23e4fe87051 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/format_test.dart @@ -0,0 +1,208 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class FormatTest { + /// Returns a new [FormatTest] instance. + FormatTest({ + this.integer, + this.int32, + this.int64, + @required this.number, + this.float, + this.double_, + this.decimal, + this.string, + @required this.byte, + this.binary, + @required this.date, + this.dateTime, + this.uuid, + @required this.password, + this.patternWithDigits, + this.patternWithDigitsAndDelimiter, + }); + + // minimum: 10 + // maximum: 100 + @JsonKey( + nullable: false, + name: r'integer', + required: false, + ) + int integer; + + // minimum: 20 + // maximum: 200 + @JsonKey( + nullable: false, + name: r'int32', + required: false, + ) + int int32; + + @JsonKey( + nullable: false, + name: r'int64', + required: false, + ) + int int64; + + // minimum: 32.1 + // maximum: 543.2 + @JsonKey( + nullable: false, + name: r'number', + required: true, + ) + num number; + + // minimum: 54.3 + // maximum: 987.6 + @JsonKey( + nullable: false, + name: r'float', + required: false, + ) + double float; + + // minimum: 67.8 + // maximum: 123.4 + @JsonKey( + nullable: false, + name: r'double', + required: false, + ) + double double_; + + @JsonKey( + nullable: false, + name: r'decimal', + required: false, + ) + double decimal; + + @JsonKey( + nullable: false, + name: r'string', + required: false, + ) + String string; + + @JsonKey( + nullable: false, + name: r'byte', + required: true, + ) + String byte; + + @JsonKey(ignore: true) + MultipartFile binary; + + @JsonKey( + nullable: false, + name: r'date', + required: true, + ) + DateTime date; + + @JsonKey( + nullable: false, + name: r'dateTime', + required: false, + ) + DateTime dateTime; + + @JsonKey( + nullable: false, + name: r'uuid', + required: false, + ) + String uuid; + + @JsonKey( + nullable: false, + name: r'password', + required: true, + ) + String password; + + /// A string that is a 10 digit number. Can have leading zeros. + @JsonKey( + nullable: false, + name: r'pattern_with_digits', + required: false, + ) + String patternWithDigits; + + /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + @JsonKey( + nullable: false, + name: r'pattern_with_digits_and_delimiter', + required: false, + ) + String patternWithDigitsAndDelimiter; + + @override + bool operator ==(Object other) => identical(this, other) || other is FormatTest && + other.integer == integer && + other.int32 == int32 && + other.int64 == int64 && + other.number == number && + other.float == float && + other.double_ == double_ && + other.decimal == decimal && + other.string == string && + other.byte == byte && + other.binary == binary && + other.date == date && + other.dateTime == dateTime && + other.uuid == uuid && + other.password == password && + other.patternWithDigits == patternWithDigits && + other.patternWithDigitsAndDelimiter == patternWithDigitsAndDelimiter; + + @override + int get hashCode => + (integer == null ? 0 : integer.hashCode) + + (int32 == null ? 0 : int32.hashCode) + + (int64 == null ? 0 : int64.hashCode) + + (number == null ? 0 : number.hashCode) + + (float == null ? 0 : float.hashCode) + + (double_ == null ? 0 : double_.hashCode) + + (decimal == null ? 0 : decimal.hashCode) + + (string == null ? 0 : string.hashCode) + + (byte == null ? 0 : byte.hashCode) + + (binary == null ? 0 : binary.hashCode) + + (date == null ? 0 : date.hashCode) + + (dateTime == null ? 0 : dateTime.hashCode) + + (uuid == null ? 0 : uuid.hashCode) + + (password == null ? 0 : password.hashCode) + + (patternWithDigits == null ? 0 : patternWithDigits.hashCode) + + (patternWithDigitsAndDelimiter == null ? 0 : patternWithDigitsAndDelimiter.hashCode); + + + factory FormatTest.fromJson(Map json) => _$FormatTestFromJson(json); + + Map toJson() => _$FormatTestToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/has_only_read_only.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/has_only_read_only.dart new file mode 100644 index 00000000000..75e18e568ae --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/has_only_read_only.dart @@ -0,0 +1,60 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class HasOnlyReadOnly { + /// Returns a new [HasOnlyReadOnly] instance. + HasOnlyReadOnly({ + this.bar, + this.foo, + }); + + @JsonKey( + nullable: false, + name: r'bar', + required: false, + ) + String bar; + + @JsonKey( + nullable: false, + name: r'foo', + required: false, + ) + String foo; + + @override + bool operator ==(Object other) => identical(this, other) || other is HasOnlyReadOnly && + other.bar == bar && + other.foo == foo; + + @override + int get hashCode => + (bar == null ? 0 : bar.hashCode) + + (foo == null ? 0 : foo.hashCode); + + + factory HasOnlyReadOnly.fromJson(Map json) => _$HasOnlyReadOnlyFromJson(json); + + Map toJson() => _$HasOnlyReadOnlyToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/health_check_result.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/health_check_result.dart new file mode 100644 index 00000000000..3150d9df5a5 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/health_check_result.dart @@ -0,0 +1,50 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class HealthCheckResult { + /// Returns a new [HealthCheckResult] instance. + HealthCheckResult({ + this.nullableMessage, + }); + + @JsonKey( + nullable: false, + name: r'NullableMessage', + required: false, + ) + String nullableMessage; + + @override + bool operator ==(Object other) => identical(this, other) || other is HealthCheckResult && + other.nullableMessage == nullableMessage; + + @override + int get hashCode => + (nullableMessage == null ? 0 : nullableMessage.hashCode); + + + factory HealthCheckResult.fromJson(Map json) => _$HealthCheckResultFromJson(json); + + Map toJson() => _$HealthCheckResultToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/inline_response_default.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/inline_response_default.dart new file mode 100644 index 00000000000..bff0a6ea80b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/inline_response_default.dart @@ -0,0 +1,50 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class InlineResponseDefault { + /// Returns a new [InlineResponseDefault] instance. + InlineResponseDefault({ + this.string, + }); + + @JsonKey( + nullable: false, + name: r'string', + required: false, + ) + Foo string; + + @override + bool operator ==(Object other) => identical(this, other) || other is InlineResponseDefault && + other.string == string; + + @override + int get hashCode => + (string == null ? 0 : string.hashCode); + + + factory InlineResponseDefault.fromJson(Map json) => _$InlineResponseDefaultFromJson(json); + + Map toJson() => _$InlineResponseDefaultToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/map_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/map_test.dart new file mode 100644 index 00000000000..2080fe0929a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/map_test.dart @@ -0,0 +1,87 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class MapTest { + /// Returns a new [MapTest] instance. + MapTest({ + this.mapMapOfString = const {}, + this.mapOfEnumString = const {}, + this.directMap = const {}, + this.indirectMap = const {}, + }); + + @JsonKey( + nullable: false, + name: r'map_map_of_string', + required: false, + ) + Map> mapMapOfString; + + @JsonKey( + nullable: false, + name: r'map_of_enum_string', + required: false, + ) + Map mapOfEnumString; + + @JsonKey( + nullable: false, + name: r'direct_map', + required: false, + ) + Map directMap; + + @JsonKey( + nullable: false, + name: r'indirect_map', + required: false, + ) + Map indirectMap; + + @override + bool operator ==(Object other) => identical(this, other) || other is MapTest && + other.mapMapOfString == mapMapOfString && + other.mapOfEnumString == mapOfEnumString && + other.directMap == directMap && + other.indirectMap == indirectMap; + + @override + int get hashCode => + (mapMapOfString == null ? 0 : mapMapOfString.hashCode) + + (mapOfEnumString == null ? 0 : mapOfEnumString.hashCode) + + (directMap == null ? 0 : directMap.hashCode) + + (indirectMap == null ? 0 : indirectMap.hashCode); + + + factory MapTest.fromJson(Map json) => _$MapTestFromJson(json); + + Map toJson() => _$MapTestToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + + + +enum MapTestMapOfEnumStringEnum { + UPPER, + lower, +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart new file mode 100644 index 00000000000..634753e657e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/mixed_properties_and_additional_properties_class.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class MixedPropertiesAndAdditionalPropertiesClass { + /// Returns a new [MixedPropertiesAndAdditionalPropertiesClass] instance. + MixedPropertiesAndAdditionalPropertiesClass({ + this.uuid, + this.dateTime, + this.map = const {}, + }); + + @JsonKey( + nullable: false, + name: r'uuid', + required: false, + ) + String uuid; + + @JsonKey( + nullable: false, + name: r'dateTime', + required: false, + ) + DateTime dateTime; + + @JsonKey( + nullable: false, + name: r'map', + required: false, + ) + Map map; + + @override + bool operator ==(Object other) => identical(this, other) || other is MixedPropertiesAndAdditionalPropertiesClass && + other.uuid == uuid && + other.dateTime == dateTime && + other.map == map; + + @override + int get hashCode => + (uuid == null ? 0 : uuid.hashCode) + + (dateTime == null ? 0 : dateTime.hashCode) + + (map == null ? 0 : map.hashCode); + + + factory MixedPropertiesAndAdditionalPropertiesClass.fromJson(Map json) => _$MixedPropertiesAndAdditionalPropertiesClassFromJson(json); + + Map toJson() => _$MixedPropertiesAndAdditionalPropertiesClassToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model200_response.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model200_response.dart new file mode 100644 index 00000000000..282ee428418 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model200_response.dart @@ -0,0 +1,60 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class Model200Response { + /// Returns a new [Model200Response] instance. + Model200Response({ + this.name, + this.class_, + }); + + @JsonKey( + nullable: false, + name: r'name', + required: false, + ) + int name; + + @JsonKey( + nullable: false, + name: r'class', + required: false, + ) + String class_; + + @override + bool operator ==(Object other) => identical(this, other) || other is Model200Response && + other.name == name && + other.class_ == class_; + + @override + int get hashCode => + (name == null ? 0 : name.hashCode) + + (class_ == null ? 0 : class_.hashCode); + + + factory Model200Response.fromJson(Map json) => _$Model200ResponseFromJson(json); + + Map toJson() => _$Model200ResponseToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_client.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_client.dart new file mode 100644 index 00000000000..50336403c7c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_client.dart @@ -0,0 +1,50 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class ModelClient { + /// Returns a new [ModelClient] instance. + ModelClient({ + this.client, + }); + + @JsonKey( + nullable: false, + name: r'client', + required: false, + ) + String client; + + @override + bool operator ==(Object other) => identical(this, other) || other is ModelClient && + other.client == client; + + @override + int get hashCode => + (client == null ? 0 : client.hashCode); + + + factory ModelClient.fromJson(Map json) => _$ModelClientFromJson(json); + + Map toJson() => _$ModelClientToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_file.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_file.dart new file mode 100644 index 00000000000..7065bab6fb9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_file.dart @@ -0,0 +1,51 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class ModelFile { + /// Returns a new [ModelFile] instance. + ModelFile({ + this.sourceURI, + }); + + /// Test capitalization + @JsonKey( + nullable: false, + name: r'sourceURI', + required: false, + ) + String sourceURI; + + @override + bool operator ==(Object other) => identical(this, other) || other is ModelFile && + other.sourceURI == sourceURI; + + @override + int get hashCode => + (sourceURI == null ? 0 : sourceURI.hashCode); + + + factory ModelFile.fromJson(Map json) => _$ModelFileFromJson(json); + + Map toJson() => _$ModelFileToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_list.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_list.dart new file mode 100644 index 00000000000..55ac52ce234 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_list.dart @@ -0,0 +1,50 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class ModelList { + /// Returns a new [ModelList] instance. + ModelList({ + this.n123list, + }); + + @JsonKey( + nullable: false, + name: r'123-list', + required: false, + ) + String n123list; + + @override + bool operator ==(Object other) => identical(this, other) || other is ModelList && + other.n123list == n123list; + + @override + int get hashCode => + (n123list == null ? 0 : n123list.hashCode); + + + factory ModelList.fromJson(Map json) => _$ModelListFromJson(json); + + Map toJson() => _$ModelListToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_return.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_return.dart new file mode 100644 index 00000000000..583987a9672 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/model_return.dart @@ -0,0 +1,50 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class ModelReturn { + /// Returns a new [ModelReturn] instance. + ModelReturn({ + this.return_, + }); + + @JsonKey( + nullable: false, + name: r'return', + required: false, + ) + int return_; + + @override + bool operator ==(Object other) => identical(this, other) || other is ModelReturn && + other.return_ == return_; + + @override + int get hashCode => + (return_ == null ? 0 : return_.hashCode); + + + factory ModelReturn.fromJson(Map json) => _$ModelReturnFromJson(json); + + Map toJson() => _$ModelReturnToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/name.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/name.dart new file mode 100644 index 00000000000..f9916982eff --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/name.dart @@ -0,0 +1,80 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class Name { + /// Returns a new [Name] instance. + Name({ + @required this.name, + this.snakeCase, + this.property, + this.n123number, + }); + + @JsonKey( + nullable: false, + name: r'name', + required: true, + ) + int name; + + @JsonKey( + nullable: false, + name: r'snake_case', + required: false, + ) + int snakeCase; + + @JsonKey( + nullable: false, + name: r'property', + required: false, + ) + String property; + + @JsonKey( + nullable: false, + name: r'123Number', + required: false, + ) + int n123number; + + @override + bool operator ==(Object other) => identical(this, other) || other is Name && + other.name == name && + other.snakeCase == snakeCase && + other.property == property && + other.n123number == n123number; + + @override + int get hashCode => + (name == null ? 0 : name.hashCode) + + (snakeCase == null ? 0 : snakeCase.hashCode) + + (property == null ? 0 : property.hashCode) + + (n123number == null ? 0 : n123number.hashCode); + + + factory Name.fromJson(Map json) => _$NameFromJson(json); + + Map toJson() => _$NameToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/nullable_class.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/nullable_class.dart new file mode 100644 index 00000000000..42c21d5c590 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/nullable_class.dart @@ -0,0 +1,160 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class NullableClass { + /// Returns a new [NullableClass] instance. + NullableClass({ + this.integerProp, + this.numberProp, + this.booleanProp, + this.stringProp, + this.dateProp, + this.datetimeProp, + this.arrayNullableProp, + this.arrayAndItemsNullableProp, + this.arrayItemsNullable = const [], + this.objectNullableProp, + this.objectAndItemsNullableProp, + this.objectItemsNullable = const {}, + }); + + @JsonKey( + nullable: false, + name: r'integer_prop', + required: false, + ) + int integerProp; + + @JsonKey( + nullable: false, + name: r'number_prop', + required: false, + ) + num numberProp; + + @JsonKey( + nullable: false, + name: r'boolean_prop', + required: false, + ) + bool booleanProp; + + @JsonKey( + nullable: false, + name: r'string_prop', + required: false, + ) + String stringProp; + + @JsonKey( + nullable: false, + name: r'date_prop', + required: false, + ) + DateTime dateProp; + + @JsonKey( + nullable: false, + name: r'datetime_prop', + required: false, + ) + DateTime datetimeProp; + + @JsonKey( + nullable: false, + name: r'array_nullable_prop', + required: false, + ) + List arrayNullableProp; + + @JsonKey( + nullable: false, + name: r'array_and_items_nullable_prop', + required: false, + ) + List arrayAndItemsNullableProp; + + @JsonKey( + nullable: false, + name: r'array_items_nullable', + required: false, + ) + List arrayItemsNullable; + + @JsonKey( + nullable: false, + name: r'object_nullable_prop', + required: false, + ) + Map objectNullableProp; + + @JsonKey( + nullable: false, + name: r'object_and_items_nullable_prop', + required: false, + ) + Map objectAndItemsNullableProp; + + @JsonKey( + nullable: false, + name: r'object_items_nullable', + required: false, + ) + Map objectItemsNullable; + + @override + bool operator ==(Object other) => identical(this, other) || other is NullableClass && + other.integerProp == integerProp && + other.numberProp == numberProp && + other.booleanProp == booleanProp && + other.stringProp == stringProp && + other.dateProp == dateProp && + other.datetimeProp == datetimeProp && + other.arrayNullableProp == arrayNullableProp && + other.arrayAndItemsNullableProp == arrayAndItemsNullableProp && + other.arrayItemsNullable == arrayItemsNullable && + other.objectNullableProp == objectNullableProp && + other.objectAndItemsNullableProp == objectAndItemsNullableProp && + other.objectItemsNullable == objectItemsNullable; + + @override + int get hashCode => + (integerProp == null ? 0 : integerProp.hashCode) + + (numberProp == null ? 0 : numberProp.hashCode) + + (booleanProp == null ? 0 : booleanProp.hashCode) + + (stringProp == null ? 0 : stringProp.hashCode) + + (dateProp == null ? 0 : dateProp.hashCode) + + (datetimeProp == null ? 0 : datetimeProp.hashCode) + + (arrayNullableProp == null ? 0 : arrayNullableProp.hashCode) + + (arrayAndItemsNullableProp == null ? 0 : arrayAndItemsNullableProp.hashCode) + + (arrayItemsNullable == null ? 0 : arrayItemsNullable.hashCode) + + (objectNullableProp == null ? 0 : objectNullableProp.hashCode) + + (objectAndItemsNullableProp == null ? 0 : objectAndItemsNullableProp.hashCode) + + (objectItemsNullable == null ? 0 : objectItemsNullable.hashCode); + + + factory NullableClass.fromJson(Map json) => _$NullableClassFromJson(json); + + Map toJson() => _$NullableClassToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/number_only.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/number_only.dart new file mode 100644 index 00000000000..eaa794ceed6 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/number_only.dart @@ -0,0 +1,50 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class NumberOnly { + /// Returns a new [NumberOnly] instance. + NumberOnly({ + this.justNumber, + }); + + @JsonKey( + nullable: false, + name: r'JustNumber', + required: false, + ) + num justNumber; + + @override + bool operator ==(Object other) => identical(this, other) || other is NumberOnly && + other.justNumber == justNumber; + + @override + int get hashCode => + (justNumber == null ? 0 : justNumber.hashCode); + + + factory NumberOnly.fromJson(Map json) => _$NumberOnlyFromJson(json); + + Map toJson() => _$NumberOnlyToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/order.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/order.dart new file mode 100644 index 00000000000..e42c82c5cf1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/order.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class Order { + /// Returns a new [Order] instance. + Order({ + this.id, + this.petId, + this.quantity, + this.shipDate, + this.status, + this.complete = false, + }); + + @JsonKey( + nullable: false, + name: r'id', + required: false, + ) + int id; + + @JsonKey( + nullable: false, + name: r'petId', + required: false, + ) + int petId; + + @JsonKey( + nullable: false, + name: r'quantity', + required: false, + ) + int quantity; + + @JsonKey( + nullable: false, + name: r'shipDate', + required: false, + ) + DateTime shipDate; + + /// Order Status + @JsonKey( + nullable: false, + name: r'status', + required: false, + ) + OrderStatusEnum status; + + @JsonKey( + nullable: false, + name: r'complete', + required: false, + ) + bool complete; + + @override + bool operator ==(Object other) => identical(this, other) || other is Order && + other.id == id && + other.petId == petId && + other.quantity == quantity && + other.shipDate == shipDate && + other.status == status && + other.complete == complete; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (petId == null ? 0 : petId.hashCode) + + (quantity == null ? 0 : quantity.hashCode) + + (shipDate == null ? 0 : shipDate.hashCode) + + (status == null ? 0 : status.hashCode) + + (complete == null ? 0 : complete.hashCode); + + + factory Order.fromJson(Map json) => _$OrderFromJson(json); + + Map toJson() => _$OrderToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + +/// Order Status + +enum OrderStatusEnum { + placed, + approved, + delivered, +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_composite.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_composite.dart new file mode 100644 index 00000000000..2ecc5a2cc3b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_composite.dart @@ -0,0 +1,70 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class OuterComposite { + /// Returns a new [OuterComposite] instance. + OuterComposite({ + this.myNumber, + this.myString, + this.myBoolean, + }); + + @JsonKey( + nullable: false, + name: r'my_number', + required: false, + ) + num myNumber; + + @JsonKey( + nullable: false, + name: r'my_string', + required: false, + ) + String myString; + + @JsonKey( + nullable: false, + name: r'my_boolean', + required: false, + ) + bool myBoolean; + + @override + bool operator ==(Object other) => identical(this, other) || other is OuterComposite && + other.myNumber == myNumber && + other.myString == myString && + other.myBoolean == myBoolean; + + @override + int get hashCode => + (myNumber == null ? 0 : myNumber.hashCode) + + (myString == null ? 0 : myString.hashCode) + + (myBoolean == null ? 0 : myBoolean.hashCode); + + + factory OuterComposite.fromJson(Map json) => _$OuterCompositeFromJson(json); + + Map toJson() => _$OuterCompositeToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum.dart new file mode 100644 index 00000000000..a31f359e27f --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum.dart @@ -0,0 +1,19 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + + +enum OuterEnum { + placed, + approved, + delivered, +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_default_value.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_default_value.dart new file mode 100644 index 00000000000..af1b06d000c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_default_value.dart @@ -0,0 +1,19 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + + +enum OuterEnumDefaultValue { + placed, + approved, + delivered, +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer.dart new file mode 100644 index 00000000000..a4c734c5a39 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer.dart @@ -0,0 +1,19 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + + +enum OuterEnumInteger { + number0, + number1, + number2, +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer_default_value.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer_default_value.dart new file mode 100644 index 00000000000..d37258cdada --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_enum_integer_default_value.dart @@ -0,0 +1,19 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + + + +enum OuterEnumIntegerDefaultValue { + number0, + number1, + number2, +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/pet.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/pet.dart new file mode 100644 index 00000000000..b93a9a1100f --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/pet.dart @@ -0,0 +1,109 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class Pet { + /// Returns a new [Pet] instance. + Pet({ + this.id, + this.category, + @required this.name, + this.photoUrls = const {}, + this.tags = const [], + this.status, + }); + + @JsonKey( + nullable: false, + name: r'id', + required: false, + ) + int id; + + @JsonKey( + nullable: false, + name: r'category', + required: false, + ) + Category category; + + @JsonKey( + nullable: false, + name: r'name', + required: true, + ) + String name; + + @JsonKey( + nullable: false, + name: r'photoUrls', + required: true, + ) + Set photoUrls; + + @JsonKey( + nullable: false, + name: r'tags', + required: false, + ) + List tags; + + /// pet status in the store + @JsonKey( + nullable: false, + name: r'status', + required: false, + ) + PetStatusEnum status; + + @override + bool operator ==(Object other) => identical(this, other) || other is Pet && + other.id == id && + other.category == category && + other.name == name && + other.photoUrls == photoUrls && + other.tags == tags && + other.status == status; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (category == null ? 0 : category.hashCode) + + (name == null ? 0 : name.hashCode) + + (photoUrls == null ? 0 : photoUrls.hashCode) + + (tags == null ? 0 : tags.hashCode) + + (status == null ? 0 : status.hashCode); + + + factory Pet.fromJson(Map json) => _$PetFromJson(json); + + Map toJson() => _$PetToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + +/// pet status in the store + +enum PetStatusEnum { + available, + pending, + sold, +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/read_only_first.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/read_only_first.dart new file mode 100644 index 00000000000..2a69d90d58e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/read_only_first.dart @@ -0,0 +1,60 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class ReadOnlyFirst { + /// Returns a new [ReadOnlyFirst] instance. + ReadOnlyFirst({ + this.bar, + this.baz, + }); + + @JsonKey( + nullable: false, + name: r'bar', + required: false, + ) + String bar; + + @JsonKey( + nullable: false, + name: r'baz', + required: false, + ) + String baz; + + @override + bool operator ==(Object other) => identical(this, other) || other is ReadOnlyFirst && + other.bar == bar && + other.baz == baz; + + @override + int get hashCode => + (bar == null ? 0 : bar.hashCode) + + (baz == null ? 0 : baz.hashCode); + + + factory ReadOnlyFirst.fromJson(Map json) => _$ReadOnlyFirstFromJson(json); + + Map toJson() => _$ReadOnlyFirstToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/special_model_name.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/special_model_name.dart new file mode 100644 index 00000000000..b856f4c28b3 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/special_model_name.dart @@ -0,0 +1,50 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class SpecialModelName { + /// Returns a new [SpecialModelName] instance. + SpecialModelName({ + this.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket, + }); + + @JsonKey( + nullable: false, + name: r'$special[property.name]', + required: false, + ) + int dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; + + @override + bool operator ==(Object other) => identical(this, other) || other is SpecialModelName && + other.dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket == dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket; + + @override + int get hashCode => + (dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket == null ? 0 : dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket.hashCode); + + + factory SpecialModelName.fromJson(Map json) => _$SpecialModelNameFromJson(json); + + Map toJson() => _$SpecialModelNameToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/tag.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/tag.dart new file mode 100644 index 00000000000..50302654c15 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/tag.dart @@ -0,0 +1,60 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class Tag { + /// Returns a new [Tag] instance. + Tag({ + this.id, + this.name, + }); + + @JsonKey( + nullable: false, + name: r'id', + required: false, + ) + int id; + + @JsonKey( + nullable: false, + name: r'name', + required: false, + ) + String name; + + @override + bool operator ==(Object other) => identical(this, other) || other is Tag && + other.id == id && + other.name == name; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (name == null ? 0 : name.hashCode); + + + factory Tag.fromJson(Map json) => _$TagFromJson(json); + + Map toJson() => _$TagToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/user.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/user.dart new file mode 100644 index 00000000000..e6cfe4e4a26 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/user.dart @@ -0,0 +1,121 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +@JsonSerializable( + checked: true, + createToJson: true, + disallowUnrecognizedKeys: true, + explicitToJson: true, +) +class User { + /// Returns a new [User] instance. + User({ + this.id, + this.username, + this.firstName, + this.lastName, + this.email, + this.password, + this.phone, + this.userStatus, + }); + + @JsonKey( + nullable: false, + name: r'id', + required: false, + ) + int id; + + @JsonKey( + nullable: false, + name: r'username', + required: false, + ) + String username; + + @JsonKey( + nullable: false, + name: r'firstName', + required: false, + ) + String firstName; + + @JsonKey( + nullable: false, + name: r'lastName', + required: false, + ) + String lastName; + + @JsonKey( + nullable: false, + name: r'email', + required: false, + ) + String email; + + @JsonKey( + nullable: false, + name: r'password', + required: false, + ) + String password; + + @JsonKey( + nullable: false, + name: r'phone', + required: false, + ) + String phone; + + /// User Status + @JsonKey( + nullable: false, + name: r'userStatus', + required: false, + ) + int userStatus; + + @override + bool operator ==(Object other) => identical(this, other) || other is User && + other.id == id && + other.username == username && + other.firstName == firstName && + other.lastName == lastName && + other.email == email && + other.password == password && + other.phone == phone && + other.userStatus == userStatus; + + @override + int get hashCode => + (id == null ? 0 : id.hashCode) + + (username == null ? 0 : username.hashCode) + + (firstName == null ? 0 : firstName.hashCode) + + (lastName == null ? 0 : lastName.hashCode) + + (email == null ? 0 : email.hashCode) + + (password == null ? 0 : password.hashCode) + + (phone == null ? 0 : phone.hashCode) + + (userStatus == null ? 0 : userStatus.hashCode); + + + factory User.fromJson(Map json) => _$UserFromJson(json); + + Map toJson() => _$UserToJson(this); + + @override + String toString() { + return toJson().toString(); + } + +} + diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/pubspec.yaml b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/pubspec.yaml new file mode 100644 index 00000000000..a54b8ac2006 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/pubspec.yaml @@ -0,0 +1,21 @@ +# +# AUTO-GENERATED FILE, DO NOT MODIFY! +# + +name: 'openapi' +version: '1.0.0' +description: 'OpenAPI API client' +authors: + - 'Author ' +homepage: 'homepage' +environment: + sdk: '>=2.0.0 <3.0.0' +dependencies: + http: '>=0.12.0 <0.13.0' + intl: '^0.16.1' + meta: '^1.1.8' + json_annotation: '^3.1.1' +dev_dependencies: + test: '>=1.3.0 <1.16.0' + build_runner: '^1.0.0' + json_serializable: '^3.5.1' diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/additional_properties_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/additional_properties_class_test.dart new file mode 100644 index 00000000000..937fcb45efe --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/additional_properties_class_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for AdditionalPropertiesClass +void main() { + final instance = AdditionalPropertiesClass(); + + group('test AdditionalPropertiesClass', () { + // Map mapProperty (default value: const {}) + test('to test the property `mapProperty`', () async { + // TODO + }); + + // Map> mapOfMapProperty (default value: const {}) + test('to test the property `mapOfMapProperty`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/animal_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/animal_test.dart new file mode 100644 index 00000000000..f8fbea61abc --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/animal_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Animal +void main() { + final instance = Animal(); + + group('test Animal', () { + // String className + test('to test the property `className`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/another_fake_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/another_fake_api_test.dart new file mode 100644 index 00000000000..355b4140bdd --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/another_fake_api_test.dart @@ -0,0 +1,29 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for AnotherFakeApi +void main() { + final instance = AnotherFakeApi(); + + group('tests for AnotherFakeApi', () { + // To test special tags + // + // To test special tags and operation ID starting with number + // + //Future call123testSpecialTags(ModelClient modelClient) async + test('test call123testSpecialTags', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/api_response_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/api_response_test.dart new file mode 100644 index 00000000000..ea8360134e8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/api_response_test.dart @@ -0,0 +1,27 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ApiResponse +void main() { + final instance = ApiResponse(); + + group('test ApiResponse', () { + // int code + test('to test the property `code`', () async { + // TODO + }); + + // String type + test('to test the property `type`', () async { + // TODO + }); + + // String message + test('to test the property `message`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_of_array_of_number_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_of_array_of_number_only_test.dart new file mode 100644 index 00000000000..a7d4d3a630d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_of_array_of_number_only_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ArrayOfArrayOfNumberOnly +void main() { + final instance = ArrayOfArrayOfNumberOnly(); + + group('test ArrayOfArrayOfNumberOnly', () { + // List> arrayArrayNumber (default value: const []) + test('to test the property `arrayArrayNumber`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_of_number_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_of_number_only_test.dart new file mode 100644 index 00000000000..99d89e84506 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_of_number_only_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ArrayOfNumberOnly +void main() { + final instance = ArrayOfNumberOnly(); + + group('test ArrayOfNumberOnly', () { + // List arrayNumber (default value: const []) + test('to test the property `arrayNumber`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_test_test.dart new file mode 100644 index 00000000000..c5f4b7a71fc --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/array_test_test.dart @@ -0,0 +1,27 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ArrayTest +void main() { + final instance = ArrayTest(); + + group('test ArrayTest', () { + // List arrayOfString (default value: const []) + test('to test the property `arrayOfString`', () async { + // TODO + }); + + // List> arrayArrayOfInteger (default value: const []) + test('to test the property `arrayArrayOfInteger`', () async { + // TODO + }); + + // List> arrayArrayOfModel (default value: const []) + test('to test the property `arrayArrayOfModel`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/capitalization_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/capitalization_test.dart new file mode 100644 index 00000000000..07f7e7399ed --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/capitalization_test.dart @@ -0,0 +1,43 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Capitalization +void main() { + final instance = Capitalization(); + + group('test Capitalization', () { + // String smallCamel + test('to test the property `smallCamel`', () async { + // TODO + }); + + // String capitalCamel + test('to test the property `capitalCamel`', () async { + // TODO + }); + + // String smallSnake + test('to test the property `smallSnake`', () async { + // TODO + }); + + // String capitalSnake + test('to test the property `capitalSnake`', () async { + // TODO + }); + + // String sCAETHFlowPoints + test('to test the property `sCAETHFlowPoints`', () async { + // TODO + }); + + // Name of the pet + // String ATT_NAME + test('to test the property `ATT_NAME`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/cat_all_of_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/cat_all_of_test.dart new file mode 100644 index 00000000000..664b629b41a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/cat_all_of_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for CatAllOf +void main() { + final instance = CatAllOf(); + + group('test CatAllOf', () { + // bool declawed + test('to test the property `declawed`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/cat_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/cat_test.dart new file mode 100644 index 00000000000..a75246ae59a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/cat_test.dart @@ -0,0 +1,27 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Cat +void main() { + final instance = Cat(); + + group('test Cat', () { + // String className + test('to test the property `className`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + + // bool declawed + test('to test the property `declawed`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/category_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/category_test.dart new file mode 100644 index 00000000000..6c0b5190dff --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/category_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Category +void main() { + final instance = Category(); + + group('test Category', () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String name (default value: 'default-name') + test('to test the property `name`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/class_model_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/class_model_test.dart new file mode 100644 index 00000000000..b7593229d61 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/class_model_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ClassModel +void main() { + final instance = ClassModel(); + + group('test ClassModel', () { + // String class_ + test('to test the property `class_`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/default_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/default_api_test.dart new file mode 100644 index 00000000000..2756c463df1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/default_api_test.dart @@ -0,0 +1,25 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for DefaultApi +void main() { + final instance = DefaultApi(); + + group('tests for DefaultApi', () { + //Future fooGet() async + test('test fooGet', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/dog_all_of_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/dog_all_of_test.dart new file mode 100644 index 00000000000..b8e627159a1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/dog_all_of_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for DogAllOf +void main() { + final instance = DogAllOf(); + + group('test DogAllOf', () { + // String breed + test('to test the property `breed`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/dog_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/dog_test.dart new file mode 100644 index 00000000000..bdcc2e4c73b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/dog_test.dart @@ -0,0 +1,27 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Dog +void main() { + final instance = Dog(); + + group('test Dog', () { + // String className + test('to test the property `className`', () async { + // TODO + }); + + // String color (default value: 'red') + test('to test the property `color`', () async { + // TODO + }); + + // String breed + test('to test the property `breed`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_arrays_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_arrays_test.dart new file mode 100644 index 00000000000..5f54b232c6b --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_arrays_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for EnumArrays +void main() { + final instance = EnumArrays(); + + group('test EnumArrays', () { + // String justSymbol + test('to test the property `justSymbol`', () async { + // TODO + }); + + // List arrayEnum (default value: const []) + test('to test the property `arrayEnum`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_class_test.dart new file mode 100644 index 00000000000..09cdd468cea --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_class_test.dart @@ -0,0 +1,11 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for EnumClass +void main() { + + group('test EnumClass', () { + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_test_test.dart new file mode 100644 index 00000000000..50569c6a9d4 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/enum_test_test.dart @@ -0,0 +1,52 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for EnumTest +void main() { + final instance = EnumTest(); + + group('test EnumTest', () { + // String enumString + test('to test the property `enumString`', () async { + // TODO + }); + + // String enumStringRequired + test('to test the property `enumStringRequired`', () async { + // TODO + }); + + // int enumInteger + test('to test the property `enumInteger`', () async { + // TODO + }); + + // double enumNumber + test('to test the property `enumNumber`', () async { + // TODO + }); + + // OuterEnum outerEnum + test('to test the property `outerEnum`', () async { + // TODO + }); + + // OuterEnumInteger outerEnumInteger + test('to test the property `outerEnumInteger`', () async { + // TODO + }); + + // OuterEnumDefaultValue outerEnumDefaultValue + test('to test the property `outerEnumDefaultValue`', () async { + // TODO + }); + + // OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue + test('to test the property `outerEnumIntegerDefaultValue`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/fake_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/fake_api_test.dart new file mode 100644 index 00000000000..f4e1969481c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/fake_api_test.dart @@ -0,0 +1,131 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for FakeApi +void main() { + final instance = FakeApi(); + + group('tests for FakeApi', () { + // Health check endpoint + // + //Future fakeHealthGet() async + test('test fakeHealthGet', () async { + // TODO + }); + + // test http signature authentication + // + //Future fakeHttpSignatureTest(Pet pet, { String query1, String header1 }) async + test('test fakeHttpSignatureTest', () async { + // TODO + }); + + // Test serialization of outer boolean types + // + //Future fakeOuterBooleanSerialize({ bool body }) async + test('test fakeOuterBooleanSerialize', () async { + // TODO + }); + + // Test serialization of object with outer number type + // + //Future fakeOuterCompositeSerialize({ OuterComposite outerComposite }) async + test('test fakeOuterCompositeSerialize', () async { + // TODO + }); + + // Test serialization of outer number types + // + //Future fakeOuterNumberSerialize({ num body }) async + test('test fakeOuterNumberSerialize', () async { + // TODO + }); + + // Test serialization of outer string types + // + //Future fakeOuterStringSerialize({ String body }) async + test('test fakeOuterStringSerialize', () async { + // TODO + }); + + // For this test, the body for this request much reference a schema named `File`. + // + //Future testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) async + test('test testBodyWithFileSchema', () async { + // TODO + }); + + //Future testBodyWithQueryParams(String query, User user) async + test('test testBodyWithQueryParams', () async { + // TODO + }); + + // To test \"client\" model + // + // To test \"client\" model + // + //Future testClientModel(ModelClient modelClient) async + test('test testClientModel', () async { + // TODO + }); + + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + // + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + // + //Future testEndpointParameters(num number, double double_, String patternWithoutDelimiter, String byte, { int integer, int int32, int int64, double float, String string, MultipartFile binary, DateTime date, DateTime dateTime, String password, String callback }) async + test('test testEndpointParameters', () async { + // TODO + }); + + // To test enum parameters + // + // To test enum parameters + // + //Future testEnumParameters({ List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, int enumQueryInteger, double enumQueryDouble, List enumFormStringArray, String enumFormString }) async + test('test testEnumParameters', () async { + // TODO + }); + + // Fake endpoint to test group parameters (optional) + // + // Fake endpoint to test group parameters (optional) + // + //Future testGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, int requiredInt64Group, { int stringGroup, bool booleanGroup, int int64Group }) async + test('test testGroupParameters', () async { + // TODO + }); + + // test inline additionalProperties + // + //Future testInlineAdditionalProperties(Map requestBody) async + test('test testInlineAdditionalProperties', () async { + // TODO + }); + + // test json serialization of form data + // + //Future testJsonFormData(String param, String param2) async + test('test testJsonFormData', () async { + // TODO + }); + + // To test the collection format in query parameters + // + //Future testQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context) async + test('test testQueryParameterCollectionFormat', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/fake_classname_tags123_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/fake_classname_tags123_api_test.dart new file mode 100644 index 00000000000..1a0f9658947 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/fake_classname_tags123_api_test.dart @@ -0,0 +1,29 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for FakeClassnameTags123Api +void main() { + final instance = FakeClassnameTags123Api(); + + group('tests for FakeClassnameTags123Api', () { + // To test class name in snake case + // + // To test class name in snake case + // + //Future testClassname(ModelClient modelClient) async + test('test testClassname', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/file_schema_test_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/file_schema_test_class_test.dart new file mode 100644 index 00000000000..7743739489a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/file_schema_test_class_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for FileSchemaTestClass +void main() { + final instance = FileSchemaTestClass(); + + group('test FileSchemaTestClass', () { + // ModelFile file + test('to test the property `file`', () async { + // TODO + }); + + // List files (default value: const []) + test('to test the property `files`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/foo_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/foo_test.dart new file mode 100644 index 00000000000..be0fc7717c8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/foo_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Foo +void main() { + final instance = Foo(); + + group('test Foo', () { + // String bar (default value: 'bar') + test('to test the property `bar`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/format_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/format_test_test.dart new file mode 100644 index 00000000000..554439c5f2e --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/format_test_test.dart @@ -0,0 +1,94 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for FormatTest +void main() { + final instance = FormatTest(); + + group('test FormatTest', () { + // int integer + test('to test the property `integer`', () async { + // TODO + }); + + // int int32 + test('to test the property `int32`', () async { + // TODO + }); + + // int int64 + test('to test the property `int64`', () async { + // TODO + }); + + // num number + test('to test the property `number`', () async { + // TODO + }); + + // double float + test('to test the property `float`', () async { + // TODO + }); + + // double double_ + test('to test the property `double_`', () async { + // TODO + }); + + // double decimal + test('to test the property `decimal`', () async { + // TODO + }); + + // String string + test('to test the property `string`', () async { + // TODO + }); + + // String byte + test('to test the property `byte`', () async { + // TODO + }); + + // MultipartFile binary + test('to test the property `binary`', () async { + // TODO + }); + + // DateTime date + test('to test the property `date`', () async { + // TODO + }); + + // DateTime dateTime + test('to test the property `dateTime`', () async { + // TODO + }); + + // String uuid + test('to test the property `uuid`', () async { + // TODO + }); + + // String password + test('to test the property `password`', () async { + // TODO + }); + + // A string that is a 10 digit number. Can have leading zeros. + // String patternWithDigits + test('to test the property `patternWithDigits`', () async { + // TODO + }); + + // A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + // String patternWithDigitsAndDelimiter + test('to test the property `patternWithDigitsAndDelimiter`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/has_only_read_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/has_only_read_only_test.dart new file mode 100644 index 00000000000..327a4e46d54 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/has_only_read_only_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for HasOnlyReadOnly +void main() { + final instance = HasOnlyReadOnly(); + + group('test HasOnlyReadOnly', () { + // String bar + test('to test the property `bar`', () async { + // TODO + }); + + // String foo + test('to test the property `foo`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/health_check_result_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/health_check_result_test.dart new file mode 100644 index 00000000000..1e125f539ff --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/health_check_result_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for HealthCheckResult +void main() { + final instance = HealthCheckResult(); + + group('test HealthCheckResult', () { + // String nullableMessage + test('to test the property `nullableMessage`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/inline_response_default_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/inline_response_default_test.dart new file mode 100644 index 00000000000..e28e7b64b4c --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/inline_response_default_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for InlineResponseDefault +void main() { + final instance = InlineResponseDefault(); + + group('test InlineResponseDefault', () { + // Foo string + test('to test the property `string`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/map_test_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/map_test_test.dart new file mode 100644 index 00000000000..49018e96b86 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/map_test_test.dart @@ -0,0 +1,32 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for MapTest +void main() { + final instance = MapTest(); + + group('test MapTest', () { + // Map> mapMapOfString (default value: const {}) + test('to test the property `mapMapOfString`', () async { + // TODO + }); + + // Map mapOfEnumString (default value: const {}) + test('to test the property `mapOfEnumString`', () async { + // TODO + }); + + // Map directMap (default value: const {}) + test('to test the property `directMap`', () async { + // TODO + }); + + // Map indirectMap (default value: const {}) + test('to test the property `indirectMap`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart new file mode 100644 index 00000000000..4b26cce66bb --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/mixed_properties_and_additional_properties_class_test.dart @@ -0,0 +1,27 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for MixedPropertiesAndAdditionalPropertiesClass +void main() { + final instance = MixedPropertiesAndAdditionalPropertiesClass(); + + group('test MixedPropertiesAndAdditionalPropertiesClass', () { + // String uuid + test('to test the property `uuid`', () async { + // TODO + }); + + // DateTime dateTime + test('to test the property `dateTime`', () async { + // TODO + }); + + // Map map (default value: const {}) + test('to test the property `map`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model200_response_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model200_response_test.dart new file mode 100644 index 00000000000..6d021088f23 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model200_response_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Model200Response +void main() { + final instance = Model200Response(); + + group('test Model200Response', () { + // int name + test('to test the property `name`', () async { + // TODO + }); + + // String class_ + test('to test the property `class_`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_client_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_client_test.dart new file mode 100644 index 00000000000..e4122269ff8 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_client_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ModelClient +void main() { + final instance = ModelClient(); + + group('test ModelClient', () { + // String client + test('to test the property `client`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_file_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_file_test.dart new file mode 100644 index 00000000000..54a3bf5e756 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_file_test.dart @@ -0,0 +1,18 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ModelFile +void main() { + final instance = ModelFile(); + + group('test ModelFile', () { + // Test capitalization + // String sourceURI + test('to test the property `sourceURI`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_list_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_list_test.dart new file mode 100644 index 00000000000..6dccfafbe0a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_list_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ModelList +void main() { + final instance = ModelList(); + + group('test ModelList', () { + // String n123list + test('to test the property `n123list`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_return_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_return_test.dart new file mode 100644 index 00000000000..6936134d6ba --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/model_return_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ModelReturn +void main() { + final instance = ModelReturn(); + + group('test ModelReturn', () { + // int return_ + test('to test the property `return_`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/name_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/name_test.dart new file mode 100644 index 00000000000..156a1944cd1 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/name_test.dart @@ -0,0 +1,32 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Name +void main() { + final instance = Name(); + + group('test Name', () { + // int name + test('to test the property `name`', () async { + // TODO + }); + + // int snakeCase + test('to test the property `snakeCase`', () async { + // TODO + }); + + // String property + test('to test the property `property`', () async { + // TODO + }); + + // int n123number + test('to test the property `n123number`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/nullable_class_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/nullable_class_test.dart new file mode 100644 index 00000000000..2506ea04356 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/nullable_class_test.dart @@ -0,0 +1,72 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for NullableClass +void main() { + final instance = NullableClass(); + + group('test NullableClass', () { + // int integerProp + test('to test the property `integerProp`', () async { + // TODO + }); + + // num numberProp + test('to test the property `numberProp`', () async { + // TODO + }); + + // bool booleanProp + test('to test the property `booleanProp`', () async { + // TODO + }); + + // String stringProp + test('to test the property `stringProp`', () async { + // TODO + }); + + // DateTime dateProp + test('to test the property `dateProp`', () async { + // TODO + }); + + // DateTime datetimeProp + test('to test the property `datetimeProp`', () async { + // TODO + }); + + // List arrayNullableProp (default value: const []) + test('to test the property `arrayNullableProp`', () async { + // TODO + }); + + // List arrayAndItemsNullableProp (default value: const []) + test('to test the property `arrayAndItemsNullableProp`', () async { + // TODO + }); + + // List arrayItemsNullable (default value: const []) + test('to test the property `arrayItemsNullable`', () async { + // TODO + }); + + // Map objectNullableProp (default value: const {}) + test('to test the property `objectNullableProp`', () async { + // TODO + }); + + // Map objectAndItemsNullableProp (default value: const {}) + test('to test the property `objectAndItemsNullableProp`', () async { + // TODO + }); + + // Map objectItemsNullable (default value: const {}) + test('to test the property `objectItemsNullable`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/number_only_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/number_only_test.dart new file mode 100644 index 00000000000..d47dae7ca1a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/number_only_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for NumberOnly +void main() { + final instance = NumberOnly(); + + group('test NumberOnly', () { + // num justNumber + test('to test the property `justNumber`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/order_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/order_test.dart new file mode 100644 index 00000000000..5d1c4ae1e72 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/order_test.dart @@ -0,0 +1,43 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Order +void main() { + final instance = Order(); + + group('test Order', () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // int petId + test('to test the property `petId`', () async { + // TODO + }); + + // int quantity + test('to test the property `quantity`', () async { + // TODO + }); + + // DateTime shipDate + test('to test the property `shipDate`', () async { + // TODO + }); + + // Order Status + // String status + test('to test the property `status`', () async { + // TODO + }); + + // bool complete (default value: false) + test('to test the property `complete`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_composite_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_composite_test.dart new file mode 100644 index 00000000000..c503fa5bcf9 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_composite_test.dart @@ -0,0 +1,27 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for OuterComposite +void main() { + final instance = OuterComposite(); + + group('test OuterComposite', () { + // num myNumber + test('to test the property `myNumber`', () async { + // TODO + }); + + // String myString + test('to test the property `myString`', () async { + // TODO + }); + + // bool myBoolean + test('to test the property `myBoolean`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_default_value_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_default_value_test.dart new file mode 100644 index 00000000000..61bb0a94fd2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_default_value_test.dart @@ -0,0 +1,11 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for OuterEnumDefaultValue +void main() { + + group('test OuterEnumDefaultValue', () { + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_integer_default_value_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_integer_default_value_test.dart new file mode 100644 index 00000000000..58b7c6a602d --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_integer_default_value_test.dart @@ -0,0 +1,11 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for OuterEnumIntegerDefaultValue +void main() { + + group('test OuterEnumIntegerDefaultValue', () { + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_integer_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_integer_test.dart new file mode 100644 index 00000000000..80299cf78cb --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_integer_test.dart @@ -0,0 +1,11 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for OuterEnumInteger +void main() { + + group('test OuterEnumInteger', () { + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_test.dart new file mode 100644 index 00000000000..0b63d48fad7 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_enum_test.dart @@ -0,0 +1,11 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for OuterEnum +void main() { + + group('test OuterEnum', () { + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/pet_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/pet_api_test.dart new file mode 100644 index 00000000000..5f4c994acef --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/pet_api_test.dart @@ -0,0 +1,89 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for PetApi +void main() { + final instance = PetApi(); + + group('tests for PetApi', () { + // Add a new pet to the store + // + //Future addPet(Pet pet) async + test('test addPet', () async { + // TODO + }); + + // Deletes a pet + // + //Future deletePet(int petId, { String apiKey }) async + test('test deletePet', () async { + // TODO + }); + + // Finds Pets by status + // + // Multiple status values can be provided with comma separated strings + // + //Future> findPetsByStatus(List status) async + test('test findPetsByStatus', () async { + // TODO + }); + + // Finds Pets by tags + // + // Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + // + //Future> findPetsByTags(Set tags) async + test('test findPetsByTags', () async { + // TODO + }); + + // Find pet by ID + // + // Returns a single pet + // + //Future getPetById(int petId) async + test('test getPetById', () async { + // TODO + }); + + // Update an existing pet + // + //Future updatePet(Pet pet) async + test('test updatePet', () async { + // TODO + }); + + // Updates a pet in the store with form data + // + //Future updatePetWithForm(int petId, { String name, String status }) async + test('test updatePetWithForm', () async { + // TODO + }); + + // uploads an image + // + //Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async + test('test uploadFile', () async { + // TODO + }); + + // uploads an image (required) + // + //Future uploadFileWithRequiredFile(int petId, MultipartFile requiredFile, { String additionalMetadata }) async + test('test uploadFileWithRequiredFile', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/pet_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/pet_test.dart new file mode 100644 index 00000000000..4c0f8f635e2 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/pet_test.dart @@ -0,0 +1,43 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Pet +void main() { + final instance = Pet(); + + group('test Pet', () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // Category category + test('to test the property `category`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + // Set photoUrls (default value: const {}) + test('to test the property `photoUrls`', () async { + // TODO + }); + + // List tags (default value: const []) + test('to test the property `tags`', () async { + // TODO + }); + + // pet status in the store + // String status + test('to test the property `status`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/read_only_first_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/read_only_first_test.dart new file mode 100644 index 00000000000..cc66776f643 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/read_only_first_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for ReadOnlyFirst +void main() { + final instance = ReadOnlyFirst(); + + group('test ReadOnlyFirst', () { + // String bar + test('to test the property `bar`', () async { + // TODO + }); + + // String baz + test('to test the property `baz`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/special_model_name_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/special_model_name_test.dart new file mode 100644 index 00000000000..5d9e9afd14a --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/special_model_name_test.dart @@ -0,0 +1,17 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for SpecialModelName +void main() { + final instance = SpecialModelName(); + + group('test SpecialModelName', () { + // int dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket + test('to test the property `dollarSpecialLeftSquareBracketPropertyPeriodNameRightSquareBracket`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/store_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/store_api_test.dart new file mode 100644 index 00000000000..4a7ed54abbb --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/store_api_test.dart @@ -0,0 +1,54 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for StoreApi +void main() { + final instance = StoreApi(); + + group('tests for StoreApi', () { + // Delete purchase order by ID + // + // For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + // + //Future deleteOrder(String orderId) async + test('test deleteOrder', () async { + // TODO + }); + + // Returns pet inventories by status + // + // Returns a map of status codes to quantities + // + //Future> getInventory() async + test('test getInventory', () async { + // TODO + }); + + // Find purchase order by ID + // + // For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + // + //Future getOrderById(int orderId) async + test('test getOrderById', () async { + // TODO + }); + + // Place an order for a pet + // + //Future placeOrder(Order order) async + test('test placeOrder', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/tag_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/tag_test.dart new file mode 100644 index 00000000000..f042b4c9117 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/tag_test.dart @@ -0,0 +1,22 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for Tag +void main() { + final instance = Tag(); + + group('test Tag', () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String name + test('to test the property `name`', () async { + // TODO + }); + + + }); + +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/user_api_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/user_api_test.dart new file mode 100644 index 00000000000..73ee89a2945 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/user_api_test.dart @@ -0,0 +1,82 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.0 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: lines_longer_than_80_chars + +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + + +/// tests for UserApi +void main() { + final instance = UserApi(); + + group('tests for UserApi', () { + // Create user + // + // This can only be done by the logged in user. + // + //Future createUser(User user) async + test('test createUser', () async { + // TODO + }); + + // Creates list of users with given input array + // + //Future createUsersWithArrayInput(List user) async + test('test createUsersWithArrayInput', () async { + // TODO + }); + + // Creates list of users with given input array + // + //Future createUsersWithListInput(List user) async + test('test createUsersWithListInput', () async { + // TODO + }); + + // Delete user + // + // This can only be done by the logged in user. + // + //Future deleteUser(String username) async + test('test deleteUser', () async { + // TODO + }); + + // Get user by user name + // + //Future getUserByName(String username) async + test('test getUserByName', () async { + // TODO + }); + + // Logs user into the system + // + //Future loginUser(String username, String password) async + test('test loginUser', () async { + // TODO + }); + + // Logs out current logged in user session + // + //Future logoutUser() async + test('test logoutUser', () async { + // TODO + }); + + // Updated user + // + // This can only be done by the logged in user. + // + //Future updateUser(String username, User user) async + test('test updateUser', () async { + // TODO + }); + + }); +} diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/user_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/user_test.dart new file mode 100644 index 00000000000..c14c0b47964 --- /dev/null +++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/user_test.dart @@ -0,0 +1,53 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +// tests for User +void main() { + final instance = User(); + + group('test User', () { + // int id + test('to test the property `id`', () async { + // TODO + }); + + // String username + test('to test the property `username`', () async { + // TODO + }); + + // String firstName + test('to test the property `firstName`', () async { + // TODO + }); + + // String lastName + test('to test the property `lastName`', () async { + // TODO + }); + + // String email + test('to test the property `email`', () async { + // TODO + }); + + // String password + test('to test the property `password`', () async { + // TODO + }); + + // String phone + test('to test the property `phone`', () async { + // TODO + }); + + // User Status + // int userStatus + test('to test the property `userStatus`', () async { + // TODO + }); + + + }); + +}