From c30d3696b01d4fe3eafd3d3d99932db3cbe01811 Mon Sep 17 00:00:00 2001 From: Nathan Shaaban <86252985+ctrlaltf24@users.noreply.github.com> Date: Tue, 13 Feb 2024 11:21:51 +0000 Subject: [PATCH] [rust] basic oneOf support (#13970) * [rust] basic oneOf support Suport oneOf as a rust struct enum. Details: Enum without a discriminator is untagged being "untagged" simply means serde won't attempt to store the name of the enum inside the serialized object. See https://serde.rs/enum-representations.html#untagged for more Also check to make sure the mapping values are not an empty object (aka null). Co-authored-by: Nikita Puzankov * refactor: fix clippy lints No longer needed as of reqwest 0.10, it now takes the response as owned instead of mut ref. Is not empty is more clear * fix: discriminator and oneof case Will show as a struct enum when there are additional fields, otherwise will be a tuple enum. not sure the purpose of x-mapped-models, perhaps legacy code? mappedModels appears to do the same thing. Also add default implementation for quality of life * chore: update samples --------- Co-authored-by: Nikita Puzankov --- .devcontainer/devcontainer.json | 1 + bin/configs/rust-hyper-composed-oneof.yaml | 8 + bin/configs/rust-hyper-oneOf.yaml | 8 + bin/configs/rust-reqwest-composed-oneof.yaml | 8 + bin/configs/rust-reqwest-oneOf.yaml | 8 + docs/generators/rust.md | 2 +- .../codegen/languages/RustClientCodegen.java | 55 +- .../src/main/resources/rust/model.mustache | 52 +- .../main/resources/rust/model_doc.mustache | 42 + .../src/main/resources/rust/request.rs | 2 +- .../main/resources/rust/reqwest/api.mustache | 2 +- .../test/resources/3_0/composed-oneof.yaml | 6 +- samples/client/others/rust/Cargo.lock | 1442 +++++------------ samples/client/others/rust/Cargo.toml | 2 +- .../rust/hyper/composed-oneof/.gitignore | 3 + .../composed-oneof/.openapi-generator-ignore | 23 + .../composed-oneof/.openapi-generator/FILES | 29 + .../composed-oneof/.openapi-generator/VERSION | 1 + .../rust/hyper/composed-oneof/.travis.yml | 1 + .../rust/hyper/composed-oneof/Cargo.toml | 20 + .../rust/hyper/composed-oneof/README.md | 53 + .../composed-oneof/docs/CreateStateRequest.md | 10 + .../docs/CustomOneOfArraySchemaInner.md | 10 + .../composed-oneof/docs/CustomOneOfSchema.md | 10 + .../hyper/composed-oneof/docs/DefaultApi.md | 63 + .../docs/GetState200Response.md | 10 + .../rust/hyper/composed-oneof/docs/ObjA.md | 12 + .../rust/hyper/composed-oneof/docs/ObjB.md | 13 + .../rust/hyper/composed-oneof/docs/ObjC.md | 12 + .../rust/hyper/composed-oneof/docs/ObjD.md | 12 + .../rust/hyper/composed-oneof/git_push.sh | 57 + .../hyper/composed-oneof/src/apis/client.rs | 24 + .../composed-oneof/src/apis/configuration.rs | 43 + .../composed-oneof/src/apis/default_api.rs | 62 + .../rust/hyper/composed-oneof/src/apis/mod.rs | 54 + .../hyper/composed-oneof/src/apis/request.rs | 242 +++ .../rust/hyper/composed-oneof/src/lib.rs | 11 + .../src/models/create_state_request.rs | 30 + .../custom_one_of_array_schema_inner.rs | 32 + .../src/models/custom_one_of_schema.rs | 30 + .../src/models/get_state_200_response.rs | 32 + .../hyper/composed-oneof/src/models/mod.rs | 16 + .../hyper/composed-oneof/src/models/obj_a.rs | 31 + .../hyper/composed-oneof/src/models/obj_b.rs | 34 + .../hyper/composed-oneof/src/models/obj_c.rs | 31 + .../hyper/composed-oneof/src/models/obj_d.rs | 31 + .../client/others/rust/hyper/oneOf/.gitignore | 3 + .../hyper/oneOf/.openapi-generator-ignore | 23 + .../rust/hyper/oneOf/.openapi-generator/FILES | 51 + .../hyper/oneOf/.openapi-generator/VERSION | 1 + .../others/rust/hyper/oneOf/.travis.yml | 1 + .../client/others/rust/hyper/oneOf/Cargo.toml | 20 + .../client/others/rust/hyper/oneOf/README.md | 65 + .../rust/hyper/oneOf/docs/Addressable.md | 12 + .../others/rust/hyper/oneOf/docs/Apple.md | 11 + .../others/rust/hyper/oneOf/docs/Banana.md | 11 + .../others/rust/hyper/oneOf/docs/Bar.md | 18 + .../others/rust/hyper/oneOf/docs/BarApi.md | 37 + .../others/rust/hyper/oneOf/docs/BarCreate.md | 18 + .../others/rust/hyper/oneOf/docs/BarRef.md | 17 + .../rust/hyper/oneOf/docs/BarRefOrValue.md | 12 + .../others/rust/hyper/oneOf/docs/Entity.md | 10 + .../others/rust/hyper/oneOf/docs/EntityRef.md | 10 + .../rust/hyper/oneOf/docs/Extensible.md | 13 + .../others/rust/hyper/oneOf/docs/Foo.md | 17 + .../others/rust/hyper/oneOf/docs/FooApi.md | 63 + .../others/rust/hyper/oneOf/docs/FooRef.md | 18 + .../rust/hyper/oneOf/docs/FooRefOrValue.md | 10 + .../others/rust/hyper/oneOf/docs/Fruit.md | 10 + .../others/rust/hyper/oneOf/docs/FruitType.md | 13 + .../others/rust/hyper/oneOf/docs/Pasta.md | 16 + .../others/rust/hyper/oneOf/docs/Pizza.md | 16 + .../rust/hyper/oneOf/docs/PizzaSpeziale.md | 17 + .../others/rust/hyper/oneOf/git_push.sh | 57 + .../client/others/rust/hyper/oneOf/pom.xml | 46 + .../rust/hyper/oneOf/src/apis/bar_api.rs | 52 + .../rust/hyper/oneOf/src/apis/client.rs | 30 + .../hyper/oneOf/src/apis/configuration.rs | 43 + .../rust/hyper/oneOf/src/apis/foo_api.rs | 61 + .../others/rust/hyper/oneOf/src/apis/mod.rs | 56 + .../rust/hyper/oneOf/src/apis/request.rs | 242 +++ .../client/others/rust/hyper/oneOf/src/lib.rs | 11 + .../hyper/oneOf/src/models/addressable.rs | 35 + .../rust/hyper/oneOf/src/models/apple.rs | 28 + .../rust/hyper/oneOf/src/models/banana.rs | 28 + .../others/rust/hyper/oneOf/src/models/bar.rs | 53 + .../rust/hyper/oneOf/src/models/bar_create.rs | 54 + .../rust/hyper/oneOf/src/models/bar_ref.rs | 53 + .../oneOf/src/models/bar_ref_or_value.rs | 29 + .../rust/hyper/oneOf/src/models/entity.rs | 121 ++ .../rust/hyper/oneOf/src/models/entity_ref.rs | 76 + .../rust/hyper/oneOf/src/models/extensible.rs | 37 + .../others/rust/hyper/oneOf/src/models/foo.rs | 51 + .../rust/hyper/oneOf/src/models/foo_ref.rs | 56 + .../oneOf/src/models/foo_ref_or_value.rs | 30 + .../rust/hyper/oneOf/src/models/fruit.rs | 30 + .../rust/hyper/oneOf/src/models/fruit_type.rs | 39 + .../others/rust/hyper/oneOf/src/models/mod.rs | 36 + .../rust/hyper/oneOf/src/models/pasta.rs | 48 + .../rust/hyper/oneOf/src/models/pizza.rs | 48 + .../hyper/oneOf/src/models/pizza_speziale.rs | 51 + samples/client/others/rust/pom.xml | 46 + .../src/apis/default_api.rs | 2 +- .../src/models/parent.rs | 2 +- .../rust/reqwest/composed-oneof/.gitignore | 3 + .../composed-oneof/.openapi-generator-ignore | 23 + .../composed-oneof/.openapi-generator/FILES | 27 + .../composed-oneof/.openapi-generator/VERSION | 1 + .../rust/reqwest/composed-oneof/.travis.yml | 1 + .../rust/reqwest/composed-oneof/Cargo.toml | 18 + .../rust/reqwest/composed-oneof/README.md | 53 + .../composed-oneof/docs/CreateStateRequest.md | 10 + .../docs/CustomOneOfArraySchemaInner.md | 10 + .../composed-oneof/docs/CustomOneOfSchema.md | 10 + .../reqwest/composed-oneof/docs/DefaultApi.md | 63 + .../docs/GetState200Response.md | 10 + .../rust/reqwest/composed-oneof/docs/ObjA.md | 12 + .../rust/reqwest/composed-oneof/docs/ObjB.md | 13 + .../rust/reqwest/composed-oneof/docs/ObjC.md | 12 + .../rust/reqwest/composed-oneof/docs/ObjD.md | 12 + .../rust/reqwest/composed-oneof/git_push.sh | 57 + .../composed-oneof/src/apis/configuration.rs | 53 + .../composed-oneof/src/apis/default_api.rs | 87 + .../reqwest/composed-oneof/src/apis/mod.rs | 95 ++ .../rust/reqwest/composed-oneof/src/lib.rs | 10 + .../src/models/create_state_request.rs | 30 + .../custom_one_of_array_schema_inner.rs | 32 + .../src/models/custom_one_of_schema.rs | 30 + .../src/models/get_state_200_response.rs | 32 + .../reqwest/composed-oneof/src/models/mod.rs | 16 + .../composed-oneof/src/models/obj_a.rs | 31 + .../composed-oneof/src/models/obj_b.rs | 34 + .../composed-oneof/src/models/obj_c.rs | 31 + .../composed-oneof/src/models/obj_d.rs | 31 + .../others/rust/reqwest/oneOf/.gitignore | 3 + .../reqwest/oneOf/.openapi-generator-ignore | 23 + .../reqwest/oneOf/.openapi-generator/FILES | 49 + .../reqwest/oneOf/.openapi-generator/VERSION | 1 + .../others/rust/reqwest/oneOf/.travis.yml | 1 + .../others/rust/reqwest/oneOf/Cargo.toml | 18 + .../others/rust/reqwest/oneOf/README.md | 65 + .../rust/reqwest/oneOf/docs/Addressable.md | 12 + .../others/rust/reqwest/oneOf/docs/Apple.md | 11 + .../others/rust/reqwest/oneOf/docs/Banana.md | 11 + .../others/rust/reqwest/oneOf/docs/Bar.md | 18 + .../others/rust/reqwest/oneOf/docs/BarApi.md | 37 + .../rust/reqwest/oneOf/docs/BarCreate.md | 18 + .../others/rust/reqwest/oneOf/docs/BarRef.md | 17 + .../rust/reqwest/oneOf/docs/BarRefOrValue.md | 12 + .../others/rust/reqwest/oneOf/docs/Entity.md | 10 + .../rust/reqwest/oneOf/docs/EntityRef.md | 10 + .../rust/reqwest/oneOf/docs/Extensible.md | 13 + .../others/rust/reqwest/oneOf/docs/Foo.md | 17 + .../others/rust/reqwest/oneOf/docs/FooApi.md | 63 + .../others/rust/reqwest/oneOf/docs/FooRef.md | 18 + .../rust/reqwest/oneOf/docs/FooRefOrValue.md | 10 + .../others/rust/reqwest/oneOf/docs/Fruit.md | 10 + .../rust/reqwest/oneOf/docs/FruitType.md | 13 + .../others/rust/reqwest/oneOf/docs/Pasta.md | 16 + .../others/rust/reqwest/oneOf/docs/Pizza.md | 16 + .../rust/reqwest/oneOf/docs/PizzaSpeziale.md | 17 + .../others/rust/reqwest/oneOf/git_push.sh | 57 + .../client/others/rust/reqwest/oneOf/pom.xml | 46 + .../rust/reqwest/oneOf/src/apis/bar_api.rs | 53 + .../reqwest/oneOf/src/apis/configuration.rs | 53 + .../rust/reqwest/oneOf/src/apis/foo_api.rs | 87 + .../others/rust/reqwest/oneOf/src/apis/mod.rs | 96 ++ .../others/rust/reqwest/oneOf/src/lib.rs | 10 + .../reqwest/oneOf/src/models/addressable.rs | 35 + .../rust/reqwest/oneOf/src/models/apple.rs | 28 + .../rust/reqwest/oneOf/src/models/banana.rs | 28 + .../rust/reqwest/oneOf/src/models/bar.rs | 53 + .../reqwest/oneOf/src/models/bar_create.rs | 54 + .../rust/reqwest/oneOf/src/models/bar_ref.rs | 53 + .../oneOf/src/models/bar_ref_or_value.rs | 29 + .../rust/reqwest/oneOf/src/models/entity.rs | 121 ++ .../reqwest/oneOf/src/models/entity_ref.rs | 76 + .../reqwest/oneOf/src/models/extensible.rs | 37 + .../rust/reqwest/oneOf/src/models/foo.rs | 51 + .../rust/reqwest/oneOf/src/models/foo_ref.rs | 56 + .../oneOf/src/models/foo_ref_or_value.rs | 30 + .../rust/reqwest/oneOf/src/models/fruit.rs | 30 + .../reqwest/oneOf/src/models/fruit_type.rs | 39 + .../rust/reqwest/oneOf/src/models/mod.rs | 36 + .../rust/reqwest/oneOf/src/models/pasta.rs | 48 + .../rust/reqwest/oneOf/src/models/pizza.rs | 48 + .../oneOf/src/models/pizza_speziale.rs | 51 + .../petstore/rust/hyper/petstore/docs/Baz.md | 10 +- .../rust/hyper/petstore/src/apis/request.rs | 2 +- .../petstore/src/models/action_container.rs | 2 +- .../hyper/petstore/src/models/api_response.rs | 2 +- .../src/models/array_item_ref_test.rs | 2 +- .../hyper/petstore/src/models/category.rs | 2 +- .../petstore/src/models/enum_array_testing.rs | 2 +- .../hyper/petstore/src/models/model_return.rs | 2 +- .../petstore/src/models/nullable_array.rs | 2 +- .../petstore/src/models/optional_testing.rs | 2 +- .../rust/hyper/petstore/src/models/order.rs | 2 +- .../rust/hyper/petstore/src/models/pet.rs | 2 +- .../petstore/src/models/property_test.rs | 2 +- .../rust/hyper/petstore/src/models/tag.rs | 2 +- .../hyper/petstore/src/models/type_testing.rs | 2 +- .../src/models/unique_item_array_testing.rs | 2 +- .../rust/hyper/petstore/src/models/user.rs | 2 +- .../reqwest/name-mapping/src/apis/fake_api.rs | 2 +- .../src/models/property_name_mapping.rs | 2 +- .../petstore-async-middleware/docs/Baz.md | 10 +- .../src/models/action_container.rs | 2 +- .../src/models/api_response.rs | 2 +- .../src/models/array_item_ref_test.rs | 2 +- .../src/models/category.rs | 2 +- .../src/models/enum_array_testing.rs | 2 +- .../src/models/model_return.rs | 2 +- .../src/models/nullable_array.rs | 2 +- .../src/models/optional_testing.rs | 2 +- .../src/models/order.rs | 2 +- .../src/models/pet.rs | 2 +- .../src/models/property_test.rs | 2 +- .../src/models/tag.rs | 2 +- .../src/models/type_testing.rs | 2 +- .../src/models/unique_item_array_testing.rs | 2 +- .../src/models/user.rs | 2 +- .../rust/reqwest/petstore-async/docs/Baz.md | 10 +- .../src/models/action_container.rs | 2 +- .../petstore-async/src/models/api_response.rs | 2 +- .../src/models/array_item_ref_test.rs | 2 +- .../petstore-async/src/models/category.rs | 2 +- .../src/models/enum_array_testing.rs | 2 +- .../petstore-async/src/models/model_return.rs | 2 +- .../src/models/nullable_array.rs | 2 +- .../src/models/optional_testing.rs | 2 +- .../petstore-async/src/models/order.rs | 2 +- .../reqwest/petstore-async/src/models/pet.rs | 2 +- .../src/models/property_test.rs | 2 +- .../reqwest/petstore-async/src/models/tag.rs | 2 +- .../petstore-async/src/models/type_testing.rs | 2 +- .../src/models/unique_item_array_testing.rs | 2 +- .../reqwest/petstore-async/src/models/user.rs | 2 +- .../petstore-awsv4signature/docs/Baz.md | 10 +- .../src/apis/fake_api.rs | 2 +- .../src/apis/pet_api.rs | 16 +- .../src/apis/store_api.rs | 8 +- .../src/apis/testing_api.rs | 4 +- .../src/apis/user_api.rs | 16 +- .../src/models/action_container.rs | 2 +- .../src/models/api_response.rs | 2 +- .../src/models/array_item_ref_test.rs | 2 +- .../src/models/category.rs | 2 +- .../src/models/enum_array_testing.rs | 2 +- .../src/models/model_return.rs | 2 +- .../src/models/nullable_array.rs | 2 +- .../src/models/optional_testing.rs | 2 +- .../src/models/order.rs | 2 +- .../petstore-awsv4signature/src/models/pet.rs | 2 +- .../src/models/property_test.rs | 2 +- .../petstore-awsv4signature/src/models/tag.rs | 2 +- .../src/models/type_testing.rs | 2 +- .../src/models/unique_item_array_testing.rs | 2 +- .../src/models/user.rs | 2 +- .../rust/reqwest/petstore/docs/Baz.md | 10 +- .../reqwest/petstore/src/apis/fake_api.rs | 2 +- .../rust/reqwest/petstore/src/apis/pet_api.rs | 16 +- .../reqwest/petstore/src/apis/store_api.rs | 8 +- .../reqwest/petstore/src/apis/testing_api.rs | 4 +- .../reqwest/petstore/src/apis/user_api.rs | 16 +- .../petstore/src/models/action_container.rs | 2 +- .../petstore/src/models/api_response.rs | 2 +- .../src/models/array_item_ref_test.rs | 2 +- .../reqwest/petstore/src/models/category.rs | 2 +- .../petstore/src/models/enum_array_testing.rs | 2 +- .../petstore/src/models/model_return.rs | 2 +- .../petstore/src/models/nullable_array.rs | 2 +- .../petstore/src/models/optional_testing.rs | 2 +- .../rust/reqwest/petstore/src/models/order.rs | 2 +- .../rust/reqwest/petstore/src/models/pet.rs | 2 +- .../petstore/src/models/property_test.rs | 2 +- .../rust/reqwest/petstore/src/models/tag.rs | 2 +- .../petstore/src/models/type_testing.rs | 2 +- .../src/models/unique_item_array_testing.rs | 2 +- .../rust/reqwest/petstore/src/models/user.rs | 2 +- 280 files changed, 6432 insertions(+), 1271 deletions(-) create mode 100644 bin/configs/rust-hyper-composed-oneof.yaml create mode 100644 bin/configs/rust-hyper-oneOf.yaml create mode 100644 bin/configs/rust-reqwest-composed-oneof.yaml create mode 100644 bin/configs/rust-reqwest-oneOf.yaml create mode 100644 samples/client/others/rust/hyper/composed-oneof/.gitignore create mode 100644 samples/client/others/rust/hyper/composed-oneof/.openapi-generator-ignore create mode 100644 samples/client/others/rust/hyper/composed-oneof/.openapi-generator/FILES create mode 100644 samples/client/others/rust/hyper/composed-oneof/.openapi-generator/VERSION create mode 100644 samples/client/others/rust/hyper/composed-oneof/.travis.yml create mode 100644 samples/client/others/rust/hyper/composed-oneof/Cargo.toml create mode 100644 samples/client/others/rust/hyper/composed-oneof/README.md create mode 100644 samples/client/others/rust/hyper/composed-oneof/docs/CreateStateRequest.md create mode 100644 samples/client/others/rust/hyper/composed-oneof/docs/CustomOneOfArraySchemaInner.md create mode 100644 samples/client/others/rust/hyper/composed-oneof/docs/CustomOneOfSchema.md create mode 100644 samples/client/others/rust/hyper/composed-oneof/docs/DefaultApi.md create mode 100644 samples/client/others/rust/hyper/composed-oneof/docs/GetState200Response.md create mode 100644 samples/client/others/rust/hyper/composed-oneof/docs/ObjA.md create mode 100644 samples/client/others/rust/hyper/composed-oneof/docs/ObjB.md create mode 100644 samples/client/others/rust/hyper/composed-oneof/docs/ObjC.md create mode 100644 samples/client/others/rust/hyper/composed-oneof/docs/ObjD.md create mode 100644 samples/client/others/rust/hyper/composed-oneof/git_push.sh create mode 100644 samples/client/others/rust/hyper/composed-oneof/src/apis/client.rs create mode 100644 samples/client/others/rust/hyper/composed-oneof/src/apis/configuration.rs create mode 100644 samples/client/others/rust/hyper/composed-oneof/src/apis/default_api.rs create mode 100644 samples/client/others/rust/hyper/composed-oneof/src/apis/mod.rs create mode 100644 samples/client/others/rust/hyper/composed-oneof/src/apis/request.rs create mode 100644 samples/client/others/rust/hyper/composed-oneof/src/lib.rs create mode 100644 samples/client/others/rust/hyper/composed-oneof/src/models/create_state_request.rs create mode 100644 samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_array_schema_inner.rs create mode 100644 samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_schema.rs create mode 100644 samples/client/others/rust/hyper/composed-oneof/src/models/get_state_200_response.rs create mode 100644 samples/client/others/rust/hyper/composed-oneof/src/models/mod.rs create mode 100644 samples/client/others/rust/hyper/composed-oneof/src/models/obj_a.rs create mode 100644 samples/client/others/rust/hyper/composed-oneof/src/models/obj_b.rs create mode 100644 samples/client/others/rust/hyper/composed-oneof/src/models/obj_c.rs create mode 100644 samples/client/others/rust/hyper/composed-oneof/src/models/obj_d.rs create mode 100644 samples/client/others/rust/hyper/oneOf/.gitignore create mode 100644 samples/client/others/rust/hyper/oneOf/.openapi-generator-ignore create mode 100644 samples/client/others/rust/hyper/oneOf/.openapi-generator/FILES create mode 100644 samples/client/others/rust/hyper/oneOf/.openapi-generator/VERSION create mode 100644 samples/client/others/rust/hyper/oneOf/.travis.yml create mode 100644 samples/client/others/rust/hyper/oneOf/Cargo.toml create mode 100644 samples/client/others/rust/hyper/oneOf/README.md create mode 100644 samples/client/others/rust/hyper/oneOf/docs/Addressable.md create mode 100644 samples/client/others/rust/hyper/oneOf/docs/Apple.md create mode 100644 samples/client/others/rust/hyper/oneOf/docs/Banana.md create mode 100644 samples/client/others/rust/hyper/oneOf/docs/Bar.md create mode 100644 samples/client/others/rust/hyper/oneOf/docs/BarApi.md create mode 100644 samples/client/others/rust/hyper/oneOf/docs/BarCreate.md create mode 100644 samples/client/others/rust/hyper/oneOf/docs/BarRef.md create mode 100644 samples/client/others/rust/hyper/oneOf/docs/BarRefOrValue.md create mode 100644 samples/client/others/rust/hyper/oneOf/docs/Entity.md create mode 100644 samples/client/others/rust/hyper/oneOf/docs/EntityRef.md create mode 100644 samples/client/others/rust/hyper/oneOf/docs/Extensible.md create mode 100644 samples/client/others/rust/hyper/oneOf/docs/Foo.md create mode 100644 samples/client/others/rust/hyper/oneOf/docs/FooApi.md create mode 100644 samples/client/others/rust/hyper/oneOf/docs/FooRef.md create mode 100644 samples/client/others/rust/hyper/oneOf/docs/FooRefOrValue.md create mode 100644 samples/client/others/rust/hyper/oneOf/docs/Fruit.md create mode 100644 samples/client/others/rust/hyper/oneOf/docs/FruitType.md create mode 100644 samples/client/others/rust/hyper/oneOf/docs/Pasta.md create mode 100644 samples/client/others/rust/hyper/oneOf/docs/Pizza.md create mode 100644 samples/client/others/rust/hyper/oneOf/docs/PizzaSpeziale.md create mode 100644 samples/client/others/rust/hyper/oneOf/git_push.sh create mode 100644 samples/client/others/rust/hyper/oneOf/pom.xml create mode 100644 samples/client/others/rust/hyper/oneOf/src/apis/bar_api.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/apis/client.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/apis/configuration.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/apis/foo_api.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/apis/mod.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/apis/request.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/lib.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/models/addressable.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/models/apple.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/models/banana.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/models/bar.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/models/bar_create.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/models/bar_ref.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/models/bar_ref_or_value.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/models/entity.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/models/entity_ref.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/models/extensible.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/models/foo.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/models/foo_ref.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/models/foo_ref_or_value.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/models/fruit.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/models/fruit_type.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/models/mod.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/models/pasta.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/models/pizza.rs create mode 100644 samples/client/others/rust/hyper/oneOf/src/models/pizza_speziale.rs create mode 100644 samples/client/others/rust/pom.xml create mode 100644 samples/client/others/rust/reqwest/composed-oneof/.gitignore create mode 100644 samples/client/others/rust/reqwest/composed-oneof/.openapi-generator-ignore create mode 100644 samples/client/others/rust/reqwest/composed-oneof/.openapi-generator/FILES create mode 100644 samples/client/others/rust/reqwest/composed-oneof/.openapi-generator/VERSION create mode 100644 samples/client/others/rust/reqwest/composed-oneof/.travis.yml create mode 100644 samples/client/others/rust/reqwest/composed-oneof/Cargo.toml create mode 100644 samples/client/others/rust/reqwest/composed-oneof/README.md create mode 100644 samples/client/others/rust/reqwest/composed-oneof/docs/CreateStateRequest.md create mode 100644 samples/client/others/rust/reqwest/composed-oneof/docs/CustomOneOfArraySchemaInner.md create mode 100644 samples/client/others/rust/reqwest/composed-oneof/docs/CustomOneOfSchema.md create mode 100644 samples/client/others/rust/reqwest/composed-oneof/docs/DefaultApi.md create mode 100644 samples/client/others/rust/reqwest/composed-oneof/docs/GetState200Response.md create mode 100644 samples/client/others/rust/reqwest/composed-oneof/docs/ObjA.md create mode 100644 samples/client/others/rust/reqwest/composed-oneof/docs/ObjB.md create mode 100644 samples/client/others/rust/reqwest/composed-oneof/docs/ObjC.md create mode 100644 samples/client/others/rust/reqwest/composed-oneof/docs/ObjD.md create mode 100644 samples/client/others/rust/reqwest/composed-oneof/git_push.sh create mode 100644 samples/client/others/rust/reqwest/composed-oneof/src/apis/configuration.rs create mode 100644 samples/client/others/rust/reqwest/composed-oneof/src/apis/default_api.rs create mode 100644 samples/client/others/rust/reqwest/composed-oneof/src/apis/mod.rs create mode 100644 samples/client/others/rust/reqwest/composed-oneof/src/lib.rs create mode 100644 samples/client/others/rust/reqwest/composed-oneof/src/models/create_state_request.rs create mode 100644 samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_array_schema_inner.rs create mode 100644 samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_schema.rs create mode 100644 samples/client/others/rust/reqwest/composed-oneof/src/models/get_state_200_response.rs create mode 100644 samples/client/others/rust/reqwest/composed-oneof/src/models/mod.rs create mode 100644 samples/client/others/rust/reqwest/composed-oneof/src/models/obj_a.rs create mode 100644 samples/client/others/rust/reqwest/composed-oneof/src/models/obj_b.rs create mode 100644 samples/client/others/rust/reqwest/composed-oneof/src/models/obj_c.rs create mode 100644 samples/client/others/rust/reqwest/composed-oneof/src/models/obj_d.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/.gitignore create mode 100644 samples/client/others/rust/reqwest/oneOf/.openapi-generator-ignore create mode 100644 samples/client/others/rust/reqwest/oneOf/.openapi-generator/FILES create mode 100644 samples/client/others/rust/reqwest/oneOf/.openapi-generator/VERSION create mode 100644 samples/client/others/rust/reqwest/oneOf/.travis.yml create mode 100644 samples/client/others/rust/reqwest/oneOf/Cargo.toml create mode 100644 samples/client/others/rust/reqwest/oneOf/README.md create mode 100644 samples/client/others/rust/reqwest/oneOf/docs/Addressable.md create mode 100644 samples/client/others/rust/reqwest/oneOf/docs/Apple.md create mode 100644 samples/client/others/rust/reqwest/oneOf/docs/Banana.md create mode 100644 samples/client/others/rust/reqwest/oneOf/docs/Bar.md create mode 100644 samples/client/others/rust/reqwest/oneOf/docs/BarApi.md create mode 100644 samples/client/others/rust/reqwest/oneOf/docs/BarCreate.md create mode 100644 samples/client/others/rust/reqwest/oneOf/docs/BarRef.md create mode 100644 samples/client/others/rust/reqwest/oneOf/docs/BarRefOrValue.md create mode 100644 samples/client/others/rust/reqwest/oneOf/docs/Entity.md create mode 100644 samples/client/others/rust/reqwest/oneOf/docs/EntityRef.md create mode 100644 samples/client/others/rust/reqwest/oneOf/docs/Extensible.md create mode 100644 samples/client/others/rust/reqwest/oneOf/docs/Foo.md create mode 100644 samples/client/others/rust/reqwest/oneOf/docs/FooApi.md create mode 100644 samples/client/others/rust/reqwest/oneOf/docs/FooRef.md create mode 100644 samples/client/others/rust/reqwest/oneOf/docs/FooRefOrValue.md create mode 100644 samples/client/others/rust/reqwest/oneOf/docs/Fruit.md create mode 100644 samples/client/others/rust/reqwest/oneOf/docs/FruitType.md create mode 100644 samples/client/others/rust/reqwest/oneOf/docs/Pasta.md create mode 100644 samples/client/others/rust/reqwest/oneOf/docs/Pizza.md create mode 100644 samples/client/others/rust/reqwest/oneOf/docs/PizzaSpeziale.md create mode 100644 samples/client/others/rust/reqwest/oneOf/git_push.sh create mode 100644 samples/client/others/rust/reqwest/oneOf/pom.xml create mode 100644 samples/client/others/rust/reqwest/oneOf/src/apis/bar_api.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/src/apis/configuration.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/src/apis/foo_api.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/src/apis/mod.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/src/lib.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/src/models/addressable.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/src/models/apple.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/src/models/banana.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/src/models/bar.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/src/models/bar_create.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/src/models/bar_ref.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/src/models/bar_ref_or_value.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/src/models/entity.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/src/models/entity_ref.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/src/models/extensible.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/src/models/foo.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/src/models/foo_ref.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/src/models/foo_ref_or_value.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/src/models/fruit.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/src/models/fruit_type.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/src/models/mod.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/src/models/pasta.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/src/models/pizza.rs create mode 100644 samples/client/others/rust/reqwest/oneOf/src/models/pizza_speziale.rs diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 1f46f227a79..3c64d59bd9b 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -9,6 +9,7 @@ "ghcr.io/devcontainers/features/node:1": { "version": "lts" }, + "ghcr.io/devcontainers/features/rust:1": {}, "ghcr.io/snebjorn/devcontainer-feature/chromium:latest": {}, "docker-in-docker": { "version": "latest", diff --git a/bin/configs/rust-hyper-composed-oneof.yaml b/bin/configs/rust-hyper-composed-oneof.yaml new file mode 100644 index 00000000000..f221c798980 --- /dev/null +++ b/bin/configs/rust-hyper-composed-oneof.yaml @@ -0,0 +1,8 @@ +generatorName: rust +outputDir: samples/client/others/rust/hyper/composed-oneof +library: hyper +inputSpec: modules/openapi-generator/src/test/resources/3_0/composed-oneof.yaml +templateDir: modules/openapi-generator/src/main/resources/rust +additionalProperties: + supportAsync: "false" + packageName: composed-oneof-hyper diff --git a/bin/configs/rust-hyper-oneOf.yaml b/bin/configs/rust-hyper-oneOf.yaml new file mode 100644 index 00000000000..e4b1e5f984d --- /dev/null +++ b/bin/configs/rust-hyper-oneOf.yaml @@ -0,0 +1,8 @@ +generatorName: rust +outputDir: samples/client/others/rust/hyper/oneOf +library: hyper +inputSpec: modules/openapi-generator/src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml +templateDir: modules/openapi-generator/src/main/resources/rust +additionalProperties: + supportAsync: "false" + packageName: oneof-hyper diff --git a/bin/configs/rust-reqwest-composed-oneof.yaml b/bin/configs/rust-reqwest-composed-oneof.yaml new file mode 100644 index 00000000000..2b2609729b2 --- /dev/null +++ b/bin/configs/rust-reqwest-composed-oneof.yaml @@ -0,0 +1,8 @@ +generatorName: rust +outputDir: samples/client/others/rust/reqwest/composed-oneof +library: reqwest +inputSpec: modules/openapi-generator/src/test/resources/3_0/composed-oneof.yaml +templateDir: modules/openapi-generator/src/main/resources/rust +additionalProperties: + supportAsync: "false" + packageName: composed-oneof-reqwest diff --git a/bin/configs/rust-reqwest-oneOf.yaml b/bin/configs/rust-reqwest-oneOf.yaml new file mode 100644 index 00000000000..6f6ae8c3766 --- /dev/null +++ b/bin/configs/rust-reqwest-oneOf.yaml @@ -0,0 +1,8 @@ +generatorName: rust +outputDir: samples/client/others/rust/reqwest/oneOf +library: reqwest +inputSpec: modules/openapi-generator/src/test/resources/3_0/oneof_polymorphism_and_inheritance.yaml +templateDir: modules/openapi-generator/src/main/resources/rust +additionalProperties: + supportAsync: false + packageName: oneof-reqwest diff --git a/docs/generators/rust.md b/docs/generators/rust.md index 13812fe15e0..c458cbab527 100644 --- a/docs/generators/rust.md +++ b/docs/generators/rust.md @@ -214,7 +214,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |Union|✗|OAS3 |allOf|✗|OAS2,OAS3 |anyOf|✗|OAS3 -|oneOf|✗|OAS3 +|oneOf|✓|OAS3 |not|✗|OAS3 ### Security Feature diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java index 392e2b94bb8..c9ad555e605 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java @@ -108,6 +108,9 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon .excludeParameterFeatures( ParameterFeature.Cookie ) + .includeSchemaSupportFeatures( + SchemaSupportFeature.oneOf + ) .includeClientModificationFeatures( ClientModificationFeature.BasePath, ClientModificationFeature.UserAgent @@ -204,52 +207,22 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon @Override public ModelsMap postProcessModels(ModelsMap objs) { - // process enum in models - return postProcessModelsEnum(objs); - } + // Remove the discriminator field from the model, serde will take care of this + for (ModelMap model : objs.getModels()) { + CodegenModel cm = model.getModel(); + if (cm.discriminator != null) { + String reserved_var_name = cm.discriminator.getPropertyBaseName(); - @SuppressWarnings("static-method") - public Map postProcessAllModels(Map objs) { - // Index all CodegenModels by model name. - Map allModels = new HashMap<>(); - - for (Map.Entry entry : objs.entrySet()) { - String modelName = toModelName(entry.getKey()); - List models = entry.getValue().getModels(); - for (ModelMap mo : models) { - CodegenModel cm = mo.getModel(); - allModels.put(modelName, cm); - } - } - - for (Map.Entry entry : objs.entrySet()) { - List models = entry.getValue().getModels(); - for (ModelMap mo : models) { - CodegenModel cm = mo.getModel(); - if (cm.discriminator != null) { - List discriminatorVars = new ArrayList<>(); - for (CodegenDiscriminator.MappedModel mappedModel : cm.discriminator.getMappedModels()) { - CodegenModel model = allModels.get(mappedModel.getModelName()); - Map mas = new HashMap<>(); - mas.put("modelName", camelize(mappedModel.getModelName())); - mas.put("mappingName", mappedModel.getMappingName()); - - // TODO: deleting the variable from the array was - // problematic; I don't know what this is supposed to do - // so I'm just cloning it for the moment - List vars = new ArrayList<>(model.getVars()); - vars.removeIf(p -> p.name.equals(cm.discriminator.getPropertyName())); - mas.put("vars", vars); - discriminatorVars.add(mas); + for (CodegenProperty cp : cm.vars) { + if (cp.baseName.equals(reserved_var_name)) { + cm.vars.remove(cp); + break; } - // TODO: figure out how to properly have the original property type that didn't go through toVarName - String vendorExtensionTagName = cm.discriminator.getPropertyName(); - cm.vendorExtensions.put("x-tag-name", vendorExtensionTagName); - cm.vendorExtensions.put("x-mapped-models", discriminatorVars); } } } - return objs; + // process enum in models + return postProcessModelsEnum(objs); } @Override diff --git a/modules/openapi-generator/src/main/resources/rust/model.mustache b/modules/openapi-generator/src/main/resources/rust/model.mustache index 4038a14ed58..b92f64987a3 100644 --- a/modules/openapi-generator/src/main/resources/rust/model.mustache +++ b/modules/openapi-generator/src/main/resources/rust/model.mustache @@ -4,6 +4,9 @@ {{#description}} /// {{{classname}}} : {{{description}}} {{/description}} +{{#oneOf}} +use super::{{{.}}}; +{{/oneOf}} {{!-- for enum schemas --}} {{#isEnum}} @@ -41,10 +44,10 @@ impl Default for {{{classname}}} { {{!-- for schemas that have a discriminator --}} {{#discriminator}} #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] -#[serde(tag = "{{{vendorExtensions.x-tag-name}}}")] +#[serde(tag = "{{{propertyBaseName}}}")] pub enum {{{classname}}} { -{{#vendorExtensions}} - {{#x-mapped-models}} + {{^oneOf}} + {{#mappedModels}} #[serde(rename="{{mappingName}}")] {{{modelName}}} { {{#vars}} @@ -55,8 +58,24 @@ pub enum {{{classname}}} { {{{name}}}: {{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{^required}}Option<{{/required}}{{#isEnum}}{{{enumName}}}{{/isEnum}}{{^isEnum}}{{#isModel}}Box<{{{dataType}}}>{{/isModel}}{{^isModel}}{{{dataType}}}{{/isModel}}{{/isEnum}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^required}}>{{/required}}, {{/vars}} }, - {{/x-mapped-models}} -{{/vendorExtensions}} + {{/mappedModels}} + {{/oneOf}} + {{#oneOf}} + {{#description}} + /// {{{.}}} + {{/description}} + {{{.}}}(Box<{{{.}}}>), + {{/oneOf}} +} + +impl Default for {{classname}} { + fn default() -> Self { + {{^oneOf}}{{#mappedModels}}{{#-first}}Self::{{modelName}} { + {{#vars}} + {{{name}}}: Default::default(), + {{/vars}} + }{{/-first}}{{/mappedModels}}{{/oneOf}}{{#oneOf}}{{#-first}}Self::{{{.}}}(Box::default()){{/-first}}{{/oneOf}} + } } {{/discriminator}} @@ -64,7 +83,8 @@ pub enum {{{classname}}} { {{!-- for non-enum schemas --}} {{^isEnum}} {{^discriminator}} -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +{{#oneOf.isEmpty}} +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct {{{classname}}} { {{#vars}} {{#description}} @@ -87,6 +107,26 @@ impl {{{classname}}} { } } } +{{/oneOf.isEmpty}} +{{^oneOf.isEmpty}} +{{! TODO: add other vars that are not part of the oneOf}} +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum {{classname}} { + {{#oneOf}} + {{#description}} + /// {{{.}}} + {{/description}} + {{{.}}}(Box<{{{.}}}>), + {{/oneOf}} +} + +impl Default for {{classname}} { + fn default() -> Self { + {{#oneOf}}{{#-first}}Self::{{{.}}}(Box::default()){{/-first}}{{/oneOf}} + } +} +{{/oneOf.isEmpty}} {{/discriminator}} {{/isEnum}} diff --git a/modules/openapi-generator/src/main/resources/rust/model_doc.mustache b/modules/openapi-generator/src/main/resources/rust/model_doc.mustache index 0c48c83b828..2aba7596849 100644 --- a/modules/openapi-generator/src/main/resources/rust/model_doc.mustache +++ b/modules/openapi-generator/src/main/resources/rust/model_doc.mustache @@ -1,4 +1,35 @@ {{#models}}{{#model}}# {{{classname}}} +{{#isEnum}} + +## Enum Variants + +| Name | Value | +|---- | -----|{{#allowableValues}}{{#enumVars}} +| {{name}} | {{value}} |{{/enumVars}}{{/allowableValues}} + +{{/isEnum}} +{{#discriminator}} + +## Enum Variants + +| Name | Value | +|---- | -----|{{#vendorExtensions}}{{#x-mapped-models}} +| {{modelName}} | {{mappingName}} |{{/x-mapped-models}}{{/vendorExtensions}} +{{#vendorExtensions}} +{{#x-mapped-models}} + +## {{modelName}} + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +{{#vars}}**{{{name}}}** | {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{{complexType}}}.md){{/isPrimitiveType}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}} | {{{description}}} | {{^required}}[optional]{{/required}}{{#isReadOnly}}[readonly]{{/isReadOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} +{{/vars}} +{{/x-mapped-models}} +{{/vendorExtensions}} +{{/discriminator}} +{{^discriminator}} +{{^isEnum}} +{{#oneOf.isEmpty}} ## Properties @@ -6,6 +37,17 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- {{#vars}}**{{{name}}}** | {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{{complexType}}}.md){{/isPrimitiveType}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}} | {{{description}}} | {{^required}}[optional]{{/required}}{{#isReadOnly}}[readonly]{{/isReadOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} {{/vars}} +{{/oneOf.isEmpty}} +{{^oneOf.isEmpty}} + +## Enum Variants + +| Name | Description | +|---- | -----|{{#oneOf}} +| {{{.}}} | {{description}} |{{/oneOf}} +{{/oneOf.isEmpty}} +{{/isEnum}} +{{/discriminator}} [[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/modules/openapi-generator/src/main/resources/rust/request.rs b/modules/openapi-generator/src/main/resources/rust/request.rs index 81497706a11..db4d55e47b1 100644 --- a/modules/openapi-generator/src/main/resources/rust/request.rs +++ b/modules/openapi-generator/src/main/resources/rust/request.rs @@ -128,7 +128,7 @@ impl Request { let mut uri_str = format!("{}{}", conf.base_path, path); let query_string_str = query_string.finish(); - if query_string_str != "" { + if !query_string_str.is_empty() { uri_str += "?"; uri_str += &query_string_str; } diff --git a/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache b/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache index 26534c445bd..f848674e137 100644 --- a/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache +++ b/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache @@ -342,7 +342,7 @@ pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}(configuration: {{/hasBodyParam}} let local_var_req = local_var_req_builder.build()?; - let {{^supportAsync}}mut {{/supportAsync}}local_var_resp = local_var_client.execute(local_var_req){{#supportAsync}}.await{{/supportAsync}}?; + let local_var_resp = local_var_client.execute(local_var_req){{#supportAsync}}.await{{/supportAsync}}?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text(){{#supportAsync}}.await{{/supportAsync}}?; diff --git a/modules/openapi-generator/src/test/resources/3_0/composed-oneof.yaml b/modules/openapi-generator/src/test/resources/3_0/composed-oneof.yaml index 97bf4bb663f..b9afdc68c9f 100644 --- a/modules/openapi-generator/src/test/resources/3_0/composed-oneof.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/composed-oneof.yaml @@ -1,7 +1,7 @@ openapi: 3.0.1 info: title: oneOf test - version: '1.0' + version: '1.0.0' servers: - url: 'http://localhost:8000/' paths: @@ -23,7 +23,7 @@ paths: mapping: a-type: '#/components/schemas/ObjA' b-type: '#/components/schemas/ObjB' - b-type: '#/components/schemas/ObjD' + d-type: '#/components/schemas/ObjD' post: operationId: createState requestBody: @@ -96,4 +96,4 @@ components: realtype: type: string color: - type: string \ No newline at end of file + type: string diff --git a/samples/client/others/rust/Cargo.lock b/samples/client/others/rust/Cargo.lock index a11408bdf3c..fa1ae083d86 100644 --- a/samples/client/others/rust/Cargo.lock +++ b/samples/client/others/rust/Cargo.lock @@ -17,30 +17,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "autocfg" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" -dependencies = [ - "autocfg 1.1.0", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -55,7 +31,7 @@ checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" dependencies = [ "addr2line", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "miniz_oxide", "object", @@ -64,18 +40,19 @@ dependencies = [ [[package]] name = "base64" -version = "0.10.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" +checksum = "5032d51da2741729bfdaeb2664d9b8c6d9fd1e2b90715c660b6def36628499c2" dependencies = [ "byteorder", + "safemem", ] [[package]] name = "base64" -version = "0.13.1" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "bitflags" @@ -97,14 +74,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "0.4.12" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -dependencies = [ - "byteorder", - "either", - "iovec", -] +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cc" @@ -112,12 +84,6 @@ version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -125,63 +91,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] -name = "chrono" -version = "0.4.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +name = "composed-oneof-hyper" +version = "1.0.0" dependencies = [ - "android-tzdata", - "iana-time-zone", - "num-traits", - "serde", - "winapi 0.3.9", -] - -[[package]] -name = "cloudabi" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -dependencies = [ - "bitflags", -] - -[[package]] -name = "codespan-reporting" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] - -[[package]] -name = "cookie" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "888604f00b3db336d2af898ec3c1d5d0ddf5e6d462220f2ededc33a87ac4bbd5" -dependencies = [ - "time 0.1.45", - "url 1.7.2", -] - -[[package]] -name = "cookie_store" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46750b3f362965f197996c4448e4a0935e791bf7d6631bfce9ee0af3d24c919c" -dependencies = [ - "cookie", - "failure", - "idna 0.1.5", - "log", - "publicsuffix", + "base64 0.7.0", + "futures", + "http", + "hyper", + "hyper-tls", "serde", + "serde_derive", "serde_json", - "time 0.1.45", - "try_from", - "url 1.7.2", + "url", + "uuid", +] + +[[package]] +name = "composed-oneof-reqwest" +version = "1.0.0" +dependencies = [ + "reqwest", + "serde", + "serde_derive", + "serde_json", + "url", + "uuid", ] [[package]] @@ -200,163 +134,21 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if 1.0.0", -] - -[[package]] -name = "crossbeam-deque" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20ff29ded3204c5106278a81a38f4b482636ed4fa1e6cfbeef193291beb29ed" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", - "maybe-uninit", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" -dependencies = [ - "autocfg 1.1.0", - "cfg-if 0.1.10", - "crossbeam-utils", - "lazy_static", - "maybe-uninit", - "memoffset", - "scopeguard", -] - -[[package]] -name = "crossbeam-queue" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" -dependencies = [ - "cfg-if 0.1.10", - "crossbeam-utils", - "maybe-uninit", -] - -[[package]] -name = "crossbeam-utils" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" -dependencies = [ - "autocfg 1.1.0", - "cfg-if 0.1.10", - "lazy_static", -] - -[[package]] -name = "cxx" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93" -dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", -] - -[[package]] -name = "cxx-build" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b" -dependencies = [ - "cc", - "codespan-reporting", - "once_cell", - "proc-macro2", - "quote", - "scratch", - "syn 2.0.26", -] - -[[package]] -name = "cxxbridge-flags" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.26", -] - -[[package]] -name = "darling" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 2.0.26", -] - -[[package]] -name = "darling_macro" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" -dependencies = [ - "darling_core", - "quote", - "syn 2.0.26", -] - -[[package]] -name = "dtoa" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" - -[[package]] -name = "either" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" - [[package]] name = "encoding_rs" version = "0.8.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "errno" version = "0.3.1" @@ -378,28 +170,6 @@ dependencies = [ "libc", ] -[[package]] -name = "failure" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" -dependencies = [ - "backtrace", - "failure_derive", -] - -[[package]] -name = "failure_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "synstructure", -] - [[package]] name = "fastrand" version = "1.9.0" @@ -409,16 +179,6 @@ dependencies = [ "instant", ] -[[package]] -name = "flate2" -version = "1.0.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - [[package]] name = "fnv" version = "1.0.7" @@ -446,45 +206,107 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ - "percent-encoding 2.3.0", + "percent-encoding", ] -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" - -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - [[package]] name = "futures" -version = "0.1.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] [[package]] -name = "futures-cpupool" -version = "0.1.8" +name = "futures-channel" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ - "futures", - "num_cpus", + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-executor" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" + +[[package]] +name = "futures-macro" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "getrandom" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +dependencies = [ + "cfg-if", + "libc", + "wasi", ] [[package]] @@ -495,27 +317,28 @@ checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" [[package]] name = "h2" -version = "0.1.26" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462" +checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" dependencies = [ - "byteorder", "bytes", "fnv", - "futures", + "futures-core", + "futures-sink", + "futures-util", "http", "indexmap", - "log", "slab", - "string", - "tokio-io", + "tokio", + "tokio-util", + "tracing", ] [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" [[package]] name = "hermit-abi" @@ -523,33 +346,26 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - [[package]] name = "http" -version = "0.1.21" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6ccf5ede3a895d8856620237b2f02972c1bbc78d2965ad7fe8838d4a0ed41f0" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" dependencies = [ "bytes", "fnv", - "itoa 0.4.8", + "itoa", ] [[package]] name = "http-body" -version = "0.1.0" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6741c859c1b2463a423a1dbce98d418e6c3c3fc720fb0d45528657320920292d" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "futures", "http", - "tokio-buf", + "pin-project-lite", ] [[package]] @@ -559,98 +375,46 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] -name = "hyper" -version = "0.12.36" +name = "httpdate" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c843caf6296fc1f93444735205af9ed4e109a539005abb2564ae1d6fad34c52" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes", - "futures", - "futures-cpupool", + "futures-channel", + "futures-core", + "futures-util", "h2", "http", "http-body", "httparse", - "iovec", - "itoa 0.4.8", - "log", - "net2", - "rustc_version", - "time 0.1.45", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", "tokio", - "tokio-buf", - "tokio-executor", - "tokio-io", - "tokio-reactor", - "tokio-tcp", - "tokio-threadpool", - "tokio-timer", + "tower-service", + "tracing", "want", ] [[package]] name = "hyper-tls" -version = "0.3.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a800d6aa50af4b5850b2b0f659625ce9504df908e9733b635720483be26174f" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "futures", "hyper", "native-tls", - "tokio-io", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" -dependencies = [ - "cxx", - "cxx-build", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "idna" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "idna" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", + "tokio", + "tokio-native-tls", ] [[package]] @@ -665,13 +429,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.3" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" dependencies = [ - "autocfg 1.1.0", + "equivalent", "hashbrown", - "serde", ] [[package]] @@ -680,7 +443,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -695,19 +458,10 @@ dependencies = [ ] [[package]] -name = "iovec" -version = "0.1.4" +name = "ipnet" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", -] - -[[package]] -name = "itoa" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "itoa" @@ -724,16 +478,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "lazy_static" version = "1.4.0" @@ -746,63 +490,24 @@ version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" -[[package]] -name = "link-cplusplus" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" -dependencies = [ - "cc", -] - [[package]] name = "linux-raw-sys" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" -[[package]] -name = "lock_api" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" -dependencies = [ - "scopeguard", -] - [[package]] name = "log" version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" -[[package]] -name = "matches" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" - -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - [[package]] name = "memchr" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" -[[package]] -name = "memoffset" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" -dependencies = [ - "autocfg 1.1.0", -] - [[package]] name = "mime" version = "0.3.17" @@ -830,33 +535,13 @@ dependencies = [ [[package]] name = "mio" -version = "0.6.23" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", "libc", - "log", - "miow", - "net2", - "slab", - "winapi 0.2.8", -] - -[[package]] -name = "miow" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", + "wasi", + "windows-sys 0.48.0", ] [[package]] @@ -877,26 +562,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "net2" -version = "0.2.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b13b648036a2339d06de780866fbdfda0dde886de7b3af2ddeba8b14f4ee34ac" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg 1.1.0", -] - [[package]] name = "num_cpus" version = "1.16.0" @@ -922,6 +587,34 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +[[package]] +name = "oneof-hyper" +version = "0.0.1" +dependencies = [ + "base64 0.7.0", + "futures", + "http", + "hyper", + "hyper-tls", + "serde", + "serde_derive", + "serde_json", + "url", + "uuid", +] + +[[package]] +name = "oneof-reqwest" +version = "0.0.1" +dependencies = [ + "reqwest", + "serde", + "serde_derive", + "serde_json", + "url", + "uuid", +] + [[package]] name = "openssl" version = "0.10.55" @@ -929,7 +622,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" dependencies = [ "bitflags", - "cfg-if 1.0.0", + "cfg-if", "foreign-types", "libc", "once_cell", @@ -945,7 +638,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn", ] [[package]] @@ -966,44 +659,24 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "parking_lot" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" -dependencies = [ - "lock_api", - "parking_lot_core", - "rustc_version", -] - -[[package]] -name = "parking_lot_core" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66b810a62be75176a80873726630147a5ca780cd33921e0b5709033e66b0a" -dependencies = [ - "cfg-if 0.1.10", - "cloudabi", - "libc", - "redox_syscall 0.1.57", - "rustc_version", - "smallvec", - "winapi 0.3.9", -] - -[[package]] -name = "percent-encoding" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" - [[package]] name = "percent-encoding" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "pkg-config" version = "0.3.27" @@ -1019,16 +692,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "publicsuffix" -version = "1.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b4ce31ff0a27d93c8de1849cf58162283752f065a90d508f1105fa6c9a213f" -dependencies = [ - "idna 0.2.3", - "url 2.4.0", -] - [[package]] name = "quote" version = "1.0.31" @@ -1038,127 +701,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" -dependencies = [ - "autocfg 0.1.8", - "libc", - "rand_chacha", - "rand_core 0.4.2", - "rand_hc", - "rand_isaac", - "rand_jitter", - "rand_os", - "rand_pcg", - "rand_xorshift", - "winapi 0.3.9", -] - -[[package]] -name = "rand_chacha" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" -dependencies = [ - "autocfg 0.1.8", - "rand_core 0.3.1", -] - -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -dependencies = [ - "rand_core 0.4.2", -] - -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" - -[[package]] -name = "rand_hc" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "rand_isaac" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "rand_jitter" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" -dependencies = [ - "libc", - "rand_core 0.4.2", - "winapi 0.3.9", -] - -[[package]] -name = "rand_os" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" -dependencies = [ - "cloudabi", - "fuchsia-cprng", - "libc", - "rand_core 0.4.2", - "rdrand", - "winapi 0.3.9", -] - -[[package]] -name = "rand_pcg" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" -dependencies = [ - "autocfg 0.1.8", - "rand_core 0.4.2", -] - -[[package]] -name = "rand_xorshift" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - [[package]] name = "redox_syscall" version = "0.3.5" @@ -1176,42 +718,48 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "serde_with", - "url 2.4.0", - "uuid 1.4.1", + "url", + "uuid", ] [[package]] name = "reqwest" -version = "0.9.24" +version = "0.11.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f88643aea3c1343c804950d7bf983bd2067f5ab59db6d613a08e05572f2714ab" +checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" dependencies = [ - "base64 0.10.1", + "base64 0.21.7", "bytes", - "cookie", - "cookie_store", "encoding_rs", - "flate2", - "futures", + "futures-core", + "futures-util", + "h2", "http", + "http-body", "hyper", "hyper-tls", + "ipnet", + "js-sys", "log", "mime", "mime_guess", "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", - "time 0.1.45", + "sync_wrapper", + "system-configuration", "tokio", - "tokio-executor", - "tokio-io", - "tokio-threadpool", - "tokio-timer", - "url 1.7.2", - "uuid 0.7.4", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", "winreg", ] @@ -1221,15 +769,6 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver", -] - [[package]] name = "rustix" version = "0.37.19" @@ -1244,12 +783,27 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64 0.21.7", +] + [[package]] name = "ryu" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +[[package]] +name = "safemem" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f" + [[package]] name = "schannel" version = "0.1.21" @@ -1259,18 +813,6 @@ dependencies = [ "windows-sys 0.42.0", ] -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "scratch" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" - [[package]] name = "security-framework" version = "2.9.1" @@ -1294,29 +836,11 @@ dependencies = [ "libc", ] -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - [[package]] name = "serde" version = "1.0.173" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e91f70896d6720bc714a4a57d22fc91f1db634680e65c8efe13323f1fa38d53f" -dependencies = [ - "serde_derive", -] [[package]] name = "serde_derive" @@ -1326,7 +850,7 @@ checksum = "a6250dde8342e0232232be9ca3db7aa40aceb5a3e5dd9bddbc00d99a007cde49" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn", ] [[package]] @@ -1335,49 +859,21 @@ version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b" dependencies = [ - "itoa 1.0.9", + "itoa", "ryu", "serde", ] [[package]] name = "serde_urlencoded" -version = "0.5.5" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "642dd69105886af2efd227f75a520ec9b44a820d65bc133a9131f7d229fd165a" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ - "dtoa", - "itoa 0.4.8", + "form_urlencoded", + "itoa", + "ryu", "serde", - "url 1.7.2", -] - -[[package]] -name = "serde_with" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" -dependencies = [ - "base64 0.13.1", - "chrono", - "hex", - "indexmap", - "serde", - "serde_json", - "serde_with_macros", - "time 0.3.23", -] - -[[package]] -name = "serde_with_macros" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.26", ] [[package]] @@ -1386,42 +882,17 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" dependencies = [ - "autocfg 1.1.0", + "autocfg", ] [[package]] -name = "smallvec" -version = "0.6.14" +name = "socket2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" +checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" dependencies = [ - "maybe-uninit", -] - -[[package]] -name = "string" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d24114bfcceb867ca7f71a0d3fe45d45619ec47a6fbfa98cb14e14250bfa5d6d" -dependencies = [ - "bytes", -] - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", + "libc", + "windows-sys 0.48.0", ] [[package]] @@ -1436,15 +907,30 @@ dependencies = [ ] [[package]] -name = "synstructure" -version = "0.12.6" +name = "sync_wrapper" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "unicode-xid", + "bitflags", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", ] [[package]] @@ -1453,60 +939,13 @@ version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fastrand", - "redox_syscall 0.3.5", + "redox_syscall", "rustix", "windows-sys 0.45.0", ] -[[package]] -name = "termcolor" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "time" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc", - "wasi", - "winapi 0.3.9", -] - -[[package]] -name = "time" -version = "0.3.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446" -dependencies = [ - "itoa 1.0.9", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" - -[[package]] -name = "time-macros" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ba15a897f3c86766b757e5ac7221554c6750054d74d5b28844fce5fb36a6c4" -dependencies = [ - "time-core", -] - [[package]] name = "tinyvec" version = "1.6.0" @@ -1524,135 +963,67 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "0.1.22" +version = "1.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6" +checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" dependencies = [ + "backtrace", "bytes", - "futures", + "libc", "mio", "num_cpus", - "tokio-current-thread", - "tokio-executor", - "tokio-io", - "tokio-reactor", - "tokio-tcp", - "tokio-threadpool", - "tokio-timer", + "pin-project-lite", + "socket2", + "windows-sys 0.48.0", ] [[package]] -name = "tokio-buf" -version = "0.1.1" +name = "tokio-native-tls" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb220f46c53859a4b7ec083e41dec9778ff0b1851c0942b211edb89e0ccdc46" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ "bytes", - "either", - "futures", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", ] [[package]] -name = "tokio-current-thread" -version = "0.1.7" +name = "tower-service" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de0e32a83f131e002238d7ccde18211c0a5397f60cbfffcb112868c2e0e20e" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "futures", - "tokio-executor", + "pin-project-lite", + "tracing-core", ] [[package]] -name = "tokio-executor" -version = "0.1.10" +name = "tracing-core" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ - "crossbeam-utils", - "futures", -] - -[[package]] -name = "tokio-io" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" -dependencies = [ - "bytes", - "futures", - "log", -] - -[[package]] -name = "tokio-reactor" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351" -dependencies = [ - "crossbeam-utils", - "futures", - "lazy_static", - "log", - "mio", - "num_cpus", - "parking_lot", - "slab", - "tokio-executor", - "tokio-io", - "tokio-sync", -] - -[[package]] -name = "tokio-sync" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee" -dependencies = [ - "fnv", - "futures", -] - -[[package]] -name = "tokio-tcp" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98df18ed66e3b72e742f185882a9e201892407957e45fbff8da17ae7a7c51f72" -dependencies = [ - "bytes", - "futures", - "iovec", - "mio", - "tokio-io", - "tokio-reactor", -] - -[[package]] -name = "tokio-threadpool" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df720b6581784c118f0eb4310796b12b1d242a7eb95f716a8367855325c25f89" -dependencies = [ - "crossbeam-deque", - "crossbeam-queue", - "crossbeam-utils", - "futures", - "lazy_static", - "log", - "num_cpus", - "slab", - "tokio-executor", -] - -[[package]] -name = "tokio-timer" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296" -dependencies = [ - "crossbeam-utils", - "futures", - "slab", - "tokio-executor", + "once_cell", ] [[package]] @@ -1661,15 +1032,6 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" -[[package]] -name = "try_from" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "283d3b89e1368717881a9d51dad843cc435380d8109c9e47d38780a324698d8b" -dependencies = [ - "cfg-if 0.1.10", -] - [[package]] name = "unicase" version = "2.6.0" @@ -1700,29 +1062,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-width" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" - -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - -[[package]] -name = "url" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" -dependencies = [ - "idna 0.1.5", - "matches", - "percent-encoding 1.0.1", -] - [[package]] name = "url" version = "2.4.0" @@ -1730,17 +1069,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ "form_urlencoded", - "idna 0.4.0", - "percent-encoding 2.3.0", -] - -[[package]] -name = "uuid" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90dbc611eb48397705a6b0f6e917da23ae517e4d127123d2cf7674206627d32a" -dependencies = [ - "rand", + "idna", + "percent-encoding", ] [[package]] @@ -1749,6 +1079,7 @@ version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" dependencies = [ + "getrandom", "serde", ] @@ -1766,20 +1097,18 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "want" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6395efa4784b027708f7451087e647ec73cc74f5d9bc2e418404248d679a230" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "futures", - "log", "try-lock", ] [[package]] name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" @@ -1787,7 +1116,7 @@ version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] @@ -1802,10 +1131,22 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.26", + "syn", "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d1985d03709c53167ce907ff394f5316aa22cb4e12761295c5dc57dacb6297e" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.86" @@ -1824,7 +1165,7 @@ checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.26", + "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1836,55 +1177,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" [[package]] -name = "winapi" -version = "0.2.8" +name = "web-sys" +version = "0.3.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +checksum = "3bdd9ef4e984da1187bf8110c5cf5b845fbc87a23602cdf912386a76fcd3a7c2" dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" -dependencies = [ - "windows-targets 0.48.0", + "js-sys", + "wasm-bindgen", ] [[package]] @@ -2036,19 +1335,10 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winreg" -version = "0.6.2" +version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", + "cfg-if", + "windows-sys 0.48.0", ] diff --git a/samples/client/others/rust/Cargo.toml b/samples/client/others/rust/Cargo.toml index 7f22f1a9f27..85fad3af177 100644 --- a/samples/client/others/rust/Cargo.toml +++ b/samples/client/others/rust/Cargo.toml @@ -1,2 +1,2 @@ [workspace] -members = ["reqwest-regression-16119"] +members = ["hyper/*", "reqwest/*", "reqwest-regression-16119"] diff --git a/samples/client/others/rust/hyper/composed-oneof/.gitignore b/samples/client/others/rust/hyper/composed-oneof/.gitignore new file mode 100644 index 00000000000..6aa106405a4 --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/.gitignore @@ -0,0 +1,3 @@ +/target/ +**/*.rs.bk +Cargo.lock diff --git a/samples/client/others/rust/hyper/composed-oneof/.openapi-generator-ignore b/samples/client/others/rust/hyper/composed-oneof/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/others/rust/hyper/composed-oneof/.openapi-generator/FILES b/samples/client/others/rust/hyper/composed-oneof/.openapi-generator/FILES new file mode 100644 index 00000000000..3359fce00c1 --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/.openapi-generator/FILES @@ -0,0 +1,29 @@ +.gitignore +.travis.yml +Cargo.toml +README.md +docs/CreateStateRequest.md +docs/CustomOneOfArraySchemaInner.md +docs/CustomOneOfSchema.md +docs/DefaultApi.md +docs/GetState200Response.md +docs/ObjA.md +docs/ObjB.md +docs/ObjC.md +docs/ObjD.md +git_push.sh +src/apis/client.rs +src/apis/configuration.rs +src/apis/default_api.rs +src/apis/mod.rs +src/apis/request.rs +src/lib.rs +src/models/create_state_request.rs +src/models/custom_one_of_array_schema_inner.rs +src/models/custom_one_of_schema.rs +src/models/get_state_200_response.rs +src/models/mod.rs +src/models/obj_a.rs +src/models/obj_b.rs +src/models/obj_c.rs +src/models/obj_d.rs diff --git a/samples/client/others/rust/hyper/composed-oneof/.openapi-generator/VERSION b/samples/client/others/rust/hyper/composed-oneof/.openapi-generator/VERSION new file mode 100644 index 00000000000..fff4bdd7ab5 --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/others/rust/hyper/composed-oneof/.travis.yml b/samples/client/others/rust/hyper/composed-oneof/.travis.yml new file mode 100644 index 00000000000..22761ba7ee1 --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/.travis.yml @@ -0,0 +1 @@ +language: rust diff --git a/samples/client/others/rust/hyper/composed-oneof/Cargo.toml b/samples/client/others/rust/hyper/composed-oneof/Cargo.toml new file mode 100644 index 00000000000..0f8feed80f4 --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "composed-oneof-hyper" +version = "1.0.0" +authors = ["OpenAPI Generator team and contributors"] +description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)" +# Override this license by providing a License Object in the OpenAPI. +license = "Unlicense" +edition = "2018" + +[dependencies] +serde = "^1.0" +serde_derive = "^1.0" +serde_json = "^1.0" +url = "^2.2" +uuid = { version = "^1.0", features = ["serde", "v4"] } +hyper = { version = "~0.14", features = ["full"] } +hyper-tls = "~0.5" +http = "~0.2" +base64 = "~0.7.0" +futures = "^0.3" diff --git a/samples/client/others/rust/hyper/composed-oneof/README.md b/samples/client/others/rust/hyper/composed-oneof/README.md new file mode 100644 index 00000000000..ea09c253652 --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/README.md @@ -0,0 +1,53 @@ +# Rust API client for composed-oneof-hyper + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + +## Overview + +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client. + +- API version: 1.0.0 +- Package version: 1.0.0 +- Build package: `org.openapitools.codegen.languages.RustClientCodegen` + +## Installation + +Put the package under your project folder in a directory named `composed-oneof-hyper` and add the following to `Cargo.toml` under `[dependencies]`: + +``` +composed-oneof-hyper = { path = "./composed-oneof-hyper" } +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost:8000* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*DefaultApi* | [**create_state**](docs/DefaultApi.md#create_state) | **Post** /state | +*DefaultApi* | [**get_state**](docs/DefaultApi.md#get_state) | **Get** /state | + + +## Documentation For Models + + - [CreateStateRequest](docs/CreateStateRequest.md) + - [CustomOneOfArraySchemaInner](docs/CustomOneOfArraySchemaInner.md) + - [CustomOneOfSchema](docs/CustomOneOfSchema.md) + - [GetState200Response](docs/GetState200Response.md) + - [ObjA](docs/ObjA.md) + - [ObjB](docs/ObjB.md) + - [ObjC](docs/ObjC.md) + - [ObjD](docs/ObjD.md) + + +To get access to the crate's generated documentation, use: + +``` +cargo doc --open +``` + +## Author + + + diff --git a/samples/client/others/rust/hyper/composed-oneof/docs/CreateStateRequest.md b/samples/client/others/rust/hyper/composed-oneof/docs/CreateStateRequest.md new file mode 100644 index 00000000000..be08d188fc5 --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/docs/CreateStateRequest.md @@ -0,0 +1,10 @@ +# CreateStateRequest + +## Enum Variants + +| Name | Value | +|---- | -----| + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/hyper/composed-oneof/docs/CustomOneOfArraySchemaInner.md b/samples/client/others/rust/hyper/composed-oneof/docs/CustomOneOfArraySchemaInner.md new file mode 100644 index 00000000000..336d8e3dbf0 --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/docs/CustomOneOfArraySchemaInner.md @@ -0,0 +1,10 @@ +# CustomOneOfArraySchemaInner + +## Enum Variants + +| Name | Value | +|---- | -----| + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/hyper/composed-oneof/docs/CustomOneOfSchema.md b/samples/client/others/rust/hyper/composed-oneof/docs/CustomOneOfSchema.md new file mode 100644 index 00000000000..fdfd1f03f7e --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/docs/CustomOneOfSchema.md @@ -0,0 +1,10 @@ +# CustomOneOfSchema + +## Enum Variants + +| Name | Value | +|---- | -----| + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/hyper/composed-oneof/docs/DefaultApi.md b/samples/client/others/rust/hyper/composed-oneof/docs/DefaultApi.md new file mode 100644 index 00000000000..65ae82fdec7 --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/docs/DefaultApi.md @@ -0,0 +1,63 @@ +# \DefaultApi + +All URIs are relative to *http://localhost:8000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_state**](DefaultApi.md#create_state) | **Post** /state | +[**get_state**](DefaultApi.md#get_state) | **Get** /state | + + + +## create_state + +> create_state(create_state_request) + + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**create_state_request** | [**CreateStateRequest**](CreateStateRequest.md) | | [required] | + +### Return type + + (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) + + +## get_state + +> crate::models::GetState200Response get_state() + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**crate::models::GetState200Response**](getState_200_response.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/client/others/rust/hyper/composed-oneof/docs/GetState200Response.md b/samples/client/others/rust/hyper/composed-oneof/docs/GetState200Response.md new file mode 100644 index 00000000000..81f2b6d09b7 --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/docs/GetState200Response.md @@ -0,0 +1,10 @@ +# GetState200Response + +## Enum Variants + +| Name | Value | +|---- | -----| + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/hyper/composed-oneof/docs/ObjA.md b/samples/client/others/rust/hyper/composed-oneof/docs/ObjA.md new file mode 100644 index 00000000000..40f6d31a64c --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/docs/ObjA.md @@ -0,0 +1,12 @@ +# ObjA + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**realtype** | Option<**String**> | | [optional] +**message** | Option<**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/client/others/rust/hyper/composed-oneof/docs/ObjB.md b/samples/client/others/rust/hyper/composed-oneof/docs/ObjB.md new file mode 100644 index 00000000000..e232623e9ec --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/docs/ObjB.md @@ -0,0 +1,13 @@ +# ObjB + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**realtype** | Option<**String**> | | [optional] +**description** | Option<**String**> | | [optional] +**code** | Option<**i32**> | | [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/client/others/rust/hyper/composed-oneof/docs/ObjC.md b/samples/client/others/rust/hyper/composed-oneof/docs/ObjC.md new file mode 100644 index 00000000000..52a0bf9f1be --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/docs/ObjC.md @@ -0,0 +1,12 @@ +# ObjC + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**realtype** | Option<**String**> | | [optional] +**state** | Option<**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/client/others/rust/hyper/composed-oneof/docs/ObjD.md b/samples/client/others/rust/hyper/composed-oneof/docs/ObjD.md new file mode 100644 index 00000000000..91d67f51311 --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/docs/ObjD.md @@ -0,0 +1,12 @@ +# ObjD + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**realtype** | Option<**String**> | | [optional] +**color** | Option<**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/client/others/rust/hyper/composed-oneof/git_push.sh b/samples/client/others/rust/hyper/composed-oneof/git_push.sh new file mode 100644 index 00000000000..f53a75d4fab --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/others/rust/hyper/composed-oneof/src/apis/client.rs b/samples/client/others/rust/hyper/composed-oneof/src/apis/client.rs new file mode 100644 index 00000000000..021112f848c --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/src/apis/client.rs @@ -0,0 +1,24 @@ +use std::rc::Rc; + +use hyper; +use super::configuration::Configuration; + +pub struct APIClient { + default_api: Box, +} + +impl APIClient { + pub fn new(configuration: Configuration) -> APIClient + where C: Clone + std::marker::Send + Sync + 'static { + let rc = Rc::new(configuration); + + APIClient { + default_api: Box::new(crate::apis::DefaultApiClient::new(rc.clone())), + } + } + + pub fn default_api(&self) -> &dyn crate::apis::DefaultApi{ + self.default_api.as_ref() + } + +} diff --git a/samples/client/others/rust/hyper/composed-oneof/src/apis/configuration.rs b/samples/client/others/rust/hyper/composed-oneof/src/apis/configuration.rs new file mode 100644 index 00000000000..22d9ed18fd9 --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/src/apis/configuration.rs @@ -0,0 +1,43 @@ +/* + * oneOf test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use hyper; + +pub struct Configuration + where C: Clone + std::marker::Send + Sync + 'static { + pub base_path: String, + pub user_agent: Option, + pub client: hyper::client::Client, + pub basic_auth: Option, + pub oauth_access_token: Option, + pub api_key: Option, + // TODO: take an oauth2 token source, similar to the go one +} + +pub type BasicAuth = (String, Option); + +pub struct ApiKey { + pub prefix: Option, + pub key: String, +} + +impl Configuration + where C: Clone + std::marker::Send + Sync { + pub fn new(client: hyper::client::Client) -> Configuration { + Configuration { + base_path: "http://localhost:8000".to_owned(), + user_agent: Some("OpenAPI-Generator/1.0.0/rust".to_owned()), + client, + basic_auth: None, + oauth_access_token: None, + api_key: None, + } + } +} diff --git a/samples/client/others/rust/hyper/composed-oneof/src/apis/default_api.rs b/samples/client/others/rust/hyper/composed-oneof/src/apis/default_api.rs new file mode 100644 index 00000000000..19ded47e2b5 --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/src/apis/default_api.rs @@ -0,0 +1,62 @@ +/* + * oneOf test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use std::rc::Rc; +use std::borrow::Borrow; +use std::pin::Pin; +#[allow(unused_imports)] +use std::option::Option; + +use hyper; +use futures::Future; + +use super::{Error, configuration}; +use super::request as __internal_request; + +pub struct DefaultApiClient + where C: Clone + std::marker::Send + Sync + 'static { + configuration: Rc>, +} + +impl DefaultApiClient + where C: Clone + std::marker::Send + Sync { + pub fn new(configuration: Rc>) -> DefaultApiClient { + DefaultApiClient { + configuration, + } + } +} + +pub trait DefaultApi { + fn create_state(&self, create_state_request: crate::models::CreateStateRequest) -> Pin>>>; + fn get_state(&self, ) -> Pin>>>; +} + +implDefaultApi for DefaultApiClient + where C: Clone + std::marker::Send + Sync { + #[allow(unused_mut)] + fn create_state(&self, create_state_request: crate::models::CreateStateRequest) -> Pin>>> { + let mut req = __internal_request::Request::new(hyper::Method::POST, "/state".to_string()) + ; + req = req.with_body_param(create_state_request); + req = req.returns_nothing(); + + req.execute(self.configuration.borrow()) + } + + #[allow(unused_mut)] + fn get_state(&self, ) -> Pin>>> { + let mut req = __internal_request::Request::new(hyper::Method::GET, "/state".to_string()) + ; + + req.execute(self.configuration.borrow()) + } + +} diff --git a/samples/client/others/rust/hyper/composed-oneof/src/apis/mod.rs b/samples/client/others/rust/hyper/composed-oneof/src/apis/mod.rs new file mode 100644 index 00000000000..1a5b2f58e4b --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/src/apis/mod.rs @@ -0,0 +1,54 @@ +use http; +use hyper; +use serde_json; + +#[derive(Debug)] +pub enum Error { + Api(ApiError), + Header(hyper::http::header::InvalidHeaderValue), + Http(http::Error), + Hyper(hyper::Error), + Serde(serde_json::Error), + UriError(http::uri::InvalidUri), +} + +#[derive(Debug)] +pub struct ApiError { + pub code: hyper::StatusCode, + pub body: hyper::body::Body, +} + +impl From<(hyper::StatusCode, hyper::body::Body)> for Error { + fn from(e: (hyper::StatusCode, hyper::body::Body)) -> Self { + Error::Api(ApiError { + code: e.0, + body: e.1, + }) + } +} + +impl From for Error { + fn from(e: http::Error) -> Self { + return Error::Http(e) + } +} + +impl From for Error { + fn from(e: hyper::Error) -> Self { + return Error::Hyper(e) + } +} + +impl From for Error { + fn from(e: serde_json::Error) -> Self { + return Error::Serde(e) + } +} + +mod request; + +mod default_api; +pub use self::default_api::{ DefaultApi, DefaultApiClient }; + +pub mod configuration; +pub mod client; diff --git a/samples/client/others/rust/hyper/composed-oneof/src/apis/request.rs b/samples/client/others/rust/hyper/composed-oneof/src/apis/request.rs new file mode 100644 index 00000000000..db4d55e47b1 --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/src/apis/request.rs @@ -0,0 +1,242 @@ +use std::collections::HashMap; +use std::pin::Pin; + +use futures; +use futures::Future; +use futures::future::*; +use hyper; +use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, HeaderValue, USER_AGENT}; +use serde; +use serde_json; + +use super::{configuration, Error}; + +pub(crate) struct ApiKey { + pub in_header: bool, + pub in_query: bool, + pub param_name: String, +} + +impl ApiKey { + fn key(&self, prefix: &Option, key: &str) -> String { + match prefix { + None => key.to_owned(), + Some(ref prefix) => format!("{} {}", prefix, key), + } + } +} + +#[allow(dead_code)] +pub(crate) enum Auth { + None, + ApiKey(ApiKey), + Basic, + Oauth, +} + +/// If the authorization type is unspecified then it will be automatically detected based +/// on the configuration. This functionality is useful when the OpenAPI definition does not +/// include an authorization scheme. +pub(crate) struct Request { + auth: Option, + method: hyper::Method, + path: String, + query_params: HashMap, + no_return_type: bool, + path_params: HashMap, + form_params: HashMap, + header_params: HashMap, + // TODO: multiple body params are possible technically, but not supported here. + serialized_body: Option, +} + +#[allow(dead_code)] +impl Request { + pub fn new(method: hyper::Method, path: String) -> Self { + Request { + auth: None, + method, + path, + query_params: HashMap::new(), + path_params: HashMap::new(), + form_params: HashMap::new(), + header_params: HashMap::new(), + serialized_body: None, + no_return_type: false, + } + } + + pub fn with_body_param(mut self, param: T) -> Self { + self.serialized_body = Some(serde_json::to_string(¶m).unwrap()); + self + } + + pub fn with_header_param(mut self, basename: String, param: String) -> Self { + self.header_params.insert(basename, param); + self + } + + #[allow(unused)] + pub fn with_query_param(mut self, basename: String, param: String) -> Self { + self.query_params.insert(basename, param); + self + } + + #[allow(unused)] + pub fn with_path_param(mut self, basename: String, param: String) -> Self { + self.path_params.insert(basename, param); + self + } + + #[allow(unused)] + pub fn with_form_param(mut self, basename: String, param: String) -> Self { + self.form_params.insert(basename, param); + self + } + + pub fn returns_nothing(mut self) -> Self { + self.no_return_type = true; + self + } + + pub fn with_auth(mut self, auth: Auth) -> Self { + self.auth = Some(auth); + self + } + + pub fn execute<'a, C, U>( + self, + conf: &configuration::Configuration, + ) -> Pin> + 'a>> + where + C: hyper::client::connect::Connect + Clone + std::marker::Send + Sync, + U: Sized + std::marker::Send + 'a, + for<'de> U: serde::Deserialize<'de>, + { + let mut query_string = ::url::form_urlencoded::Serializer::new("".to_owned()); + + let mut path = self.path; + for (k, v) in self.path_params { + // replace {id} with the value of the id path param + path = path.replace(&format!("{{{}}}", k), &v); + } + + for (key, val) in self.query_params { + query_string.append_pair(&key, &val); + } + + let mut uri_str = format!("{}{}", conf.base_path, path); + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri_str += "?"; + uri_str += &query_string_str; + } + let uri: hyper::Uri = match uri_str.parse() { + Err(e) => return Box::pin(futures::future::err(Error::UriError(e))), + Ok(u) => u, + }; + + let mut req_builder = hyper::Request::builder() + .uri(uri) + .method(self.method); + + // Detect the authorization type if it hasn't been set. + let auth = self.auth.unwrap_or_else(|| + if conf.api_key.is_some() { + panic!("Cannot automatically set the API key from the configuration, it must be specified in the OpenAPI definition") + } else if conf.oauth_access_token.is_some() { + Auth::Oauth + } else if conf.basic_auth.is_some() { + Auth::Basic + } else { + Auth::None + } + ); + match auth { + Auth::ApiKey(apikey) => { + if let Some(ref key) = conf.api_key { + let val = apikey.key(&key.prefix, &key.key); + if apikey.in_query { + query_string.append_pair(&apikey.param_name, &val); + } + if apikey.in_header { + req_builder = req_builder.header(&apikey.param_name, val); + } + } + } + Auth::Basic => { + if let Some(ref auth_conf) = conf.basic_auth { + let mut text = auth_conf.0.clone(); + text.push(':'); + if let Some(ref pass) = auth_conf.1 { + text.push_str(&pass[..]); + } + let encoded = base64::encode(&text); + req_builder = req_builder.header(AUTHORIZATION, encoded); + } + } + Auth::Oauth => { + if let Some(ref token) = conf.oauth_access_token { + let text = "Bearer ".to_owned() + token; + req_builder = req_builder.header(AUTHORIZATION, text); + } + } + Auth::None => {} + } + + if let Some(ref user_agent) = conf.user_agent { + req_builder = req_builder.header(USER_AGENT, match HeaderValue::from_str(user_agent) { + Ok(header_value) => header_value, + Err(e) => return Box::pin(futures::future::err(super::Error::Header(e))) + }); + } + + for (k, v) in self.header_params { + req_builder = req_builder.header(&k, v); + } + + let req_headers = req_builder.headers_mut().unwrap(); + let request_result = if self.form_params.len() > 0 { + req_headers.insert(CONTENT_TYPE, HeaderValue::from_static("application/x-www-form-urlencoded")); + let mut enc = ::url::form_urlencoded::Serializer::new("".to_owned()); + for (k, v) in self.form_params { + enc.append_pair(&k, &v); + } + req_builder.body(hyper::Body::from(enc.finish())) + } else if let Some(body) = self.serialized_body { + req_headers.insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); + req_headers.insert(CONTENT_LENGTH, body.len().into()); + req_builder.body(hyper::Body::from(body)) + } else { + req_builder.body(hyper::Body::default()) + }; + let request = match request_result { + Ok(request) => request, + Err(e) => return Box::pin(futures::future::err(Error::from(e))) + }; + + let no_return_type = self.no_return_type; + Box::pin(conf.client + .request(request) + .map_err(|e| Error::from(e)) + .and_then(move |response| { + let status = response.status(); + if !status.is_success() { + futures::future::err::(Error::from((status, response.into_body()))).boxed() + } else if no_return_type { + // This is a hack; if there's no_ret_type, U is (), but serde_json gives an + // error when deserializing "" into (), so deserialize 'null' into it + // instead. + // An alternate option would be to require U: Default, and then return + // U::default() here instead since () implements that, but then we'd + // need to impl default for all models. + futures::future::ok::(serde_json::from_str("null").expect("serde null value")).boxed() + } else { + hyper::body::to_bytes(response.into_body()) + .map(|bytes| serde_json::from_slice(&bytes.unwrap())) + .map_err(|e| Error::from(e)).boxed() + } + })) + } +} diff --git a/samples/client/others/rust/hyper/composed-oneof/src/lib.rs b/samples/client/others/rust/hyper/composed-oneof/src/lib.rs new file mode 100644 index 00000000000..a76d822525d --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/src/lib.rs @@ -0,0 +1,11 @@ +#[macro_use] +extern crate serde_derive; + +extern crate serde; +extern crate serde_json; +extern crate url; +extern crate hyper; +extern crate futures; + +pub mod apis; +pub mod models; diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/create_state_request.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/create_state_request.rs new file mode 100644 index 00000000000..5bd7a69cd8a --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/src/models/create_state_request.rs @@ -0,0 +1,30 @@ +/* + * oneOf test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use super::ObjA; +use super::ObjB; + + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(tag = "realtype")] +pub enum CreateStateRequest { + ObjA(Box), + ObjB(Box), +} + +impl Default for CreateStateRequest { + fn default() -> Self { + Self::ObjA(Box::default()) + } +} + + + + diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_array_schema_inner.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_array_schema_inner.rs new file mode 100644 index 00000000000..043f0b615ac --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_array_schema_inner.rs @@ -0,0 +1,32 @@ +/* + * oneOf test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use super::ObjA; +use super::ObjB; +use super::ObjC; + + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(tag = "realtype")] +pub enum CustomOneOfArraySchemaInner { + ObjA(Box), + ObjB(Box), + ObjC(Box), +} + +impl Default for CustomOneOfArraySchemaInner { + fn default() -> Self { + Self::ObjA(Box::default()) + } +} + + + + diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_schema.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_schema.rs new file mode 100644 index 00000000000..535f119b715 --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/src/models/custom_one_of_schema.rs @@ -0,0 +1,30 @@ +/* + * oneOf test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use super::ObjA; +use super::ObjB; + + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(tag = "realtype")] +pub enum CustomOneOfSchema { + ObjA(Box), + ObjB(Box), +} + +impl Default for CustomOneOfSchema { + fn default() -> Self { + Self::ObjA(Box::default()) + } +} + + + + diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/get_state_200_response.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/get_state_200_response.rs new file mode 100644 index 00000000000..d86f8d6ab65 --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/src/models/get_state_200_response.rs @@ -0,0 +1,32 @@ +/* + * oneOf test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use super::ObjA; +use super::ObjB; +use super::ObjD; + + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(tag = "realtype")] +pub enum GetState200Response { + ObjA(Box), + ObjB(Box), + ObjD(Box), +} + +impl Default for GetState200Response { + fn default() -> Self { + Self::ObjA(Box::default()) + } +} + + + + diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/mod.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/mod.rs new file mode 100644 index 00000000000..1eea461ec15 --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/src/models/mod.rs @@ -0,0 +1,16 @@ +pub mod create_state_request; +pub use self::create_state_request::CreateStateRequest; +pub mod custom_one_of_array_schema_inner; +pub use self::custom_one_of_array_schema_inner::CustomOneOfArraySchemaInner; +pub mod custom_one_of_schema; +pub use self::custom_one_of_schema::CustomOneOfSchema; +pub mod get_state_200_response; +pub use self::get_state_200_response::GetState200Response; +pub mod obj_a; +pub use self::obj_a::ObjA; +pub mod obj_b; +pub use self::obj_b::ObjB; +pub mod obj_c; +pub use self::obj_c::ObjC; +pub mod obj_d; +pub use self::obj_d::ObjD; diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/obj_a.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_a.rs new file mode 100644 index 00000000000..dc265f94834 --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_a.rs @@ -0,0 +1,31 @@ +/* + * oneOf test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ObjA { + #[serde(rename = "realtype", skip_serializing_if = "Option::is_none")] + pub realtype: Option, + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, +} + +impl ObjA { + pub fn new() -> ObjA { + ObjA { + realtype: None, + message: None, + } + } +} + + diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/obj_b.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_b.rs new file mode 100644 index 00000000000..0f664efd8bc --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_b.rs @@ -0,0 +1,34 @@ +/* + * oneOf test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ObjB { + #[serde(rename = "realtype", skip_serializing_if = "Option::is_none")] + pub realtype: Option, + #[serde(rename = "description", skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "code", skip_serializing_if = "Option::is_none")] + pub code: Option, +} + +impl ObjB { + pub fn new() -> ObjB { + ObjB { + realtype: None, + description: None, + code: None, + } + } +} + + diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/obj_c.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_c.rs new file mode 100644 index 00000000000..5aa6635e959 --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_c.rs @@ -0,0 +1,31 @@ +/* + * oneOf test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ObjC { + #[serde(rename = "realtype", skip_serializing_if = "Option::is_none")] + pub realtype: Option, + #[serde(rename = "state", skip_serializing_if = "Option::is_none")] + pub state: Option, +} + +impl ObjC { + pub fn new() -> ObjC { + ObjC { + realtype: None, + state: None, + } + } +} + + diff --git a/samples/client/others/rust/hyper/composed-oneof/src/models/obj_d.rs b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_d.rs new file mode 100644 index 00000000000..58101e561a8 --- /dev/null +++ b/samples/client/others/rust/hyper/composed-oneof/src/models/obj_d.rs @@ -0,0 +1,31 @@ +/* + * oneOf test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ObjD { + #[serde(rename = "realtype", skip_serializing_if = "Option::is_none")] + pub realtype: Option, + #[serde(rename = "color", skip_serializing_if = "Option::is_none")] + pub color: Option, +} + +impl ObjD { + pub fn new() -> ObjD { + ObjD { + realtype: None, + color: None, + } + } +} + + diff --git a/samples/client/others/rust/hyper/oneOf/.gitignore b/samples/client/others/rust/hyper/oneOf/.gitignore new file mode 100644 index 00000000000..6aa106405a4 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/.gitignore @@ -0,0 +1,3 @@ +/target/ +**/*.rs.bk +Cargo.lock diff --git a/samples/client/others/rust/hyper/oneOf/.openapi-generator-ignore b/samples/client/others/rust/hyper/oneOf/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/others/rust/hyper/oneOf/.openapi-generator/FILES b/samples/client/others/rust/hyper/oneOf/.openapi-generator/FILES new file mode 100644 index 00000000000..7452a306cce --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/.openapi-generator/FILES @@ -0,0 +1,51 @@ +.gitignore +.travis.yml +Cargo.toml +README.md +docs/Addressable.md +docs/Apple.md +docs/Banana.md +docs/Bar.md +docs/BarApi.md +docs/BarCreate.md +docs/BarRef.md +docs/BarRefOrValue.md +docs/Entity.md +docs/EntityRef.md +docs/Extensible.md +docs/Foo.md +docs/FooApi.md +docs/FooRef.md +docs/FooRefOrValue.md +docs/Fruit.md +docs/FruitType.md +docs/Pasta.md +docs/Pizza.md +docs/PizzaSpeziale.md +git_push.sh +src/apis/bar_api.rs +src/apis/client.rs +src/apis/configuration.rs +src/apis/foo_api.rs +src/apis/mod.rs +src/apis/request.rs +src/lib.rs +src/models/addressable.rs +src/models/apple.rs +src/models/banana.rs +src/models/bar.rs +src/models/bar_create.rs +src/models/bar_ref.rs +src/models/bar_ref_or_value.rs +src/models/entity.rs +src/models/entity_ref.rs +src/models/extensible.rs +src/models/foo.rs +src/models/foo_ref.rs +src/models/foo_ref_or_value.rs +src/models/fruit.rs +src/models/fruit_type.rs +src/models/mod.rs +src/models/pasta.rs +src/models/pizza.rs +src/models/pizza_speziale.rs diff --git a/samples/client/others/rust/hyper/oneOf/.openapi-generator/VERSION b/samples/client/others/rust/hyper/oneOf/.openapi-generator/VERSION new file mode 100644 index 00000000000..fff4bdd7ab5 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/others/rust/hyper/oneOf/.travis.yml b/samples/client/others/rust/hyper/oneOf/.travis.yml new file mode 100644 index 00000000000..22761ba7ee1 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/.travis.yml @@ -0,0 +1 @@ +language: rust diff --git a/samples/client/others/rust/hyper/oneOf/Cargo.toml b/samples/client/others/rust/hyper/oneOf/Cargo.toml new file mode 100644 index 00000000000..0209137ee82 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "oneof-hyper" +version = "0.0.1" +authors = ["OpenAPI Generator team and contributors"] +description = "This tests for a oneOf interface representation " +# Override this license by providing a License Object in the OpenAPI. +license = "Unlicense" +edition = "2018" + +[dependencies] +serde = "^1.0" +serde_derive = "^1.0" +serde_json = "^1.0" +url = "^2.2" +uuid = { version = "^1.0", features = ["serde", "v4"] } +hyper = { version = "~0.14", features = ["full"] } +hyper-tls = "~0.5" +http = "~0.2" +base64 = "~0.7.0" +futures = "^0.3" diff --git a/samples/client/others/rust/hyper/oneOf/README.md b/samples/client/others/rust/hyper/oneOf/README.md new file mode 100644 index 00000000000..62a2900a2b0 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/README.md @@ -0,0 +1,65 @@ +# Rust API client for oneof-hyper + +This tests for a oneOf interface representation + + + +## Overview + +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client. + +- API version: 0.0.1 +- Package version: 0.0.1 +- Build package: `org.openapitools.codegen.languages.RustClientCodegen` + +## Installation + +Put the package under your project folder in a directory named `oneof-hyper` and add the following to `Cargo.toml` under `[dependencies]`: + +``` +oneof-hyper = { path = "./oneof-hyper" } +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost:8080* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*BarApi* | [**create_bar**](docs/BarApi.md#create_bar) | **Post** /bar | Create a Bar +*FooApi* | [**create_foo**](docs/FooApi.md#create_foo) | **Post** /foo | Create a Foo +*FooApi* | [**get_all_foos**](docs/FooApi.md#get_all_foos) | **Get** /foo | GET all Foos + + +## Documentation For Models + + - [Addressable](docs/Addressable.md) + - [Apple](docs/Apple.md) + - [Banana](docs/Banana.md) + - [Bar](docs/Bar.md) + - [BarCreate](docs/BarCreate.md) + - [BarRef](docs/BarRef.md) + - [BarRefOrValue](docs/BarRefOrValue.md) + - [Entity](docs/Entity.md) + - [EntityRef](docs/EntityRef.md) + - [Extensible](docs/Extensible.md) + - [Foo](docs/Foo.md) + - [FooRef](docs/FooRef.md) + - [FooRefOrValue](docs/FooRefOrValue.md) + - [Fruit](docs/Fruit.md) + - [FruitType](docs/FruitType.md) + - [Pasta](docs/Pasta.md) + - [Pizza](docs/Pizza.md) + - [PizzaSpeziale](docs/PizzaSpeziale.md) + + +To get access to the crate's generated documentation, use: + +``` +cargo doc --open +``` + +## Author + + + diff --git a/samples/client/others/rust/hyper/oneOf/docs/Addressable.md b/samples/client/others/rust/hyper/oneOf/docs/Addressable.md new file mode 100644 index 00000000000..e91ee38c884 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/docs/Addressable.md @@ -0,0 +1,12 @@ +# Addressable + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**href** | Option<**String**> | Hyperlink reference | [optional] +**id** | Option<**String**> | unique identifier | [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/client/others/rust/hyper/oneOf/docs/Apple.md b/samples/client/others/rust/hyper/oneOf/docs/Apple.md new file mode 100644 index 00000000000..47243cc7b00 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/docs/Apple.md @@ -0,0 +1,11 @@ +# Apple + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**seeds** | **i32** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/hyper/oneOf/docs/Banana.md b/samples/client/others/rust/hyper/oneOf/docs/Banana.md new file mode 100644 index 00000000000..c543451a072 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/docs/Banana.md @@ -0,0 +1,11 @@ +# Banana + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**length** | **i32** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/hyper/oneOf/docs/Bar.md b/samples/client/others/rust/hyper/oneOf/docs/Bar.md new file mode 100644 index 00000000000..e923f9d0dfb --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/docs/Bar.md @@ -0,0 +1,18 @@ +# Bar + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**bar_prop_a** | Option<**String**> | | [optional] +**foo_prop_b** | Option<**String**> | | [optional] +**foo** | Option<[**crate::models::FooRefOrValue**](FooRefOrValue.md)> | | [optional] +**href** | Option<**String**> | Hyperlink reference | [optional] +**at_schema_location** | Option<**String**> | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**at_base_type** | Option<**String**> | When sub-classing, this defines the super-class | [optional] +**at_type** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/others/rust/hyper/oneOf/docs/BarApi.md b/samples/client/others/rust/hyper/oneOf/docs/BarApi.md new file mode 100644 index 00000000000..13cec790532 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/docs/BarApi.md @@ -0,0 +1,37 @@ +# \BarApi + +All URIs are relative to *http://localhost:8080* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_bar**](BarApi.md#create_bar) | **Post** /bar | Create a Bar + + + +## create_bar + +> crate::models::Bar create_bar(bar_create) +Create a Bar + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**bar_create** | [**BarCreate**](BarCreate.md) | | [required] | + +### Return type + +[**crate::models::Bar**](Bar.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/client/others/rust/hyper/oneOf/docs/BarCreate.md b/samples/client/others/rust/hyper/oneOf/docs/BarCreate.md new file mode 100644 index 00000000000..47eb6b9c3be --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/docs/BarCreate.md @@ -0,0 +1,18 @@ +# BarCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar_prop_a** | Option<**String**> | | [optional] +**foo_prop_b** | Option<**String**> | | [optional] +**foo** | Option<[**crate::models::FooRefOrValue**](FooRefOrValue.md)> | | [optional] +**href** | Option<**String**> | Hyperlink reference | [optional] +**id** | Option<**String**> | unique identifier | [optional] +**at_schema_location** | Option<**String**> | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**at_base_type** | Option<**String**> | When sub-classing, this defines the super-class | [optional] +**at_type** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/others/rust/hyper/oneOf/docs/BarRef.md b/samples/client/others/rust/hyper/oneOf/docs/BarRef.md new file mode 100644 index 00000000000..d06048b7bd4 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/docs/BarRef.md @@ -0,0 +1,17 @@ +# BarRef + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | Option<**String**> | Name of the related entity. | [optional] +**at_referred_type** | Option<**String**> | The actual type of the target instance when needed for disambiguation. | [optional] +**href** | Option<**String**> | Hyperlink reference | [optional] +**id** | Option<**String**> | unique identifier | [optional] +**at_schema_location** | Option<**String**> | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**at_base_type** | Option<**String**> | When sub-classing, this defines the super-class | [optional] +**at_type** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/others/rust/hyper/oneOf/docs/BarRefOrValue.md b/samples/client/others/rust/hyper/oneOf/docs/BarRefOrValue.md new file mode 100644 index 00000000000..22a0e619660 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/docs/BarRefOrValue.md @@ -0,0 +1,12 @@ +# BarRefOrValue + +## Enum Variants + +| Name | Description | +|---- | -----| +| Bar | | +| BarRef | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/hyper/oneOf/docs/Entity.md b/samples/client/others/rust/hyper/oneOf/docs/Entity.md new file mode 100644 index 00000000000..ef5b8318f76 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/docs/Entity.md @@ -0,0 +1,10 @@ +# Entity + +## Enum Variants + +| Name | Value | +|---- | -----| + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/hyper/oneOf/docs/EntityRef.md b/samples/client/others/rust/hyper/oneOf/docs/EntityRef.md new file mode 100644 index 00000000000..27695ed4b57 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/docs/EntityRef.md @@ -0,0 +1,10 @@ +# EntityRef + +## Enum Variants + +| Name | Value | +|---- | -----| + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/hyper/oneOf/docs/Extensible.md b/samples/client/others/rust/hyper/oneOf/docs/Extensible.md new file mode 100644 index 00000000000..1cbaaf3eaeb --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/docs/Extensible.md @@ -0,0 +1,13 @@ +# Extensible + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**at_schema_location** | Option<**String**> | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**at_base_type** | Option<**String**> | When sub-classing, this defines the super-class | [optional] +**at_type** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/others/rust/hyper/oneOf/docs/Foo.md b/samples/client/others/rust/hyper/oneOf/docs/Foo.md new file mode 100644 index 00000000000..e9c477f6402 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/docs/Foo.md @@ -0,0 +1,17 @@ +# Foo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**foo_prop_a** | Option<**String**> | | [optional] +**foo_prop_b** | Option<**String**> | | [optional] +**href** | Option<**String**> | Hyperlink reference | [optional] +**id** | Option<**String**> | unique identifier | [optional] +**at_schema_location** | Option<**String**> | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**at_base_type** | Option<**String**> | When sub-classing, this defines the super-class | [optional] +**at_type** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/others/rust/hyper/oneOf/docs/FooApi.md b/samples/client/others/rust/hyper/oneOf/docs/FooApi.md new file mode 100644 index 00000000000..459ccef2909 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/docs/FooApi.md @@ -0,0 +1,63 @@ +# \FooApi + +All URIs are relative to *http://localhost:8080* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_foo**](FooApi.md#create_foo) | **Post** /foo | Create a Foo +[**get_all_foos**](FooApi.md#get_all_foos) | **Get** /foo | GET all Foos + + + +## create_foo + +> crate::models::FooRefOrValue create_foo(foo) +Create a Foo + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**foo** | Option<[**Foo**](Foo.md)> | The Foo to be created | | + +### Return type + +[**crate::models::FooRefOrValue**](FooRefOrValue.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json;charset=utf-8 +- **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) + + +## get_all_foos + +> Vec get_all_foos() +GET all Foos + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**Vec**](FooRefOrValue.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json;charset=utf-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/others/rust/hyper/oneOf/docs/FooRef.md b/samples/client/others/rust/hyper/oneOf/docs/FooRef.md new file mode 100644 index 00000000000..cdf8713add3 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/docs/FooRef.md @@ -0,0 +1,18 @@ +# FooRef + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fooref_prop_a** | Option<**String**> | | [optional] +**name** | Option<**String**> | Name of the related entity. | [optional] +**at_referred_type** | Option<**String**> | The actual type of the target instance when needed for disambiguation. | [optional] +**href** | Option<**String**> | Hyperlink reference | [optional] +**id** | Option<**String**> | unique identifier | [optional] +**at_schema_location** | Option<**String**> | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**at_base_type** | Option<**String**> | When sub-classing, this defines the super-class | [optional] +**at_type** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/others/rust/hyper/oneOf/docs/FooRefOrValue.md b/samples/client/others/rust/hyper/oneOf/docs/FooRefOrValue.md new file mode 100644 index 00000000000..72c8d36e37c --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/docs/FooRefOrValue.md @@ -0,0 +1,10 @@ +# FooRefOrValue + +## Enum Variants + +| Name | Value | +|---- | -----| + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/hyper/oneOf/docs/Fruit.md b/samples/client/others/rust/hyper/oneOf/docs/Fruit.md new file mode 100644 index 00000000000..2dc45b5e5ad --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/docs/Fruit.md @@ -0,0 +1,10 @@ +# Fruit + +## Enum Variants + +| Name | Value | +|---- | -----| + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/hyper/oneOf/docs/FruitType.md b/samples/client/others/rust/hyper/oneOf/docs/FruitType.md new file mode 100644 index 00000000000..3bb295e1f45 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/docs/FruitType.md @@ -0,0 +1,13 @@ +# FruitType + +## Enum Variants + +| Name | Value | +|---- | -----| +| Apple | APPLE | +| Banana | BANANA | + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/hyper/oneOf/docs/Pasta.md b/samples/client/others/rust/hyper/oneOf/docs/Pasta.md new file mode 100644 index 00000000000..466f4771015 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/docs/Pasta.md @@ -0,0 +1,16 @@ +# Pasta + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**vendor** | Option<**String**> | | [optional] +**href** | Option<**String**> | Hyperlink reference | [optional] +**id** | Option<**String**> | unique identifier | [optional] +**at_schema_location** | Option<**String**> | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**at_base_type** | Option<**String**> | When sub-classing, this defines the super-class | [optional] +**at_type** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/others/rust/hyper/oneOf/docs/Pizza.md b/samples/client/others/rust/hyper/oneOf/docs/Pizza.md new file mode 100644 index 00000000000..4f01417f118 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/docs/Pizza.md @@ -0,0 +1,16 @@ +# Pizza + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**pizza_size** | Option<**f32**> | | [optional] +**href** | Option<**String**> | Hyperlink reference | [optional] +**id** | Option<**String**> | unique identifier | [optional] +**at_schema_location** | Option<**String**> | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**at_base_type** | Option<**String**> | When sub-classing, this defines the super-class | [optional] +**at_type** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/others/rust/hyper/oneOf/docs/PizzaSpeziale.md b/samples/client/others/rust/hyper/oneOf/docs/PizzaSpeziale.md new file mode 100644 index 00000000000..961ac04afe4 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/docs/PizzaSpeziale.md @@ -0,0 +1,17 @@ +# PizzaSpeziale + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**toppings** | Option<**String**> | | [optional] +**pizza_size** | Option<**f32**> | | [optional] +**href** | Option<**String**> | Hyperlink reference | [optional] +**id** | Option<**String**> | unique identifier | [optional] +**at_schema_location** | Option<**String**> | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**at_base_type** | Option<**String**> | When sub-classing, this defines the super-class | [optional] +**at_type** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/others/rust/hyper/oneOf/git_push.sh b/samples/client/others/rust/hyper/oneOf/git_push.sh new file mode 100644 index 00000000000..f53a75d4fab --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/others/rust/hyper/oneOf/pom.xml b/samples/client/others/rust/hyper/oneOf/pom.xml new file mode 100644 index 00000000000..c30cd504abf --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/pom.xml @@ -0,0 +1,46 @@ + + 4.0.0 + org.openapitools + RustHyperOneOfClientTests + pom + 1.0-SNAPSHOT + Rust Hyper oneOf Client + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + bundle-test + integration-test + + exec + + + cargo + + test + + + + + + + + diff --git a/samples/client/others/rust/hyper/oneOf/src/apis/bar_api.rs b/samples/client/others/rust/hyper/oneOf/src/apis/bar_api.rs new file mode 100644 index 00000000000..9d0d838b95a --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/apis/bar_api.rs @@ -0,0 +1,52 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + +use std::rc::Rc; +use std::borrow::Borrow; +use std::pin::Pin; +#[allow(unused_imports)] +use std::option::Option; + +use hyper; +use futures::Future; + +use super::{Error, configuration}; +use super::request as __internal_request; + +pub struct BarApiClient + where C: Clone + std::marker::Send + Sync + 'static { + configuration: Rc>, +} + +impl BarApiClient + where C: Clone + std::marker::Send + Sync { + pub fn new(configuration: Rc>) -> BarApiClient { + BarApiClient { + configuration, + } + } +} + +pub trait BarApi { + fn create_bar(&self, bar_create: crate::models::BarCreate) -> Pin>>>; +} + +implBarApi for BarApiClient + where C: Clone + std::marker::Send + Sync { + #[allow(unused_mut)] + fn create_bar(&self, bar_create: crate::models::BarCreate) -> Pin>>> { + let mut req = __internal_request::Request::new(hyper::Method::POST, "/bar".to_string()) + ; + req = req.with_body_param(bar_create); + + req.execute(self.configuration.borrow()) + } + +} diff --git a/samples/client/others/rust/hyper/oneOf/src/apis/client.rs b/samples/client/others/rust/hyper/oneOf/src/apis/client.rs new file mode 100644 index 00000000000..50a8c070c15 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/apis/client.rs @@ -0,0 +1,30 @@ +use std::rc::Rc; + +use hyper; +use super::configuration::Configuration; + +pub struct APIClient { + bar_api: Box, + foo_api: Box, +} + +impl APIClient { + pub fn new(configuration: Configuration) -> APIClient + where C: Clone + std::marker::Send + Sync + 'static { + let rc = Rc::new(configuration); + + APIClient { + bar_api: Box::new(crate::apis::BarApiClient::new(rc.clone())), + foo_api: Box::new(crate::apis::FooApiClient::new(rc.clone())), + } + } + + pub fn bar_api(&self) -> &dyn crate::apis::BarApi{ + self.bar_api.as_ref() + } + + pub fn foo_api(&self) -> &dyn crate::apis::FooApi{ + self.foo_api.as_ref() + } + +} diff --git a/samples/client/others/rust/hyper/oneOf/src/apis/configuration.rs b/samples/client/others/rust/hyper/oneOf/src/apis/configuration.rs new file mode 100644 index 00000000000..ceb9b776914 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/apis/configuration.rs @@ -0,0 +1,43 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + +use hyper; + +pub struct Configuration + where C: Clone + std::marker::Send + Sync + 'static { + pub base_path: String, + pub user_agent: Option, + pub client: hyper::client::Client, + pub basic_auth: Option, + pub oauth_access_token: Option, + pub api_key: Option, + // TODO: take an oauth2 token source, similar to the go one +} + +pub type BasicAuth = (String, Option); + +pub struct ApiKey { + pub prefix: Option, + pub key: String, +} + +impl Configuration + where C: Clone + std::marker::Send + Sync { + pub fn new(client: hyper::client::Client) -> Configuration { + Configuration { + base_path: "http://localhost:8080".to_owned(), + user_agent: Some("OpenAPI-Generator/0.0.1/rust".to_owned()), + client, + basic_auth: None, + oauth_access_token: None, + api_key: None, + } + } +} diff --git a/samples/client/others/rust/hyper/oneOf/src/apis/foo_api.rs b/samples/client/others/rust/hyper/oneOf/src/apis/foo_api.rs new file mode 100644 index 00000000000..e9ac63e81ee --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/apis/foo_api.rs @@ -0,0 +1,61 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + +use std::rc::Rc; +use std::borrow::Borrow; +use std::pin::Pin; +#[allow(unused_imports)] +use std::option::Option; + +use hyper; +use futures::Future; + +use super::{Error, configuration}; +use super::request as __internal_request; + +pub struct FooApiClient + where C: Clone + std::marker::Send + Sync + 'static { + configuration: Rc>, +} + +impl FooApiClient + where C: Clone + std::marker::Send + Sync { + pub fn new(configuration: Rc>) -> FooApiClient { + FooApiClient { + configuration, + } + } +} + +pub trait FooApi { + fn create_foo(&self, foo: Option) -> Pin>>>; + fn get_all_foos(&self, ) -> Pin, Error>>>>; +} + +implFooApi for FooApiClient + where C: Clone + std::marker::Send + Sync { + #[allow(unused_mut)] + fn create_foo(&self, foo: Option) -> Pin>>> { + let mut req = __internal_request::Request::new(hyper::Method::POST, "/foo".to_string()) + ; + req = req.with_body_param(foo); + + req.execute(self.configuration.borrow()) + } + + #[allow(unused_mut)] + fn get_all_foos(&self, ) -> Pin, Error>>>> { + let mut req = __internal_request::Request::new(hyper::Method::GET, "/foo".to_string()) + ; + + req.execute(self.configuration.borrow()) + } + +} diff --git a/samples/client/others/rust/hyper/oneOf/src/apis/mod.rs b/samples/client/others/rust/hyper/oneOf/src/apis/mod.rs new file mode 100644 index 00000000000..e0dbe42efe7 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/apis/mod.rs @@ -0,0 +1,56 @@ +use http; +use hyper; +use serde_json; + +#[derive(Debug)] +pub enum Error { + Api(ApiError), + Header(hyper::http::header::InvalidHeaderValue), + Http(http::Error), + Hyper(hyper::Error), + Serde(serde_json::Error), + UriError(http::uri::InvalidUri), +} + +#[derive(Debug)] +pub struct ApiError { + pub code: hyper::StatusCode, + pub body: hyper::body::Body, +} + +impl From<(hyper::StatusCode, hyper::body::Body)> for Error { + fn from(e: (hyper::StatusCode, hyper::body::Body)) -> Self { + Error::Api(ApiError { + code: e.0, + body: e.1, + }) + } +} + +impl From for Error { + fn from(e: http::Error) -> Self { + return Error::Http(e) + } +} + +impl From for Error { + fn from(e: hyper::Error) -> Self { + return Error::Hyper(e) + } +} + +impl From for Error { + fn from(e: serde_json::Error) -> Self { + return Error::Serde(e) + } +} + +mod request; + +mod bar_api; +pub use self::bar_api::{ BarApi, BarApiClient }; +mod foo_api; +pub use self::foo_api::{ FooApi, FooApiClient }; + +pub mod configuration; +pub mod client; diff --git a/samples/client/others/rust/hyper/oneOf/src/apis/request.rs b/samples/client/others/rust/hyper/oneOf/src/apis/request.rs new file mode 100644 index 00000000000..db4d55e47b1 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/apis/request.rs @@ -0,0 +1,242 @@ +use std::collections::HashMap; +use std::pin::Pin; + +use futures; +use futures::Future; +use futures::future::*; +use hyper; +use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, HeaderValue, USER_AGENT}; +use serde; +use serde_json; + +use super::{configuration, Error}; + +pub(crate) struct ApiKey { + pub in_header: bool, + pub in_query: bool, + pub param_name: String, +} + +impl ApiKey { + fn key(&self, prefix: &Option, key: &str) -> String { + match prefix { + None => key.to_owned(), + Some(ref prefix) => format!("{} {}", prefix, key), + } + } +} + +#[allow(dead_code)] +pub(crate) enum Auth { + None, + ApiKey(ApiKey), + Basic, + Oauth, +} + +/// If the authorization type is unspecified then it will be automatically detected based +/// on the configuration. This functionality is useful when the OpenAPI definition does not +/// include an authorization scheme. +pub(crate) struct Request { + auth: Option, + method: hyper::Method, + path: String, + query_params: HashMap, + no_return_type: bool, + path_params: HashMap, + form_params: HashMap, + header_params: HashMap, + // TODO: multiple body params are possible technically, but not supported here. + serialized_body: Option, +} + +#[allow(dead_code)] +impl Request { + pub fn new(method: hyper::Method, path: String) -> Self { + Request { + auth: None, + method, + path, + query_params: HashMap::new(), + path_params: HashMap::new(), + form_params: HashMap::new(), + header_params: HashMap::new(), + serialized_body: None, + no_return_type: false, + } + } + + pub fn with_body_param(mut self, param: T) -> Self { + self.serialized_body = Some(serde_json::to_string(¶m).unwrap()); + self + } + + pub fn with_header_param(mut self, basename: String, param: String) -> Self { + self.header_params.insert(basename, param); + self + } + + #[allow(unused)] + pub fn with_query_param(mut self, basename: String, param: String) -> Self { + self.query_params.insert(basename, param); + self + } + + #[allow(unused)] + pub fn with_path_param(mut self, basename: String, param: String) -> Self { + self.path_params.insert(basename, param); + self + } + + #[allow(unused)] + pub fn with_form_param(mut self, basename: String, param: String) -> Self { + self.form_params.insert(basename, param); + self + } + + pub fn returns_nothing(mut self) -> Self { + self.no_return_type = true; + self + } + + pub fn with_auth(mut self, auth: Auth) -> Self { + self.auth = Some(auth); + self + } + + pub fn execute<'a, C, U>( + self, + conf: &configuration::Configuration, + ) -> Pin> + 'a>> + where + C: hyper::client::connect::Connect + Clone + std::marker::Send + Sync, + U: Sized + std::marker::Send + 'a, + for<'de> U: serde::Deserialize<'de>, + { + let mut query_string = ::url::form_urlencoded::Serializer::new("".to_owned()); + + let mut path = self.path; + for (k, v) in self.path_params { + // replace {id} with the value of the id path param + path = path.replace(&format!("{{{}}}", k), &v); + } + + for (key, val) in self.query_params { + query_string.append_pair(&key, &val); + } + + let mut uri_str = format!("{}{}", conf.base_path, path); + + let query_string_str = query_string.finish(); + if !query_string_str.is_empty() { + uri_str += "?"; + uri_str += &query_string_str; + } + let uri: hyper::Uri = match uri_str.parse() { + Err(e) => return Box::pin(futures::future::err(Error::UriError(e))), + Ok(u) => u, + }; + + let mut req_builder = hyper::Request::builder() + .uri(uri) + .method(self.method); + + // Detect the authorization type if it hasn't been set. + let auth = self.auth.unwrap_or_else(|| + if conf.api_key.is_some() { + panic!("Cannot automatically set the API key from the configuration, it must be specified in the OpenAPI definition") + } else if conf.oauth_access_token.is_some() { + Auth::Oauth + } else if conf.basic_auth.is_some() { + Auth::Basic + } else { + Auth::None + } + ); + match auth { + Auth::ApiKey(apikey) => { + if let Some(ref key) = conf.api_key { + let val = apikey.key(&key.prefix, &key.key); + if apikey.in_query { + query_string.append_pair(&apikey.param_name, &val); + } + if apikey.in_header { + req_builder = req_builder.header(&apikey.param_name, val); + } + } + } + Auth::Basic => { + if let Some(ref auth_conf) = conf.basic_auth { + let mut text = auth_conf.0.clone(); + text.push(':'); + if let Some(ref pass) = auth_conf.1 { + text.push_str(&pass[..]); + } + let encoded = base64::encode(&text); + req_builder = req_builder.header(AUTHORIZATION, encoded); + } + } + Auth::Oauth => { + if let Some(ref token) = conf.oauth_access_token { + let text = "Bearer ".to_owned() + token; + req_builder = req_builder.header(AUTHORIZATION, text); + } + } + Auth::None => {} + } + + if let Some(ref user_agent) = conf.user_agent { + req_builder = req_builder.header(USER_AGENT, match HeaderValue::from_str(user_agent) { + Ok(header_value) => header_value, + Err(e) => return Box::pin(futures::future::err(super::Error::Header(e))) + }); + } + + for (k, v) in self.header_params { + req_builder = req_builder.header(&k, v); + } + + let req_headers = req_builder.headers_mut().unwrap(); + let request_result = if self.form_params.len() > 0 { + req_headers.insert(CONTENT_TYPE, HeaderValue::from_static("application/x-www-form-urlencoded")); + let mut enc = ::url::form_urlencoded::Serializer::new("".to_owned()); + for (k, v) in self.form_params { + enc.append_pair(&k, &v); + } + req_builder.body(hyper::Body::from(enc.finish())) + } else if let Some(body) = self.serialized_body { + req_headers.insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); + req_headers.insert(CONTENT_LENGTH, body.len().into()); + req_builder.body(hyper::Body::from(body)) + } else { + req_builder.body(hyper::Body::default()) + }; + let request = match request_result { + Ok(request) => request, + Err(e) => return Box::pin(futures::future::err(Error::from(e))) + }; + + let no_return_type = self.no_return_type; + Box::pin(conf.client + .request(request) + .map_err(|e| Error::from(e)) + .and_then(move |response| { + let status = response.status(); + if !status.is_success() { + futures::future::err::(Error::from((status, response.into_body()))).boxed() + } else if no_return_type { + // This is a hack; if there's no_ret_type, U is (), but serde_json gives an + // error when deserializing "" into (), so deserialize 'null' into it + // instead. + // An alternate option would be to require U: Default, and then return + // U::default() here instead since () implements that, but then we'd + // need to impl default for all models. + futures::future::ok::(serde_json::from_str("null").expect("serde null value")).boxed() + } else { + hyper::body::to_bytes(response.into_body()) + .map(|bytes| serde_json::from_slice(&bytes.unwrap())) + .map_err(|e| Error::from(e)).boxed() + } + })) + } +} diff --git a/samples/client/others/rust/hyper/oneOf/src/lib.rs b/samples/client/others/rust/hyper/oneOf/src/lib.rs new file mode 100644 index 00000000000..a76d822525d --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/lib.rs @@ -0,0 +1,11 @@ +#[macro_use] +extern crate serde_derive; + +extern crate serde; +extern crate serde_json; +extern crate url; +extern crate hyper; +extern crate futures; + +pub mod apis; +pub mod models; diff --git a/samples/client/others/rust/hyper/oneOf/src/models/addressable.rs b/samples/client/others/rust/hyper/oneOf/src/models/addressable.rs new file mode 100644 index 00000000000..1110f9bd0aa --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/models/addressable.rs @@ -0,0 +1,35 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + +/// Addressable : Base schema for addressable entities + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Addressable { + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + pub href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, +} + +impl Addressable { + /// Base schema for addressable entities + pub fn new() -> Addressable { + Addressable { + href: None, + id: None, + } + } +} + + diff --git a/samples/client/others/rust/hyper/oneOf/src/models/apple.rs b/samples/client/others/rust/hyper/oneOf/src/models/apple.rs new file mode 100644 index 00000000000..dd244a933f1 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/models/apple.rs @@ -0,0 +1,28 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Apple { + #[serde(rename = "seeds")] + pub seeds: i32, +} + +impl Apple { + pub fn new(seeds: i32) -> Apple { + Apple { + seeds, + } + } +} + + diff --git a/samples/client/others/rust/hyper/oneOf/src/models/banana.rs b/samples/client/others/rust/hyper/oneOf/src/models/banana.rs new file mode 100644 index 00000000000..8330cc76c6c --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/models/banana.rs @@ -0,0 +1,28 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Banana { + #[serde(rename = "length")] + pub length: i32, +} + +impl Banana { + pub fn new(length: i32) -> Banana { + Banana { + length, + } + } +} + + diff --git a/samples/client/others/rust/hyper/oneOf/src/models/bar.rs b/samples/client/others/rust/hyper/oneOf/src/models/bar.rs new file mode 100644 index 00000000000..0d25ee98777 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/models/bar.rs @@ -0,0 +1,53 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Bar { + #[serde(rename = "id")] + pub id: String, + #[serde(rename = "barPropA", skip_serializing_if = "Option::is_none")] + pub bar_prop_a: Option, + #[serde(rename = "fooPropB", skip_serializing_if = "Option::is_none")] + pub foo_prop_b: Option, + #[serde(rename = "foo", skip_serializing_if = "Option::is_none")] + pub foo: Option>, + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + pub href: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + pub at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + pub at_base_type: Option, + /// When sub-classing, this defines the sub-class Extensible name + #[serde(rename = "@type")] + pub at_type: String, +} + +impl Bar { + pub fn new(id: String, at_type: String) -> Bar { + Bar { + id, + bar_prop_a: None, + foo_prop_b: None, + foo: None, + href: None, + at_schema_location: None, + at_base_type: None, + at_type, + } + } +} + + diff --git a/samples/client/others/rust/hyper/oneOf/src/models/bar_create.rs b/samples/client/others/rust/hyper/oneOf/src/models/bar_create.rs new file mode 100644 index 00000000000..950642d7dce --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/models/bar_create.rs @@ -0,0 +1,54 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct BarCreate { + #[serde(rename = "barPropA", skip_serializing_if = "Option::is_none")] + pub bar_prop_a: Option, + #[serde(rename = "fooPropB", skip_serializing_if = "Option::is_none")] + pub foo_prop_b: Option, + #[serde(rename = "foo", skip_serializing_if = "Option::is_none")] + pub foo: Option>, + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + pub href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + pub at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + pub at_base_type: Option, + /// When sub-classing, this defines the sub-class Extensible name + #[serde(rename = "@type")] + pub at_type: String, +} + +impl BarCreate { + pub fn new(at_type: String) -> BarCreate { + BarCreate { + bar_prop_a: None, + foo_prop_b: None, + foo: None, + href: None, + id: None, + at_schema_location: None, + at_base_type: None, + at_type, + } + } +} + + diff --git a/samples/client/others/rust/hyper/oneOf/src/models/bar_ref.rs b/samples/client/others/rust/hyper/oneOf/src/models/bar_ref.rs new file mode 100644 index 00000000000..9c671a320c0 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/models/bar_ref.rs @@ -0,0 +1,53 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct BarRef { + /// Name of the related entity. + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + /// The actual type of the target instance when needed for disambiguation. + #[serde(rename = "@referredType", skip_serializing_if = "Option::is_none")] + pub at_referred_type: Option, + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + pub href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + pub at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + pub at_base_type: Option, + /// When sub-classing, this defines the sub-class Extensible name + #[serde(rename = "@type")] + pub at_type: String, +} + +impl BarRef { + pub fn new(at_type: String) -> BarRef { + BarRef { + name: None, + at_referred_type: None, + href: None, + id: None, + at_schema_location: None, + at_base_type: None, + at_type, + } + } +} + + diff --git a/samples/client/others/rust/hyper/oneOf/src/models/bar_ref_or_value.rs b/samples/client/others/rust/hyper/oneOf/src/models/bar_ref_or_value.rs new file mode 100644 index 00000000000..f7a595f0cd3 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/models/bar_ref_or_value.rs @@ -0,0 +1,29 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + +use super::Bar; +use super::BarRef; + + + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum BarRefOrValue { + Bar(Box), + BarRef(Box), +} + +impl Default for BarRefOrValue { + fn default() -> Self { + Self::Bar(Box::default()) + } +} + + diff --git a/samples/client/others/rust/hyper/oneOf/src/models/entity.rs b/samples/client/others/rust/hyper/oneOf/src/models/entity.rs new file mode 100644 index 00000000000..6636ab6bd9d --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/models/entity.rs @@ -0,0 +1,121 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(tag = "@type")] +pub enum Entity { + #[serde(rename="Bar")] + Bar { + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + at_base_type: Option, + }, + #[serde(rename="Bar_Create")] + BarCreate { + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + at_base_type: Option, + }, + #[serde(rename="Foo")] + Foo { + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + at_base_type: Option, + }, + #[serde(rename="Pasta")] + Pasta { + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + at_base_type: Option, + }, + #[serde(rename="Pizza")] + Pizza { + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + at_base_type: Option, + }, + #[serde(rename="PizzaSpeziale")] + PizzaSpeziale { + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + at_base_type: Option, + }, +} + +impl Default for Entity { + fn default() -> Self { + Self::Bar { + href: Default::default(), + id: Default::default(), + at_schema_location: Default::default(), + at_base_type: Default::default(), + } + } +} + + + + diff --git a/samples/client/others/rust/hyper/oneOf/src/models/entity_ref.rs b/samples/client/others/rust/hyper/oneOf/src/models/entity_ref.rs new file mode 100644 index 00000000000..6a2f4b8da22 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/models/entity_ref.rs @@ -0,0 +1,76 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + +/// EntityRef : Entity reference schema to be use for all entityRef class. + + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(tag = "@type")] +pub enum EntityRef { + #[serde(rename="BarRef")] + BarRef { + /// Name of the related entity. + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + name: Option, + /// The actual type of the target instance when needed for disambiguation. + #[serde(rename = "@referredType", skip_serializing_if = "Option::is_none")] + at_referred_type: Option, + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + at_base_type: Option, + }, + #[serde(rename="FooRef")] + FooRef { + /// Name of the related entity. + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + name: Option, + /// The actual type of the target instance when needed for disambiguation. + #[serde(rename = "@referredType", skip_serializing_if = "Option::is_none")] + at_referred_type: Option, + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + at_base_type: Option, + }, +} + +impl Default for EntityRef { + fn default() -> Self { + Self::BarRef { + name: Default::default(), + at_referred_type: Default::default(), + href: Default::default(), + id: Default::default(), + at_schema_location: Default::default(), + at_base_type: Default::default(), + } + } +} + + + + diff --git a/samples/client/others/rust/hyper/oneOf/src/models/extensible.rs b/samples/client/others/rust/hyper/oneOf/src/models/extensible.rs new file mode 100644 index 00000000000..65b77694965 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/models/extensible.rs @@ -0,0 +1,37 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Extensible { + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + pub at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + pub at_base_type: Option, + /// When sub-classing, this defines the sub-class Extensible name + #[serde(rename = "@type")] + pub at_type: String, +} + +impl Extensible { + pub fn new(at_type: String) -> Extensible { + Extensible { + at_schema_location: None, + at_base_type: None, + at_type, + } + } +} + + diff --git a/samples/client/others/rust/hyper/oneOf/src/models/foo.rs b/samples/client/others/rust/hyper/oneOf/src/models/foo.rs new file mode 100644 index 00000000000..4b865bfa7dc --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/models/foo.rs @@ -0,0 +1,51 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Foo { + #[serde(rename = "fooPropA", skip_serializing_if = "Option::is_none")] + pub foo_prop_a: Option, + #[serde(rename = "fooPropB", skip_serializing_if = "Option::is_none")] + pub foo_prop_b: Option, + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + pub href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + pub at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + pub at_base_type: Option, + /// When sub-classing, this defines the sub-class Extensible name + #[serde(rename = "@type")] + pub at_type: String, +} + +impl Foo { + pub fn new(at_type: String) -> Foo { + Foo { + foo_prop_a: None, + foo_prop_b: None, + href: None, + id: None, + at_schema_location: None, + at_base_type: None, + at_type, + } + } +} + + diff --git a/samples/client/others/rust/hyper/oneOf/src/models/foo_ref.rs b/samples/client/others/rust/hyper/oneOf/src/models/foo_ref.rs new file mode 100644 index 00000000000..fb28017bd08 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/models/foo_ref.rs @@ -0,0 +1,56 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct FooRef { + #[serde(rename = "foorefPropA", skip_serializing_if = "Option::is_none")] + pub fooref_prop_a: Option, + /// Name of the related entity. + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + /// The actual type of the target instance when needed for disambiguation. + #[serde(rename = "@referredType", skip_serializing_if = "Option::is_none")] + pub at_referred_type: Option, + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + pub href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + pub at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + pub at_base_type: Option, + /// When sub-classing, this defines the sub-class Extensible name + #[serde(rename = "@type")] + pub at_type: String, +} + +impl FooRef { + pub fn new(at_type: String) -> FooRef { + FooRef { + fooref_prop_a: None, + name: None, + at_referred_type: None, + href: None, + id: None, + at_schema_location: None, + at_base_type: None, + at_type, + } + } +} + + diff --git a/samples/client/others/rust/hyper/oneOf/src/models/foo_ref_or_value.rs b/samples/client/others/rust/hyper/oneOf/src/models/foo_ref_or_value.rs new file mode 100644 index 00000000000..8e0b9e188e1 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/models/foo_ref_or_value.rs @@ -0,0 +1,30 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + +use super::Foo; +use super::FooRef; + + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(tag = "@type")] +pub enum FooRefOrValue { + Foo(Box), + FooRef(Box), +} + +impl Default for FooRefOrValue { + fn default() -> Self { + Self::Foo(Box::default()) + } +} + + + + diff --git a/samples/client/others/rust/hyper/oneOf/src/models/fruit.rs b/samples/client/others/rust/hyper/oneOf/src/models/fruit.rs new file mode 100644 index 00000000000..4c01c95a8d7 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/models/fruit.rs @@ -0,0 +1,30 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + +use super::Apple; +use super::Banana; + + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(tag = "fruitType")] +pub enum Fruit { + Apple(Box), + Banana(Box), +} + +impl Default for Fruit { + fn default() -> Self { + Self::Apple(Box::default()) + } +} + + + + diff --git a/samples/client/others/rust/hyper/oneOf/src/models/fruit_type.rs b/samples/client/others/rust/hyper/oneOf/src/models/fruit_type.rs new file mode 100644 index 00000000000..3927e1805e1 --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/models/fruit_type.rs @@ -0,0 +1,39 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum FruitType { + #[serde(rename = "APPLE")] + Apple, + #[serde(rename = "BANANA")] + Banana, + +} + +impl ToString for FruitType { + fn to_string(&self) -> String { + match self { + Self::Apple => String::from("APPLE"), + Self::Banana => String::from("BANANA"), + } + } +} + +impl Default for FruitType { + fn default() -> FruitType { + Self::Apple + } +} + + + + diff --git a/samples/client/others/rust/hyper/oneOf/src/models/mod.rs b/samples/client/others/rust/hyper/oneOf/src/models/mod.rs new file mode 100644 index 00000000000..581d09587bc --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/models/mod.rs @@ -0,0 +1,36 @@ +pub mod addressable; +pub use self::addressable::Addressable; +pub mod apple; +pub use self::apple::Apple; +pub mod banana; +pub use self::banana::Banana; +pub mod bar; +pub use self::bar::Bar; +pub mod bar_create; +pub use self::bar_create::BarCreate; +pub mod bar_ref; +pub use self::bar_ref::BarRef; +pub mod bar_ref_or_value; +pub use self::bar_ref_or_value::BarRefOrValue; +pub mod entity; +pub use self::entity::Entity; +pub mod entity_ref; +pub use self::entity_ref::EntityRef; +pub mod extensible; +pub use self::extensible::Extensible; +pub mod foo; +pub use self::foo::Foo; +pub mod foo_ref; +pub use self::foo_ref::FooRef; +pub mod foo_ref_or_value; +pub use self::foo_ref_or_value::FooRefOrValue; +pub mod fruit; +pub use self::fruit::Fruit; +pub mod fruit_type; +pub use self::fruit_type::FruitType; +pub mod pasta; +pub use self::pasta::Pasta; +pub mod pizza; +pub use self::pizza::Pizza; +pub mod pizza_speziale; +pub use self::pizza_speziale::PizzaSpeziale; diff --git a/samples/client/others/rust/hyper/oneOf/src/models/pasta.rs b/samples/client/others/rust/hyper/oneOf/src/models/pasta.rs new file mode 100644 index 00000000000..11f64426bbe --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/models/pasta.rs @@ -0,0 +1,48 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Pasta { + #[serde(rename = "vendor", skip_serializing_if = "Option::is_none")] + pub vendor: Option, + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + pub href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + pub at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + pub at_base_type: Option, + /// When sub-classing, this defines the sub-class Extensible name + #[serde(rename = "@type")] + pub at_type: String, +} + +impl Pasta { + pub fn new(at_type: String) -> Pasta { + Pasta { + vendor: None, + href: None, + id: None, + at_schema_location: None, + at_base_type: None, + at_type, + } + } +} + + diff --git a/samples/client/others/rust/hyper/oneOf/src/models/pizza.rs b/samples/client/others/rust/hyper/oneOf/src/models/pizza.rs new file mode 100644 index 00000000000..571ef0a674e --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/models/pizza.rs @@ -0,0 +1,48 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Pizza { + #[serde(rename = "pizzaSize", skip_serializing_if = "Option::is_none")] + pub pizza_size: Option, + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + pub href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + pub at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + pub at_base_type: Option, + /// When sub-classing, this defines the sub-class Extensible name + #[serde(rename = "@type")] + pub at_type: String, +} + +impl Pizza { + pub fn new(at_type: String) -> Pizza { + Pizza { + pizza_size: None, + href: None, + id: None, + at_schema_location: None, + at_base_type: None, + at_type, + } + } +} + + diff --git a/samples/client/others/rust/hyper/oneOf/src/models/pizza_speziale.rs b/samples/client/others/rust/hyper/oneOf/src/models/pizza_speziale.rs new file mode 100644 index 00000000000..a7ee348297c --- /dev/null +++ b/samples/client/others/rust/hyper/oneOf/src/models/pizza_speziale.rs @@ -0,0 +1,51 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PizzaSpeziale { + #[serde(rename = "toppings", skip_serializing_if = "Option::is_none")] + pub toppings: Option, + #[serde(rename = "pizzaSize", skip_serializing_if = "Option::is_none")] + pub pizza_size: Option, + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + pub href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + pub at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + pub at_base_type: Option, + /// When sub-classing, this defines the sub-class Extensible name + #[serde(rename = "@type")] + pub at_type: String, +} + +impl PizzaSpeziale { + pub fn new(at_type: String) -> PizzaSpeziale { + PizzaSpeziale { + toppings: None, + pizza_size: None, + href: None, + id: None, + at_schema_location: None, + at_base_type: None, + at_type, + } + } +} + + diff --git a/samples/client/others/rust/pom.xml b/samples/client/others/rust/pom.xml new file mode 100644 index 00000000000..d53b2aef348 --- /dev/null +++ b/samples/client/others/rust/pom.xml @@ -0,0 +1,46 @@ + + 4.0.0 + org.openapitools + RustOtherClientTests + pom + 1.0-SNAPSHOT + Rust Other Client + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + bundle-test + integration-test + + exec + + + cargo + + check + + + + + + + + diff --git a/samples/client/others/rust/reqwest-regression-16119/src/apis/default_api.rs b/samples/client/others/rust/reqwest-regression-16119/src/apis/default_api.rs index 5cd95896b7d..8e88609ed8b 100644 --- a/samples/client/others/rust/reqwest-regression-16119/src/apis/default_api.rs +++ b/samples/client/others/rust/reqwest-regression-16119/src/apis/default_api.rs @@ -36,7 +36,7 @@ pub fn repro(configuration: &configuration::Configuration, ) -> Result>, diff --git a/samples/client/others/rust/reqwest/composed-oneof/.gitignore b/samples/client/others/rust/reqwest/composed-oneof/.gitignore new file mode 100644 index 00000000000..6aa106405a4 --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/.gitignore @@ -0,0 +1,3 @@ +/target/ +**/*.rs.bk +Cargo.lock diff --git a/samples/client/others/rust/reqwest/composed-oneof/.openapi-generator-ignore b/samples/client/others/rust/reqwest/composed-oneof/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/others/rust/reqwest/composed-oneof/.openapi-generator/FILES b/samples/client/others/rust/reqwest/composed-oneof/.openapi-generator/FILES new file mode 100644 index 00000000000..68b25f4e50d --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/.openapi-generator/FILES @@ -0,0 +1,27 @@ +.gitignore +.travis.yml +Cargo.toml +README.md +docs/CreateStateRequest.md +docs/CustomOneOfArraySchemaInner.md +docs/CustomOneOfSchema.md +docs/DefaultApi.md +docs/GetState200Response.md +docs/ObjA.md +docs/ObjB.md +docs/ObjC.md +docs/ObjD.md +git_push.sh +src/apis/configuration.rs +src/apis/default_api.rs +src/apis/mod.rs +src/lib.rs +src/models/create_state_request.rs +src/models/custom_one_of_array_schema_inner.rs +src/models/custom_one_of_schema.rs +src/models/get_state_200_response.rs +src/models/mod.rs +src/models/obj_a.rs +src/models/obj_b.rs +src/models/obj_c.rs +src/models/obj_d.rs diff --git a/samples/client/others/rust/reqwest/composed-oneof/.openapi-generator/VERSION b/samples/client/others/rust/reqwest/composed-oneof/.openapi-generator/VERSION new file mode 100644 index 00000000000..fff4bdd7ab5 --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/others/rust/reqwest/composed-oneof/.travis.yml b/samples/client/others/rust/reqwest/composed-oneof/.travis.yml new file mode 100644 index 00000000000..22761ba7ee1 --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/.travis.yml @@ -0,0 +1 @@ +language: rust diff --git a/samples/client/others/rust/reqwest/composed-oneof/Cargo.toml b/samples/client/others/rust/reqwest/composed-oneof/Cargo.toml new file mode 100644 index 00000000000..0ff96294b5a --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "composed-oneof-reqwest" +version = "1.0.0" +authors = ["OpenAPI Generator team and contributors"] +description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)" +# Override this license by providing a License Object in the OpenAPI. +license = "Unlicense" +edition = "2018" + +[dependencies] +serde = "^1.0" +serde_derive = "^1.0" +serde_json = "^1.0" +url = "^2.2" +uuid = { version = "^1.0", features = ["serde", "v4"] } +[dependencies.reqwest] +version = "^0.11" +features = ["json", "blocking", "multipart"] diff --git a/samples/client/others/rust/reqwest/composed-oneof/README.md b/samples/client/others/rust/reqwest/composed-oneof/README.md new file mode 100644 index 00000000000..daf07eac69d --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/README.md @@ -0,0 +1,53 @@ +# Rust API client for composed-oneof-reqwest + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + +## Overview + +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client. + +- API version: 1.0.0 +- Package version: 1.0.0 +- Build package: `org.openapitools.codegen.languages.RustClientCodegen` + +## Installation + +Put the package under your project folder in a directory named `composed-oneof-reqwest` and add the following to `Cargo.toml` under `[dependencies]`: + +``` +composed-oneof-reqwest = { path = "./composed-oneof-reqwest" } +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost:8000* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*DefaultApi* | [**create_state**](docs/DefaultApi.md#create_state) | **POST** /state | +*DefaultApi* | [**get_state**](docs/DefaultApi.md#get_state) | **GET** /state | + + +## Documentation For Models + + - [CreateStateRequest](docs/CreateStateRequest.md) + - [CustomOneOfArraySchemaInner](docs/CustomOneOfArraySchemaInner.md) + - [CustomOneOfSchema](docs/CustomOneOfSchema.md) + - [GetState200Response](docs/GetState200Response.md) + - [ObjA](docs/ObjA.md) + - [ObjB](docs/ObjB.md) + - [ObjC](docs/ObjC.md) + - [ObjD](docs/ObjD.md) + + +To get access to the crate's generated documentation, use: + +``` +cargo doc --open +``` + +## Author + + + diff --git a/samples/client/others/rust/reqwest/composed-oneof/docs/CreateStateRequest.md b/samples/client/others/rust/reqwest/composed-oneof/docs/CreateStateRequest.md new file mode 100644 index 00000000000..be08d188fc5 --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/docs/CreateStateRequest.md @@ -0,0 +1,10 @@ +# CreateStateRequest + +## Enum Variants + +| Name | Value | +|---- | -----| + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/reqwest/composed-oneof/docs/CustomOneOfArraySchemaInner.md b/samples/client/others/rust/reqwest/composed-oneof/docs/CustomOneOfArraySchemaInner.md new file mode 100644 index 00000000000..336d8e3dbf0 --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/docs/CustomOneOfArraySchemaInner.md @@ -0,0 +1,10 @@ +# CustomOneOfArraySchemaInner + +## Enum Variants + +| Name | Value | +|---- | -----| + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/reqwest/composed-oneof/docs/CustomOneOfSchema.md b/samples/client/others/rust/reqwest/composed-oneof/docs/CustomOneOfSchema.md new file mode 100644 index 00000000000..fdfd1f03f7e --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/docs/CustomOneOfSchema.md @@ -0,0 +1,10 @@ +# CustomOneOfSchema + +## Enum Variants + +| Name | Value | +|---- | -----| + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/reqwest/composed-oneof/docs/DefaultApi.md b/samples/client/others/rust/reqwest/composed-oneof/docs/DefaultApi.md new file mode 100644 index 00000000000..328a4689d9f --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/docs/DefaultApi.md @@ -0,0 +1,63 @@ +# \DefaultApi + +All URIs are relative to *http://localhost:8000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_state**](DefaultApi.md#create_state) | **POST** /state | +[**get_state**](DefaultApi.md#get_state) | **GET** /state | + + + +## create_state + +> create_state(create_state_request) + + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**create_state_request** | [**CreateStateRequest**](CreateStateRequest.md) | | [required] | + +### Return type + + (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) + + +## get_state + +> crate::models::GetState200Response get_state() + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**crate::models::GetState200Response**](getState_200_response.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/client/others/rust/reqwest/composed-oneof/docs/GetState200Response.md b/samples/client/others/rust/reqwest/composed-oneof/docs/GetState200Response.md new file mode 100644 index 00000000000..81f2b6d09b7 --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/docs/GetState200Response.md @@ -0,0 +1,10 @@ +# GetState200Response + +## Enum Variants + +| Name | Value | +|---- | -----| + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/reqwest/composed-oneof/docs/ObjA.md b/samples/client/others/rust/reqwest/composed-oneof/docs/ObjA.md new file mode 100644 index 00000000000..40f6d31a64c --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/docs/ObjA.md @@ -0,0 +1,12 @@ +# ObjA + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**realtype** | Option<**String**> | | [optional] +**message** | Option<**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/client/others/rust/reqwest/composed-oneof/docs/ObjB.md b/samples/client/others/rust/reqwest/composed-oneof/docs/ObjB.md new file mode 100644 index 00000000000..e232623e9ec --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/docs/ObjB.md @@ -0,0 +1,13 @@ +# ObjB + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**realtype** | Option<**String**> | | [optional] +**description** | Option<**String**> | | [optional] +**code** | Option<**i32**> | | [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/client/others/rust/reqwest/composed-oneof/docs/ObjC.md b/samples/client/others/rust/reqwest/composed-oneof/docs/ObjC.md new file mode 100644 index 00000000000..52a0bf9f1be --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/docs/ObjC.md @@ -0,0 +1,12 @@ +# ObjC + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**realtype** | Option<**String**> | | [optional] +**state** | Option<**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/client/others/rust/reqwest/composed-oneof/docs/ObjD.md b/samples/client/others/rust/reqwest/composed-oneof/docs/ObjD.md new file mode 100644 index 00000000000..91d67f51311 --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/docs/ObjD.md @@ -0,0 +1,12 @@ +# ObjD + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**realtype** | Option<**String**> | | [optional] +**color** | Option<**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/client/others/rust/reqwest/composed-oneof/git_push.sh b/samples/client/others/rust/reqwest/composed-oneof/git_push.sh new file mode 100644 index 00000000000..f53a75d4fab --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/apis/configuration.rs b/samples/client/others/rust/reqwest/composed-oneof/src/apis/configuration.rs new file mode 100644 index 00000000000..0cd1c7b22cd --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/src/apis/configuration.rs @@ -0,0 +1,53 @@ +/* + * oneOf test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + + + +#[derive(Debug, Clone)] +pub struct Configuration { + pub base_path: String, + pub user_agent: Option, + pub client: reqwest::blocking::Client, + pub basic_auth: Option, + pub oauth_access_token: Option, + pub bearer_access_token: Option, + pub api_key: Option, + // TODO: take an oauth2 token source, similar to the go one +} + +pub type BasicAuth = (String, Option); + +#[derive(Debug, Clone)] +pub struct ApiKey { + pub prefix: Option, + pub key: String, +} + + +impl Configuration { + pub fn new() -> Configuration { + Configuration::default() + } +} + +impl Default for Configuration { + fn default() -> Self { + Configuration { + base_path: "http://localhost:8000".to_owned(), + user_agent: Some("OpenAPI-Generator/1.0.0/rust".to_owned()), + client: reqwest::blocking::Client::new(), + basic_auth: None, + oauth_access_token: None, + bearer_access_token: None, + api_key: None, + + } + } +} diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/apis/default_api.rs b/samples/client/others/rust/reqwest/composed-oneof/src/apis/default_api.rs new file mode 100644 index 00000000000..5f62777ee41 --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/src/apis/default_api.rs @@ -0,0 +1,87 @@ +/* + * oneOf test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +use crate::apis::ResponseContent; +use super::{Error, configuration}; + + +/// struct for typed errors of method [`create_state`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateStateError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_state`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetStateError { + UnknownValue(serde_json::Value), +} + + +pub fn create_state(configuration: &configuration::Configuration, create_state_request: crate::models::CreateStateRequest) -> Result<(), Error> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/state", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + local_var_req_builder = local_var_req_builder.json(&create_state_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + Ok(()) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +pub fn get_state(configuration: &configuration::Configuration, ) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/state", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/apis/mod.rs b/samples/client/others/rust/reqwest/composed-oneof/src/apis/mod.rs new file mode 100644 index 00000000000..4b09ba50b40 --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/src/apis/mod.rs @@ -0,0 +1,95 @@ +use std::error; +use std::fmt; + +#[derive(Debug, Clone)] +pub struct ResponseContent { + pub status: reqwest::StatusCode, + pub content: String, + pub entity: Option, +} + +#[derive(Debug)] +pub enum Error { + Reqwest(reqwest::Error), + Serde(serde_json::Error), + Io(std::io::Error), + ResponseError(ResponseContent), +} + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let (module, e) = match self { + Error::Reqwest(e) => ("reqwest", e.to_string()), + Error::Serde(e) => ("serde", e.to_string()), + Error::Io(e) => ("IO", e.to_string()), + Error::ResponseError(e) => ("response", format!("status code {}", e.status)), + }; + write!(f, "error in {}: {}", module, e) + } +} + +impl error::Error for Error { + fn source(&self) -> Option<&(dyn error::Error + 'static)> { + Some(match self { + Error::Reqwest(e) => e, + Error::Serde(e) => e, + Error::Io(e) => e, + Error::ResponseError(_) => return None, + }) + } +} + +impl From for Error { + fn from(e: reqwest::Error) -> Self { + Error::Reqwest(e) + } +} + +impl From for Error { + fn from(e: serde_json::Error) -> Self { + Error::Serde(e) + } +} + +impl From for Error { + fn from(e: std::io::Error) -> Self { + Error::Io(e) + } +} + +pub fn urlencode>(s: T) -> String { + ::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect() +} + +pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String, String)> { + if let serde_json::Value::Object(object) = value { + let mut params = vec![]; + + for (key, value) in object { + match value { + serde_json::Value::Object(_) => params.append(&mut parse_deep_object( + &format!("{}[{}]", prefix, key), + value, + )), + serde_json::Value::Array(array) => { + for (i, value) in array.iter().enumerate() { + params.append(&mut parse_deep_object( + &format!("{}[{}][{}]", prefix, key, i), + value, + )); + } + }, + serde_json::Value::String(s) => params.push((format!("{}[{}]", prefix, key), s.clone())), + _ => params.push((format!("{}[{}]", prefix, key), value.to_string())), + } + } + + return params; + } + + unimplemented!("Only objects are supported with style=deepObject") +} + +pub mod default_api; + +pub mod configuration; diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/lib.rs b/samples/client/others/rust/reqwest/composed-oneof/src/lib.rs new file mode 100644 index 00000000000..c1dd666f795 --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/src/lib.rs @@ -0,0 +1,10 @@ +#[macro_use] +extern crate serde_derive; + +extern crate serde; +extern crate serde_json; +extern crate url; +extern crate reqwest; + +pub mod apis; +pub mod models; diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/create_state_request.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/create_state_request.rs new file mode 100644 index 00000000000..5bd7a69cd8a --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/create_state_request.rs @@ -0,0 +1,30 @@ +/* + * oneOf test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use super::ObjA; +use super::ObjB; + + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(tag = "realtype")] +pub enum CreateStateRequest { + ObjA(Box), + ObjB(Box), +} + +impl Default for CreateStateRequest { + fn default() -> Self { + Self::ObjA(Box::default()) + } +} + + + + diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_array_schema_inner.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_array_schema_inner.rs new file mode 100644 index 00000000000..043f0b615ac --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_array_schema_inner.rs @@ -0,0 +1,32 @@ +/* + * oneOf test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use super::ObjA; +use super::ObjB; +use super::ObjC; + + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(tag = "realtype")] +pub enum CustomOneOfArraySchemaInner { + ObjA(Box), + ObjB(Box), + ObjC(Box), +} + +impl Default for CustomOneOfArraySchemaInner { + fn default() -> Self { + Self::ObjA(Box::default()) + } +} + + + + diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_schema.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_schema.rs new file mode 100644 index 00000000000..535f119b715 --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/custom_one_of_schema.rs @@ -0,0 +1,30 @@ +/* + * oneOf test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use super::ObjA; +use super::ObjB; + + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(tag = "realtype")] +pub enum CustomOneOfSchema { + ObjA(Box), + ObjB(Box), +} + +impl Default for CustomOneOfSchema { + fn default() -> Self { + Self::ObjA(Box::default()) + } +} + + + + diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/get_state_200_response.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/get_state_200_response.rs new file mode 100644 index 00000000000..d86f8d6ab65 --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/get_state_200_response.rs @@ -0,0 +1,32 @@ +/* + * oneOf test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use super::ObjA; +use super::ObjB; +use super::ObjD; + + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(tag = "realtype")] +pub enum GetState200Response { + ObjA(Box), + ObjB(Box), + ObjD(Box), +} + +impl Default for GetState200Response { + fn default() -> Self { + Self::ObjA(Box::default()) + } +} + + + + diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/mod.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/mod.rs new file mode 100644 index 00000000000..1eea461ec15 --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/mod.rs @@ -0,0 +1,16 @@ +pub mod create_state_request; +pub use self::create_state_request::CreateStateRequest; +pub mod custom_one_of_array_schema_inner; +pub use self::custom_one_of_array_schema_inner::CustomOneOfArraySchemaInner; +pub mod custom_one_of_schema; +pub use self::custom_one_of_schema::CustomOneOfSchema; +pub mod get_state_200_response; +pub use self::get_state_200_response::GetState200Response; +pub mod obj_a; +pub use self::obj_a::ObjA; +pub mod obj_b; +pub use self::obj_b::ObjB; +pub mod obj_c; +pub use self::obj_c::ObjC; +pub mod obj_d; +pub use self::obj_d::ObjD; diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_a.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_a.rs new file mode 100644 index 00000000000..dc265f94834 --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_a.rs @@ -0,0 +1,31 @@ +/* + * oneOf test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ObjA { + #[serde(rename = "realtype", skip_serializing_if = "Option::is_none")] + pub realtype: Option, + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] + pub message: Option, +} + +impl ObjA { + pub fn new() -> ObjA { + ObjA { + realtype: None, + message: None, + } + } +} + + diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_b.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_b.rs new file mode 100644 index 00000000000..0f664efd8bc --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_b.rs @@ -0,0 +1,34 @@ +/* + * oneOf test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ObjB { + #[serde(rename = "realtype", skip_serializing_if = "Option::is_none")] + pub realtype: Option, + #[serde(rename = "description", skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "code", skip_serializing_if = "Option::is_none")] + pub code: Option, +} + +impl ObjB { + pub fn new() -> ObjB { + ObjB { + realtype: None, + description: None, + code: None, + } + } +} + + diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_c.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_c.rs new file mode 100644 index 00000000000..5aa6635e959 --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_c.rs @@ -0,0 +1,31 @@ +/* + * oneOf test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ObjC { + #[serde(rename = "realtype", skip_serializing_if = "Option::is_none")] + pub realtype: Option, + #[serde(rename = "state", skip_serializing_if = "Option::is_none")] + pub state: Option, +} + +impl ObjC { + pub fn new() -> ObjC { + ObjC { + realtype: None, + state: None, + } + } +} + + diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_d.rs b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_d.rs new file mode 100644 index 00000000000..58101e561a8 --- /dev/null +++ b/samples/client/others/rust/reqwest/composed-oneof/src/models/obj_d.rs @@ -0,0 +1,31 @@ +/* + * oneOf test + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ObjD { + #[serde(rename = "realtype", skip_serializing_if = "Option::is_none")] + pub realtype: Option, + #[serde(rename = "color", skip_serializing_if = "Option::is_none")] + pub color: Option, +} + +impl ObjD { + pub fn new() -> ObjD { + ObjD { + realtype: None, + color: None, + } + } +} + + diff --git a/samples/client/others/rust/reqwest/oneOf/.gitignore b/samples/client/others/rust/reqwest/oneOf/.gitignore new file mode 100644 index 00000000000..6aa106405a4 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/.gitignore @@ -0,0 +1,3 @@ +/target/ +**/*.rs.bk +Cargo.lock diff --git a/samples/client/others/rust/reqwest/oneOf/.openapi-generator-ignore b/samples/client/others/rust/reqwest/oneOf/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/others/rust/reqwest/oneOf/.openapi-generator/FILES b/samples/client/others/rust/reqwest/oneOf/.openapi-generator/FILES new file mode 100644 index 00000000000..a24a8ab7271 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/.openapi-generator/FILES @@ -0,0 +1,49 @@ +.gitignore +.travis.yml +Cargo.toml +README.md +docs/Addressable.md +docs/Apple.md +docs/Banana.md +docs/Bar.md +docs/BarApi.md +docs/BarCreate.md +docs/BarRef.md +docs/BarRefOrValue.md +docs/Entity.md +docs/EntityRef.md +docs/Extensible.md +docs/Foo.md +docs/FooApi.md +docs/FooRef.md +docs/FooRefOrValue.md +docs/Fruit.md +docs/FruitType.md +docs/Pasta.md +docs/Pizza.md +docs/PizzaSpeziale.md +git_push.sh +src/apis/bar_api.rs +src/apis/configuration.rs +src/apis/foo_api.rs +src/apis/mod.rs +src/lib.rs +src/models/addressable.rs +src/models/apple.rs +src/models/banana.rs +src/models/bar.rs +src/models/bar_create.rs +src/models/bar_ref.rs +src/models/bar_ref_or_value.rs +src/models/entity.rs +src/models/entity_ref.rs +src/models/extensible.rs +src/models/foo.rs +src/models/foo_ref.rs +src/models/foo_ref_or_value.rs +src/models/fruit.rs +src/models/fruit_type.rs +src/models/mod.rs +src/models/pasta.rs +src/models/pizza.rs +src/models/pizza_speziale.rs diff --git a/samples/client/others/rust/reqwest/oneOf/.openapi-generator/VERSION b/samples/client/others/rust/reqwest/oneOf/.openapi-generator/VERSION new file mode 100644 index 00000000000..fff4bdd7ab5 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/others/rust/reqwest/oneOf/.travis.yml b/samples/client/others/rust/reqwest/oneOf/.travis.yml new file mode 100644 index 00000000000..22761ba7ee1 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/.travis.yml @@ -0,0 +1 @@ +language: rust diff --git a/samples/client/others/rust/reqwest/oneOf/Cargo.toml b/samples/client/others/rust/reqwest/oneOf/Cargo.toml new file mode 100644 index 00000000000..91e5d81c55b --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "oneof-reqwest" +version = "0.0.1" +authors = ["OpenAPI Generator team and contributors"] +description = "This tests for a oneOf interface representation " +# Override this license by providing a License Object in the OpenAPI. +license = "Unlicense" +edition = "2018" + +[dependencies] +serde = "^1.0" +serde_derive = "^1.0" +serde_json = "^1.0" +url = "^2.2" +uuid = { version = "^1.0", features = ["serde", "v4"] } +[dependencies.reqwest] +version = "^0.11" +features = ["json", "blocking", "multipart"] diff --git a/samples/client/others/rust/reqwest/oneOf/README.md b/samples/client/others/rust/reqwest/oneOf/README.md new file mode 100644 index 00000000000..8f1e91e6a44 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/README.md @@ -0,0 +1,65 @@ +# Rust API client for oneof-reqwest + +This tests for a oneOf interface representation + + + +## Overview + +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client. + +- API version: 0.0.1 +- Package version: 0.0.1 +- Build package: `org.openapitools.codegen.languages.RustClientCodegen` + +## Installation + +Put the package under your project folder in a directory named `oneof-reqwest` and add the following to `Cargo.toml` under `[dependencies]`: + +``` +oneof-reqwest = { path = "./oneof-reqwest" } +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost:8080* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*BarApi* | [**create_bar**](docs/BarApi.md#create_bar) | **POST** /bar | Create a Bar +*FooApi* | [**create_foo**](docs/FooApi.md#create_foo) | **POST** /foo | Create a Foo +*FooApi* | [**get_all_foos**](docs/FooApi.md#get_all_foos) | **GET** /foo | GET all Foos + + +## Documentation For Models + + - [Addressable](docs/Addressable.md) + - [Apple](docs/Apple.md) + - [Banana](docs/Banana.md) + - [Bar](docs/Bar.md) + - [BarCreate](docs/BarCreate.md) + - [BarRef](docs/BarRef.md) + - [BarRefOrValue](docs/BarRefOrValue.md) + - [Entity](docs/Entity.md) + - [EntityRef](docs/EntityRef.md) + - [Extensible](docs/Extensible.md) + - [Foo](docs/Foo.md) + - [FooRef](docs/FooRef.md) + - [FooRefOrValue](docs/FooRefOrValue.md) + - [Fruit](docs/Fruit.md) + - [FruitType](docs/FruitType.md) + - [Pasta](docs/Pasta.md) + - [Pizza](docs/Pizza.md) + - [PizzaSpeziale](docs/PizzaSpeziale.md) + + +To get access to the crate's generated documentation, use: + +``` +cargo doc --open +``` + +## Author + + + diff --git a/samples/client/others/rust/reqwest/oneOf/docs/Addressable.md b/samples/client/others/rust/reqwest/oneOf/docs/Addressable.md new file mode 100644 index 00000000000..e91ee38c884 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/docs/Addressable.md @@ -0,0 +1,12 @@ +# Addressable + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**href** | Option<**String**> | Hyperlink reference | [optional] +**id** | Option<**String**> | unique identifier | [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/client/others/rust/reqwest/oneOf/docs/Apple.md b/samples/client/others/rust/reqwest/oneOf/docs/Apple.md new file mode 100644 index 00000000000..47243cc7b00 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/docs/Apple.md @@ -0,0 +1,11 @@ +# Apple + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**seeds** | **i32** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/reqwest/oneOf/docs/Banana.md b/samples/client/others/rust/reqwest/oneOf/docs/Banana.md new file mode 100644 index 00000000000..c543451a072 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/docs/Banana.md @@ -0,0 +1,11 @@ +# Banana + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**length** | **i32** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/reqwest/oneOf/docs/Bar.md b/samples/client/others/rust/reqwest/oneOf/docs/Bar.md new file mode 100644 index 00000000000..e923f9d0dfb --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/docs/Bar.md @@ -0,0 +1,18 @@ +# Bar + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **String** | | +**bar_prop_a** | Option<**String**> | | [optional] +**foo_prop_b** | Option<**String**> | | [optional] +**foo** | Option<[**crate::models::FooRefOrValue**](FooRefOrValue.md)> | | [optional] +**href** | Option<**String**> | Hyperlink reference | [optional] +**at_schema_location** | Option<**String**> | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**at_base_type** | Option<**String**> | When sub-classing, this defines the super-class | [optional] +**at_type** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/others/rust/reqwest/oneOf/docs/BarApi.md b/samples/client/others/rust/reqwest/oneOf/docs/BarApi.md new file mode 100644 index 00000000000..f4a74a71edb --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/docs/BarApi.md @@ -0,0 +1,37 @@ +# \BarApi + +All URIs are relative to *http://localhost:8080* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_bar**](BarApi.md#create_bar) | **POST** /bar | Create a Bar + + + +## create_bar + +> crate::models::Bar create_bar(bar_create) +Create a Bar + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**bar_create** | [**BarCreate**](BarCreate.md) | | [required] | + +### Return type + +[**crate::models::Bar**](Bar.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/client/others/rust/reqwest/oneOf/docs/BarCreate.md b/samples/client/others/rust/reqwest/oneOf/docs/BarCreate.md new file mode 100644 index 00000000000..47eb6b9c3be --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/docs/BarCreate.md @@ -0,0 +1,18 @@ +# BarCreate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar_prop_a** | Option<**String**> | | [optional] +**foo_prop_b** | Option<**String**> | | [optional] +**foo** | Option<[**crate::models::FooRefOrValue**](FooRefOrValue.md)> | | [optional] +**href** | Option<**String**> | Hyperlink reference | [optional] +**id** | Option<**String**> | unique identifier | [optional] +**at_schema_location** | Option<**String**> | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**at_base_type** | Option<**String**> | When sub-classing, this defines the super-class | [optional] +**at_type** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/others/rust/reqwest/oneOf/docs/BarRef.md b/samples/client/others/rust/reqwest/oneOf/docs/BarRef.md new file mode 100644 index 00000000000..d06048b7bd4 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/docs/BarRef.md @@ -0,0 +1,17 @@ +# BarRef + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | Option<**String**> | Name of the related entity. | [optional] +**at_referred_type** | Option<**String**> | The actual type of the target instance when needed for disambiguation. | [optional] +**href** | Option<**String**> | Hyperlink reference | [optional] +**id** | Option<**String**> | unique identifier | [optional] +**at_schema_location** | Option<**String**> | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**at_base_type** | Option<**String**> | When sub-classing, this defines the super-class | [optional] +**at_type** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/others/rust/reqwest/oneOf/docs/BarRefOrValue.md b/samples/client/others/rust/reqwest/oneOf/docs/BarRefOrValue.md new file mode 100644 index 00000000000..22a0e619660 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/docs/BarRefOrValue.md @@ -0,0 +1,12 @@ +# BarRefOrValue + +## Enum Variants + +| Name | Description | +|---- | -----| +| Bar | | +| BarRef | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/reqwest/oneOf/docs/Entity.md b/samples/client/others/rust/reqwest/oneOf/docs/Entity.md new file mode 100644 index 00000000000..ef5b8318f76 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/docs/Entity.md @@ -0,0 +1,10 @@ +# Entity + +## Enum Variants + +| Name | Value | +|---- | -----| + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/reqwest/oneOf/docs/EntityRef.md b/samples/client/others/rust/reqwest/oneOf/docs/EntityRef.md new file mode 100644 index 00000000000..27695ed4b57 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/docs/EntityRef.md @@ -0,0 +1,10 @@ +# EntityRef + +## Enum Variants + +| Name | Value | +|---- | -----| + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/reqwest/oneOf/docs/Extensible.md b/samples/client/others/rust/reqwest/oneOf/docs/Extensible.md new file mode 100644 index 00000000000..1cbaaf3eaeb --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/docs/Extensible.md @@ -0,0 +1,13 @@ +# Extensible + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**at_schema_location** | Option<**String**> | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**at_base_type** | Option<**String**> | When sub-classing, this defines the super-class | [optional] +**at_type** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/others/rust/reqwest/oneOf/docs/Foo.md b/samples/client/others/rust/reqwest/oneOf/docs/Foo.md new file mode 100644 index 00000000000..e9c477f6402 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/docs/Foo.md @@ -0,0 +1,17 @@ +# Foo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**foo_prop_a** | Option<**String**> | | [optional] +**foo_prop_b** | Option<**String**> | | [optional] +**href** | Option<**String**> | Hyperlink reference | [optional] +**id** | Option<**String**> | unique identifier | [optional] +**at_schema_location** | Option<**String**> | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**at_base_type** | Option<**String**> | When sub-classing, this defines the super-class | [optional] +**at_type** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/others/rust/reqwest/oneOf/docs/FooApi.md b/samples/client/others/rust/reqwest/oneOf/docs/FooApi.md new file mode 100644 index 00000000000..8021946dd08 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/docs/FooApi.md @@ -0,0 +1,63 @@ +# \FooApi + +All URIs are relative to *http://localhost:8080* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_foo**](FooApi.md#create_foo) | **POST** /foo | Create a Foo +[**get_all_foos**](FooApi.md#get_all_foos) | **GET** /foo | GET all Foos + + + +## create_foo + +> crate::models::FooRefOrValue create_foo(foo) +Create a Foo + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**foo** | Option<[**Foo**](Foo.md)> | The Foo to be created | | + +### Return type + +[**crate::models::FooRefOrValue**](FooRefOrValue.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json;charset=utf-8 +- **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) + + +## get_all_foos + +> Vec get_all_foos() +GET all Foos + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**Vec**](FooRefOrValue.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json;charset=utf-8 + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/others/rust/reqwest/oneOf/docs/FooRef.md b/samples/client/others/rust/reqwest/oneOf/docs/FooRef.md new file mode 100644 index 00000000000..cdf8713add3 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/docs/FooRef.md @@ -0,0 +1,18 @@ +# FooRef + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fooref_prop_a** | Option<**String**> | | [optional] +**name** | Option<**String**> | Name of the related entity. | [optional] +**at_referred_type** | Option<**String**> | The actual type of the target instance when needed for disambiguation. | [optional] +**href** | Option<**String**> | Hyperlink reference | [optional] +**id** | Option<**String**> | unique identifier | [optional] +**at_schema_location** | Option<**String**> | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**at_base_type** | Option<**String**> | When sub-classing, this defines the super-class | [optional] +**at_type** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/others/rust/reqwest/oneOf/docs/FooRefOrValue.md b/samples/client/others/rust/reqwest/oneOf/docs/FooRefOrValue.md new file mode 100644 index 00000000000..72c8d36e37c --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/docs/FooRefOrValue.md @@ -0,0 +1,10 @@ +# FooRefOrValue + +## Enum Variants + +| Name | Value | +|---- | -----| + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/reqwest/oneOf/docs/Fruit.md b/samples/client/others/rust/reqwest/oneOf/docs/Fruit.md new file mode 100644 index 00000000000..2dc45b5e5ad --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/docs/Fruit.md @@ -0,0 +1,10 @@ +# Fruit + +## Enum Variants + +| Name | Value | +|---- | -----| + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/reqwest/oneOf/docs/FruitType.md b/samples/client/others/rust/reqwest/oneOf/docs/FruitType.md new file mode 100644 index 00000000000..3bb295e1f45 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/docs/FruitType.md @@ -0,0 +1,13 @@ +# FruitType + +## Enum Variants + +| Name | Value | +|---- | -----| +| Apple | APPLE | +| Banana | BANANA | + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/others/rust/reqwest/oneOf/docs/Pasta.md b/samples/client/others/rust/reqwest/oneOf/docs/Pasta.md new file mode 100644 index 00000000000..466f4771015 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/docs/Pasta.md @@ -0,0 +1,16 @@ +# Pasta + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**vendor** | Option<**String**> | | [optional] +**href** | Option<**String**> | Hyperlink reference | [optional] +**id** | Option<**String**> | unique identifier | [optional] +**at_schema_location** | Option<**String**> | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**at_base_type** | Option<**String**> | When sub-classing, this defines the super-class | [optional] +**at_type** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/others/rust/reqwest/oneOf/docs/Pizza.md b/samples/client/others/rust/reqwest/oneOf/docs/Pizza.md new file mode 100644 index 00000000000..4f01417f118 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/docs/Pizza.md @@ -0,0 +1,16 @@ +# Pizza + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**pizza_size** | Option<**f32**> | | [optional] +**href** | Option<**String**> | Hyperlink reference | [optional] +**id** | Option<**String**> | unique identifier | [optional] +**at_schema_location** | Option<**String**> | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**at_base_type** | Option<**String**> | When sub-classing, this defines the super-class | [optional] +**at_type** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/others/rust/reqwest/oneOf/docs/PizzaSpeziale.md b/samples/client/others/rust/reqwest/oneOf/docs/PizzaSpeziale.md new file mode 100644 index 00000000000..961ac04afe4 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/docs/PizzaSpeziale.md @@ -0,0 +1,17 @@ +# PizzaSpeziale + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**toppings** | Option<**String**> | | [optional] +**pizza_size** | Option<**f32**> | | [optional] +**href** | Option<**String**> | Hyperlink reference | [optional] +**id** | Option<**String**> | unique identifier | [optional] +**at_schema_location** | Option<**String**> | A URI to a JSON-Schema file that defines additional attributes and relationships | [optional] +**at_base_type** | Option<**String**> | When sub-classing, this defines the super-class | [optional] +**at_type** | **String** | When sub-classing, this defines the sub-class Extensible 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/client/others/rust/reqwest/oneOf/git_push.sh b/samples/client/others/rust/reqwest/oneOf/git_push.sh new file mode 100644 index 00000000000..f53a75d4fab --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/others/rust/reqwest/oneOf/pom.xml b/samples/client/others/rust/reqwest/oneOf/pom.xml new file mode 100644 index 00000000000..2f03dbbd5ca --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/pom.xml @@ -0,0 +1,46 @@ + + 4.0.0 + org.openapitools + RustReqwestOneOfClientTests + pom + 1.0-SNAPSHOT + Rust Reqwest oneOf Client + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + bundle-test + integration-test + + exec + + + cargo + + test + + + + + + + + diff --git a/samples/client/others/rust/reqwest/oneOf/src/apis/bar_api.rs b/samples/client/others/rust/reqwest/oneOf/src/apis/bar_api.rs new file mode 100644 index 00000000000..4b4fa628261 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/apis/bar_api.rs @@ -0,0 +1,53 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +use crate::apis::ResponseContent; +use super::{Error, configuration}; + + +/// struct for typed errors of method [`create_bar`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateBarError { + UnknownValue(serde_json::Value), +} + + +pub fn create_bar(configuration: &configuration::Configuration, bar_create: crate::models::BarCreate) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/bar", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + local_var_req_builder = local_var_req_builder.json(&bar_create); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + diff --git a/samples/client/others/rust/reqwest/oneOf/src/apis/configuration.rs b/samples/client/others/rust/reqwest/oneOf/src/apis/configuration.rs new file mode 100644 index 00000000000..cfdd5f470ea --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/apis/configuration.rs @@ -0,0 +1,53 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + +#[derive(Debug, Clone)] +pub struct Configuration { + pub base_path: String, + pub user_agent: Option, + pub client: reqwest::blocking::Client, + pub basic_auth: Option, + pub oauth_access_token: Option, + pub bearer_access_token: Option, + pub api_key: Option, + // TODO: take an oauth2 token source, similar to the go one +} + +pub type BasicAuth = (String, Option); + +#[derive(Debug, Clone)] +pub struct ApiKey { + pub prefix: Option, + pub key: String, +} + + +impl Configuration { + pub fn new() -> Configuration { + Configuration::default() + } +} + +impl Default for Configuration { + fn default() -> Self { + Configuration { + base_path: "http://localhost:8080".to_owned(), + user_agent: Some("OpenAPI-Generator/0.0.1/rust".to_owned()), + client: reqwest::blocking::Client::new(), + basic_auth: None, + oauth_access_token: None, + bearer_access_token: None, + api_key: None, + + } + } +} diff --git a/samples/client/others/rust/reqwest/oneOf/src/apis/foo_api.rs b/samples/client/others/rust/reqwest/oneOf/src/apis/foo_api.rs new file mode 100644 index 00000000000..3a3f20882dd --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/apis/foo_api.rs @@ -0,0 +1,87 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + +use reqwest; + +use crate::apis::ResponseContent; +use super::{Error, configuration}; + + +/// struct for typed errors of method [`create_foo`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateFooError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_all_foos`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetAllFoosError { + UnknownValue(serde_json::Value), +} + + +pub fn create_foo(configuration: &configuration::Configuration, foo: Option) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/foo", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + local_var_req_builder = local_var_req_builder.json(&foo); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + +pub fn get_all_foos(configuration: &configuration::Configuration, ) -> Result, Error> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/foo", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + serde_json::from_str(&local_var_content).map_err(Error::from) + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } +} + diff --git a/samples/client/others/rust/reqwest/oneOf/src/apis/mod.rs b/samples/client/others/rust/reqwest/oneOf/src/apis/mod.rs new file mode 100644 index 00000000000..96f98fdcb6e --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/apis/mod.rs @@ -0,0 +1,96 @@ +use std::error; +use std::fmt; + +#[derive(Debug, Clone)] +pub struct ResponseContent { + pub status: reqwest::StatusCode, + pub content: String, + pub entity: Option, +} + +#[derive(Debug)] +pub enum Error { + Reqwest(reqwest::Error), + Serde(serde_json::Error), + Io(std::io::Error), + ResponseError(ResponseContent), +} + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let (module, e) = match self { + Error::Reqwest(e) => ("reqwest", e.to_string()), + Error::Serde(e) => ("serde", e.to_string()), + Error::Io(e) => ("IO", e.to_string()), + Error::ResponseError(e) => ("response", format!("status code {}", e.status)), + }; + write!(f, "error in {}: {}", module, e) + } +} + +impl error::Error for Error { + fn source(&self) -> Option<&(dyn error::Error + 'static)> { + Some(match self { + Error::Reqwest(e) => e, + Error::Serde(e) => e, + Error::Io(e) => e, + Error::ResponseError(_) => return None, + }) + } +} + +impl From for Error { + fn from(e: reqwest::Error) -> Self { + Error::Reqwest(e) + } +} + +impl From for Error { + fn from(e: serde_json::Error) -> Self { + Error::Serde(e) + } +} + +impl From for Error { + fn from(e: std::io::Error) -> Self { + Error::Io(e) + } +} + +pub fn urlencode>(s: T) -> String { + ::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect() +} + +pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String, String)> { + if let serde_json::Value::Object(object) = value { + let mut params = vec![]; + + for (key, value) in object { + match value { + serde_json::Value::Object(_) => params.append(&mut parse_deep_object( + &format!("{}[{}]", prefix, key), + value, + )), + serde_json::Value::Array(array) => { + for (i, value) in array.iter().enumerate() { + params.append(&mut parse_deep_object( + &format!("{}[{}][{}]", prefix, key, i), + value, + )); + } + }, + serde_json::Value::String(s) => params.push((format!("{}[{}]", prefix, key), s.clone())), + _ => params.push((format!("{}[{}]", prefix, key), value.to_string())), + } + } + + return params; + } + + unimplemented!("Only objects are supported with style=deepObject") +} + +pub mod bar_api; +pub mod foo_api; + +pub mod configuration; diff --git a/samples/client/others/rust/reqwest/oneOf/src/lib.rs b/samples/client/others/rust/reqwest/oneOf/src/lib.rs new file mode 100644 index 00000000000..c1dd666f795 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/lib.rs @@ -0,0 +1,10 @@ +#[macro_use] +extern crate serde_derive; + +extern crate serde; +extern crate serde_json; +extern crate url; +extern crate reqwest; + +pub mod apis; +pub mod models; diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/addressable.rs b/samples/client/others/rust/reqwest/oneOf/src/models/addressable.rs new file mode 100644 index 00000000000..1110f9bd0aa --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/models/addressable.rs @@ -0,0 +1,35 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + +/// Addressable : Base schema for addressable entities + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Addressable { + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + pub href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, +} + +impl Addressable { + /// Base schema for addressable entities + pub fn new() -> Addressable { + Addressable { + href: None, + id: None, + } + } +} + + diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/apple.rs b/samples/client/others/rust/reqwest/oneOf/src/models/apple.rs new file mode 100644 index 00000000000..dd244a933f1 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/models/apple.rs @@ -0,0 +1,28 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Apple { + #[serde(rename = "seeds")] + pub seeds: i32, +} + +impl Apple { + pub fn new(seeds: i32) -> Apple { + Apple { + seeds, + } + } +} + + diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/banana.rs b/samples/client/others/rust/reqwest/oneOf/src/models/banana.rs new file mode 100644 index 00000000000..8330cc76c6c --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/models/banana.rs @@ -0,0 +1,28 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Banana { + #[serde(rename = "length")] + pub length: i32, +} + +impl Banana { + pub fn new(length: i32) -> Banana { + Banana { + length, + } + } +} + + diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/bar.rs b/samples/client/others/rust/reqwest/oneOf/src/models/bar.rs new file mode 100644 index 00000000000..0d25ee98777 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/models/bar.rs @@ -0,0 +1,53 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Bar { + #[serde(rename = "id")] + pub id: String, + #[serde(rename = "barPropA", skip_serializing_if = "Option::is_none")] + pub bar_prop_a: Option, + #[serde(rename = "fooPropB", skip_serializing_if = "Option::is_none")] + pub foo_prop_b: Option, + #[serde(rename = "foo", skip_serializing_if = "Option::is_none")] + pub foo: Option>, + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + pub href: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + pub at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + pub at_base_type: Option, + /// When sub-classing, this defines the sub-class Extensible name + #[serde(rename = "@type")] + pub at_type: String, +} + +impl Bar { + pub fn new(id: String, at_type: String) -> Bar { + Bar { + id, + bar_prop_a: None, + foo_prop_b: None, + foo: None, + href: None, + at_schema_location: None, + at_base_type: None, + at_type, + } + } +} + + diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/bar_create.rs b/samples/client/others/rust/reqwest/oneOf/src/models/bar_create.rs new file mode 100644 index 00000000000..950642d7dce --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/models/bar_create.rs @@ -0,0 +1,54 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct BarCreate { + #[serde(rename = "barPropA", skip_serializing_if = "Option::is_none")] + pub bar_prop_a: Option, + #[serde(rename = "fooPropB", skip_serializing_if = "Option::is_none")] + pub foo_prop_b: Option, + #[serde(rename = "foo", skip_serializing_if = "Option::is_none")] + pub foo: Option>, + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + pub href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + pub at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + pub at_base_type: Option, + /// When sub-classing, this defines the sub-class Extensible name + #[serde(rename = "@type")] + pub at_type: String, +} + +impl BarCreate { + pub fn new(at_type: String) -> BarCreate { + BarCreate { + bar_prop_a: None, + foo_prop_b: None, + foo: None, + href: None, + id: None, + at_schema_location: None, + at_base_type: None, + at_type, + } + } +} + + diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/bar_ref.rs b/samples/client/others/rust/reqwest/oneOf/src/models/bar_ref.rs new file mode 100644 index 00000000000..9c671a320c0 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/models/bar_ref.rs @@ -0,0 +1,53 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct BarRef { + /// Name of the related entity. + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + /// The actual type of the target instance when needed for disambiguation. + #[serde(rename = "@referredType", skip_serializing_if = "Option::is_none")] + pub at_referred_type: Option, + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + pub href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + pub at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + pub at_base_type: Option, + /// When sub-classing, this defines the sub-class Extensible name + #[serde(rename = "@type")] + pub at_type: String, +} + +impl BarRef { + pub fn new(at_type: String) -> BarRef { + BarRef { + name: None, + at_referred_type: None, + href: None, + id: None, + at_schema_location: None, + at_base_type: None, + at_type, + } + } +} + + diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/bar_ref_or_value.rs b/samples/client/others/rust/reqwest/oneOf/src/models/bar_ref_or_value.rs new file mode 100644 index 00000000000..f7a595f0cd3 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/models/bar_ref_or_value.rs @@ -0,0 +1,29 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + +use super::Bar; +use super::BarRef; + + + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum BarRefOrValue { + Bar(Box), + BarRef(Box), +} + +impl Default for BarRefOrValue { + fn default() -> Self { + Self::Bar(Box::default()) + } +} + + diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/entity.rs b/samples/client/others/rust/reqwest/oneOf/src/models/entity.rs new file mode 100644 index 00000000000..6636ab6bd9d --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/models/entity.rs @@ -0,0 +1,121 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(tag = "@type")] +pub enum Entity { + #[serde(rename="Bar")] + Bar { + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + at_base_type: Option, + }, + #[serde(rename="Bar_Create")] + BarCreate { + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + at_base_type: Option, + }, + #[serde(rename="Foo")] + Foo { + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + at_base_type: Option, + }, + #[serde(rename="Pasta")] + Pasta { + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + at_base_type: Option, + }, + #[serde(rename="Pizza")] + Pizza { + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + at_base_type: Option, + }, + #[serde(rename="PizzaSpeziale")] + PizzaSpeziale { + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + at_base_type: Option, + }, +} + +impl Default for Entity { + fn default() -> Self { + Self::Bar { + href: Default::default(), + id: Default::default(), + at_schema_location: Default::default(), + at_base_type: Default::default(), + } + } +} + + + + diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/entity_ref.rs b/samples/client/others/rust/reqwest/oneOf/src/models/entity_ref.rs new file mode 100644 index 00000000000..6a2f4b8da22 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/models/entity_ref.rs @@ -0,0 +1,76 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + +/// EntityRef : Entity reference schema to be use for all entityRef class. + + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(tag = "@type")] +pub enum EntityRef { + #[serde(rename="BarRef")] + BarRef { + /// Name of the related entity. + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + name: Option, + /// The actual type of the target instance when needed for disambiguation. + #[serde(rename = "@referredType", skip_serializing_if = "Option::is_none")] + at_referred_type: Option, + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + at_base_type: Option, + }, + #[serde(rename="FooRef")] + FooRef { + /// Name of the related entity. + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + name: Option, + /// The actual type of the target instance when needed for disambiguation. + #[serde(rename = "@referredType", skip_serializing_if = "Option::is_none")] + at_referred_type: Option, + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + at_base_type: Option, + }, +} + +impl Default for EntityRef { + fn default() -> Self { + Self::BarRef { + name: Default::default(), + at_referred_type: Default::default(), + href: Default::default(), + id: Default::default(), + at_schema_location: Default::default(), + at_base_type: Default::default(), + } + } +} + + + + diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/extensible.rs b/samples/client/others/rust/reqwest/oneOf/src/models/extensible.rs new file mode 100644 index 00000000000..65b77694965 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/models/extensible.rs @@ -0,0 +1,37 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Extensible { + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + pub at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + pub at_base_type: Option, + /// When sub-classing, this defines the sub-class Extensible name + #[serde(rename = "@type")] + pub at_type: String, +} + +impl Extensible { + pub fn new(at_type: String) -> Extensible { + Extensible { + at_schema_location: None, + at_base_type: None, + at_type, + } + } +} + + diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/foo.rs b/samples/client/others/rust/reqwest/oneOf/src/models/foo.rs new file mode 100644 index 00000000000..4b865bfa7dc --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/models/foo.rs @@ -0,0 +1,51 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Foo { + #[serde(rename = "fooPropA", skip_serializing_if = "Option::is_none")] + pub foo_prop_a: Option, + #[serde(rename = "fooPropB", skip_serializing_if = "Option::is_none")] + pub foo_prop_b: Option, + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + pub href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + pub at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + pub at_base_type: Option, + /// When sub-classing, this defines the sub-class Extensible name + #[serde(rename = "@type")] + pub at_type: String, +} + +impl Foo { + pub fn new(at_type: String) -> Foo { + Foo { + foo_prop_a: None, + foo_prop_b: None, + href: None, + id: None, + at_schema_location: None, + at_base_type: None, + at_type, + } + } +} + + diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/foo_ref.rs b/samples/client/others/rust/reqwest/oneOf/src/models/foo_ref.rs new file mode 100644 index 00000000000..fb28017bd08 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/models/foo_ref.rs @@ -0,0 +1,56 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct FooRef { + #[serde(rename = "foorefPropA", skip_serializing_if = "Option::is_none")] + pub fooref_prop_a: Option, + /// Name of the related entity. + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + /// The actual type of the target instance when needed for disambiguation. + #[serde(rename = "@referredType", skip_serializing_if = "Option::is_none")] + pub at_referred_type: Option, + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + pub href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + pub at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + pub at_base_type: Option, + /// When sub-classing, this defines the sub-class Extensible name + #[serde(rename = "@type")] + pub at_type: String, +} + +impl FooRef { + pub fn new(at_type: String) -> FooRef { + FooRef { + fooref_prop_a: None, + name: None, + at_referred_type: None, + href: None, + id: None, + at_schema_location: None, + at_base_type: None, + at_type, + } + } +} + + diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/foo_ref_or_value.rs b/samples/client/others/rust/reqwest/oneOf/src/models/foo_ref_or_value.rs new file mode 100644 index 00000000000..8e0b9e188e1 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/models/foo_ref_or_value.rs @@ -0,0 +1,30 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + +use super::Foo; +use super::FooRef; + + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(tag = "@type")] +pub enum FooRefOrValue { + Foo(Box), + FooRef(Box), +} + +impl Default for FooRefOrValue { + fn default() -> Self { + Self::Foo(Box::default()) + } +} + + + + diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/fruit.rs b/samples/client/others/rust/reqwest/oneOf/src/models/fruit.rs new file mode 100644 index 00000000000..4c01c95a8d7 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/models/fruit.rs @@ -0,0 +1,30 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + +use super::Apple; +use super::Banana; + + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(tag = "fruitType")] +pub enum Fruit { + Apple(Box), + Banana(Box), +} + +impl Default for Fruit { + fn default() -> Self { + Self::Apple(Box::default()) + } +} + + + + diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/fruit_type.rs b/samples/client/others/rust/reqwest/oneOf/src/models/fruit_type.rs new file mode 100644 index 00000000000..3927e1805e1 --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/models/fruit_type.rs @@ -0,0 +1,39 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum FruitType { + #[serde(rename = "APPLE")] + Apple, + #[serde(rename = "BANANA")] + Banana, + +} + +impl ToString for FruitType { + fn to_string(&self) -> String { + match self { + Self::Apple => String::from("APPLE"), + Self::Banana => String::from("BANANA"), + } + } +} + +impl Default for FruitType { + fn default() -> FruitType { + Self::Apple + } +} + + + + diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/mod.rs b/samples/client/others/rust/reqwest/oneOf/src/models/mod.rs new file mode 100644 index 00000000000..581d09587bc --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/models/mod.rs @@ -0,0 +1,36 @@ +pub mod addressable; +pub use self::addressable::Addressable; +pub mod apple; +pub use self::apple::Apple; +pub mod banana; +pub use self::banana::Banana; +pub mod bar; +pub use self::bar::Bar; +pub mod bar_create; +pub use self::bar_create::BarCreate; +pub mod bar_ref; +pub use self::bar_ref::BarRef; +pub mod bar_ref_or_value; +pub use self::bar_ref_or_value::BarRefOrValue; +pub mod entity; +pub use self::entity::Entity; +pub mod entity_ref; +pub use self::entity_ref::EntityRef; +pub mod extensible; +pub use self::extensible::Extensible; +pub mod foo; +pub use self::foo::Foo; +pub mod foo_ref; +pub use self::foo_ref::FooRef; +pub mod foo_ref_or_value; +pub use self::foo_ref_or_value::FooRefOrValue; +pub mod fruit; +pub use self::fruit::Fruit; +pub mod fruit_type; +pub use self::fruit_type::FruitType; +pub mod pasta; +pub use self::pasta::Pasta; +pub mod pizza; +pub use self::pizza::Pizza; +pub mod pizza_speziale; +pub use self::pizza_speziale::PizzaSpeziale; diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/pasta.rs b/samples/client/others/rust/reqwest/oneOf/src/models/pasta.rs new file mode 100644 index 00000000000..11f64426bbe --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/models/pasta.rs @@ -0,0 +1,48 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Pasta { + #[serde(rename = "vendor", skip_serializing_if = "Option::is_none")] + pub vendor: Option, + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + pub href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + pub at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + pub at_base_type: Option, + /// When sub-classing, this defines the sub-class Extensible name + #[serde(rename = "@type")] + pub at_type: String, +} + +impl Pasta { + pub fn new(at_type: String) -> Pasta { + Pasta { + vendor: None, + href: None, + id: None, + at_schema_location: None, + at_base_type: None, + at_type, + } + } +} + + diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/pizza.rs b/samples/client/others/rust/reqwest/oneOf/src/models/pizza.rs new file mode 100644 index 00000000000..571ef0a674e --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/models/pizza.rs @@ -0,0 +1,48 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Pizza { + #[serde(rename = "pizzaSize", skip_serializing_if = "Option::is_none")] + pub pizza_size: Option, + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + pub href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + pub at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + pub at_base_type: Option, + /// When sub-classing, this defines the sub-class Extensible name + #[serde(rename = "@type")] + pub at_type: String, +} + +impl Pizza { + pub fn new(at_type: String) -> Pizza { + Pizza { + pizza_size: None, + href: None, + id: None, + at_schema_location: None, + at_base_type: None, + at_type, + } + } +} + + diff --git a/samples/client/others/rust/reqwest/oneOf/src/models/pizza_speziale.rs b/samples/client/others/rust/reqwest/oneOf/src/models/pizza_speziale.rs new file mode 100644 index 00000000000..a7ee348297c --- /dev/null +++ b/samples/client/others/rust/reqwest/oneOf/src/models/pizza_speziale.rs @@ -0,0 +1,51 @@ +/* + * ByRefOrValue + * + * This tests for a oneOf interface representation + * + * The version of the OpenAPI document: 0.0.1 + * + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PizzaSpeziale { + #[serde(rename = "toppings", skip_serializing_if = "Option::is_none")] + pub toppings: Option, + #[serde(rename = "pizzaSize", skip_serializing_if = "Option::is_none")] + pub pizza_size: Option, + /// Hyperlink reference + #[serde(rename = "href", skip_serializing_if = "Option::is_none")] + pub href: Option, + /// unique identifier + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// A URI to a JSON-Schema file that defines additional attributes and relationships + #[serde(rename = "@schemaLocation", skip_serializing_if = "Option::is_none")] + pub at_schema_location: Option, + /// When sub-classing, this defines the super-class + #[serde(rename = "@baseType", skip_serializing_if = "Option::is_none")] + pub at_base_type: Option, + /// When sub-classing, this defines the sub-class Extensible name + #[serde(rename = "@type")] + pub at_type: String, +} + +impl PizzaSpeziale { + pub fn new(at_type: String) -> PizzaSpeziale { + PizzaSpeziale { + toppings: None, + pizza_size: None, + href: None, + id: None, + at_schema_location: None, + at_base_type: None, + at_type, + } + } +} + + diff --git a/samples/client/petstore/rust/hyper/petstore/docs/Baz.md b/samples/client/petstore/rust/hyper/petstore/docs/Baz.md index 68c84b1b1b0..e9c4c693d89 100644 --- a/samples/client/petstore/rust/hyper/petstore/docs/Baz.md +++ b/samples/client/petstore/rust/hyper/petstore/docs/Baz.md @@ -1,9 +1,13 @@ # Baz -## Properties +## Enum Variants + +| Name | Value | +|---- | -----| +| A | A | +| B | B | +| Empty | | -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/hyper/petstore/src/apis/request.rs b/samples/client/petstore/rust/hyper/petstore/src/apis/request.rs index 81497706a11..db4d55e47b1 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/apis/request.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/apis/request.rs @@ -128,7 +128,7 @@ impl Request { let mut uri_str = format!("{}{}", conf.base_path, path); let query_string_str = query_string.finish(); - if query_string_str != "" { + if !query_string_str.is_empty() { uri_str += "?"; uri_str += &query_string_str; } diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/action_container.rs b/samples/client/petstore/rust/hyper/petstore/src/models/action_container.rs index 6a4b7a93f85..7e2d9a0717f 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/action_container.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/action_container.rs @@ -11,7 +11,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ActionContainer { #[serde(rename = "action")] pub action: Box, diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/api_response.rs b/samples/client/petstore/rust/hyper/petstore/src/models/api_response.rs index 9e2069f0474..1741c9ff9cd 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/api_response.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/api_response.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ApiResponse { #[serde(rename = "code", skip_serializing_if = "Option::is_none")] pub code: Option, diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/array_item_ref_test.rs b/samples/client/petstore/rust/hyper/petstore/src/models/array_item_ref_test.rs index 69cef48f9bb..09e7611f0ef 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/array_item_ref_test.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/array_item_ref_test.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ArrayItemRefTest { #[serde(rename = "list_with_array_ref")] pub list_with_array_ref: Vec>, diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/category.rs b/samples/client/petstore/rust/hyper/petstore/src/models/category.rs index ed937ac261d..e62af6878b9 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/category.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/category.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Category { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/enum_array_testing.rs b/samples/client/petstore/rust/hyper/petstore/src/models/enum_array_testing.rs index 36494b390f4..4ad77233833 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/enum_array_testing.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/enum_array_testing.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct EnumArrayTesting { #[serde(rename = "required_enums")] pub required_enums: Vec, diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/model_return.rs b/samples/client/petstore/rust/hyper/petstore/src/models/model_return.rs index 2ff5f6066bc..d9619444f70 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/model_return.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/model_return.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Return { #[serde(rename = "match", skip_serializing_if = "Option::is_none")] pub r#match: Option, diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/nullable_array.rs b/samples/client/petstore/rust/hyper/petstore/src/models/nullable_array.rs index 7fce0b08570..f177f16192c 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/nullable_array.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/nullable_array.rs @@ -11,7 +11,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct NullableArray { #[serde(rename = "array_nullable", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub array_nullable: Option>>, diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/optional_testing.rs b/samples/client/petstore/rust/hyper/petstore/src/models/optional_testing.rs index ba41438cfcc..e8f7af5c012 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/optional_testing.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/optional_testing.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct OptionalTesting { #[serde(rename = "optional_nonnull", skip_serializing_if = "Option::is_none")] pub optional_nonnull: Option, diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/order.rs b/samples/client/petstore/rust/hyper/petstore/src/models/order.rs index 3c7d0059100..e3385c8ff03 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/order.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/order.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Order { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/pet.rs b/samples/client/petstore/rust/hyper/petstore/src/models/pet.rs index 1884034a45e..6661e036994 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/pet.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/pet.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Pet { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/property_test.rs b/samples/client/petstore/rust/hyper/petstore/src/models/property_test.rs index d9b3982b493..e496a02311c 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/property_test.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/property_test.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct PropertyTest { #[serde(rename = "uuid", skip_serializing_if = "Option::is_none")] pub uuid: Option, diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/tag.rs b/samples/client/petstore/rust/hyper/petstore/src/models/tag.rs index e0ae6e9efcc..1786ebec3ac 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/tag.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/tag.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Tag { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/type_testing.rs b/samples/client/petstore/rust/hyper/petstore/src/models/type_testing.rs index daa92f87a1c..079ac75daff 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/type_testing.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/type_testing.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct TypeTesting { #[serde(rename = "int32")] pub int32: i32, diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/unique_item_array_testing.rs b/samples/client/petstore/rust/hyper/petstore/src/models/unique_item_array_testing.rs index a82e3e5773b..854ca0916ae 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/unique_item_array_testing.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/unique_item_array_testing.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UniqueItemArrayTesting { /// Helper object for the unique item array test #[serde(rename = "unique_item_array")] diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/user.rs b/samples/client/petstore/rust/hyper/petstore/src/models/user.rs index 098482bd457..c52c16ba316 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/user.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/user.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct User { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/reqwest/name-mapping/src/apis/fake_api.rs b/samples/client/petstore/rust/reqwest/name-mapping/src/apis/fake_api.rs index ccb58f77afc..7798ebce49d 100644 --- a/samples/client/petstore/rust/reqwest/name-mapping/src/apis/fake_api.rs +++ b/samples/client/petstore/rust/reqwest/name-mapping/src/apis/fake_api.rs @@ -41,7 +41,7 @@ pub fn get_parameter_name_mapping(configuration: &configuration::Configuration, local_var_req_builder = local_var_req_builder.header("-type", dash_type.to_string()); let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; diff --git a/samples/client/petstore/rust/reqwest/name-mapping/src/models/property_name_mapping.rs b/samples/client/petstore/rust/reqwest/name-mapping/src/models/property_name_mapping.rs index 6466e39c00a..713d6680fe9 100644 --- a/samples/client/petstore/rust/reqwest/name-mapping/src/models/property_name_mapping.rs +++ b/samples/client/petstore/rust/reqwest/name-mapping/src/models/property_name_mapping.rs @@ -11,7 +11,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct PropertyNameMapping { #[serde(rename = "http_debug_operation", skip_serializing_if = "Option::is_none")] pub http_debug_operation: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/Baz.md b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/Baz.md index 68c84b1b1b0..e9c4c693d89 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/Baz.md +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/Baz.md @@ -1,9 +1,13 @@ # Baz -## Properties +## Enum Variants + +| Name | Value | +|---- | -----| +| A | A | +| B | B | +| Empty | | -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/action_container.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/action_container.rs index 6a4b7a93f85..7e2d9a0717f 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/action_container.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/action_container.rs @@ -11,7 +11,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ActionContainer { #[serde(rename = "action")] pub action: Box, diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/api_response.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/api_response.rs index 9e2069f0474..1741c9ff9cd 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/api_response.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/api_response.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ApiResponse { #[serde(rename = "code", skip_serializing_if = "Option::is_none")] pub code: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/array_item_ref_test.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/array_item_ref_test.rs index 69cef48f9bb..09e7611f0ef 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/array_item_ref_test.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/array_item_ref_test.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ArrayItemRefTest { #[serde(rename = "list_with_array_ref")] pub list_with_array_ref: Vec>, diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/category.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/category.rs index ed937ac261d..e62af6878b9 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/category.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/category.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Category { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/enum_array_testing.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/enum_array_testing.rs index 36494b390f4..4ad77233833 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/enum_array_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/enum_array_testing.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct EnumArrayTesting { #[serde(rename = "required_enums")] pub required_enums: Vec, diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/model_return.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/model_return.rs index 2ff5f6066bc..d9619444f70 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/model_return.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/model_return.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Return { #[serde(rename = "match", skip_serializing_if = "Option::is_none")] pub r#match: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/nullable_array.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/nullable_array.rs index 7fce0b08570..f177f16192c 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/nullable_array.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/nullable_array.rs @@ -11,7 +11,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct NullableArray { #[serde(rename = "array_nullable", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub array_nullable: Option>>, diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/optional_testing.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/optional_testing.rs index ba41438cfcc..e8f7af5c012 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/optional_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/optional_testing.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct OptionalTesting { #[serde(rename = "optional_nonnull", skip_serializing_if = "Option::is_none")] pub optional_nonnull: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/order.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/order.rs index 3c7d0059100..e3385c8ff03 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/order.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/order.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Order { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/pet.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/pet.rs index 1884034a45e..6661e036994 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/pet.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/pet.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Pet { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/property_test.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/property_test.rs index d9b3982b493..e496a02311c 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/property_test.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/property_test.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct PropertyTest { #[serde(rename = "uuid", skip_serializing_if = "Option::is_none")] pub uuid: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/tag.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/tag.rs index e0ae6e9efcc..1786ebec3ac 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/tag.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/tag.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Tag { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/type_testing.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/type_testing.rs index daa92f87a1c..079ac75daff 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/type_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/type_testing.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct TypeTesting { #[serde(rename = "int32")] pub int32: i32, diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/unique_item_array_testing.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/unique_item_array_testing.rs index a82e3e5773b..854ca0916ae 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/unique_item_array_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/unique_item_array_testing.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UniqueItemArrayTesting { /// Helper object for the unique item array test #[serde(rename = "unique_item_array")] diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/user.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/user.rs index 098482bd457..c52c16ba316 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/user.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/user.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct User { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-async/docs/Baz.md b/samples/client/petstore/rust/reqwest/petstore-async/docs/Baz.md index 68c84b1b1b0..e9c4c693d89 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/docs/Baz.md +++ b/samples/client/petstore/rust/reqwest/petstore-async/docs/Baz.md @@ -1,9 +1,13 @@ # Baz -## Properties +## Enum Variants + +| Name | Value | +|---- | -----| +| A | A | +| B | B | +| Empty | | -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/action_container.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/action_container.rs index 6a4b7a93f85..7e2d9a0717f 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/action_container.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/action_container.rs @@ -11,7 +11,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ActionContainer { #[serde(rename = "action")] pub action: Box, diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/api_response.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/api_response.rs index 9e2069f0474..1741c9ff9cd 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/api_response.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/api_response.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ApiResponse { #[serde(rename = "code", skip_serializing_if = "Option::is_none")] pub code: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/array_item_ref_test.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/array_item_ref_test.rs index 69cef48f9bb..09e7611f0ef 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/array_item_ref_test.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/array_item_ref_test.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ArrayItemRefTest { #[serde(rename = "list_with_array_ref")] pub list_with_array_ref: Vec>, diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/category.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/category.rs index ed937ac261d..e62af6878b9 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/category.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/category.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Category { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/enum_array_testing.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/enum_array_testing.rs index 36494b390f4..4ad77233833 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/enum_array_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/enum_array_testing.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct EnumArrayTesting { #[serde(rename = "required_enums")] pub required_enums: Vec, diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/model_return.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/model_return.rs index 2ff5f6066bc..d9619444f70 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/model_return.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/model_return.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Return { #[serde(rename = "match", skip_serializing_if = "Option::is_none")] pub r#match: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/nullable_array.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/nullable_array.rs index 7fce0b08570..f177f16192c 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/nullable_array.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/nullable_array.rs @@ -11,7 +11,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct NullableArray { #[serde(rename = "array_nullable", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub array_nullable: Option>>, diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/optional_testing.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/optional_testing.rs index ba41438cfcc..e8f7af5c012 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/optional_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/optional_testing.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct OptionalTesting { #[serde(rename = "optional_nonnull", skip_serializing_if = "Option::is_none")] pub optional_nonnull: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/order.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/order.rs index 3c7d0059100..e3385c8ff03 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/order.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/order.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Order { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/pet.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/pet.rs index 1884034a45e..6661e036994 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/pet.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/pet.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Pet { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/property_test.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/property_test.rs index d9b3982b493..e496a02311c 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/property_test.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/property_test.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct PropertyTest { #[serde(rename = "uuid", skip_serializing_if = "Option::is_none")] pub uuid: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/tag.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/tag.rs index e0ae6e9efcc..1786ebec3ac 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/tag.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/tag.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Tag { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/type_testing.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/type_testing.rs index daa92f87a1c..079ac75daff 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/type_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/type_testing.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct TypeTesting { #[serde(rename = "int32")] pub int32: i32, diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/unique_item_array_testing.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/unique_item_array_testing.rs index a82e3e5773b..854ca0916ae 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/unique_item_array_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/unique_item_array_testing.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UniqueItemArrayTesting { /// Helper object for the unique item array test #[serde(rename = "unique_item_array")] diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/user.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/user.rs index 098482bd457..c52c16ba316 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/user.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/user.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct User { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/Baz.md b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/Baz.md index 68c84b1b1b0..e9c4c693d89 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/Baz.md +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/Baz.md @@ -1,9 +1,13 @@ # Baz -## Properties +## Enum Variants + +| Name | Value | +|---- | -----| +| A | A | +| B | B | +| Empty | | -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/fake_api.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/fake_api.rs index 13d9b7f851a..d070648614a 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/fake_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/fake_api.rs @@ -46,7 +46,7 @@ pub fn test_nullable_required_param(configuration: &configuration::Configuration } let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/pet_api.rs index 81edae5f241..d7971339d2c 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/pet_api.rs @@ -113,7 +113,7 @@ pub fn add_pet(configuration: &configuration::Configuration, pet: crate::models: local_var_req_builder = local_var_req_builder.json(&pet); let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -160,7 +160,7 @@ pub fn delete_pet(configuration: &configuration::Configuration, pet_id: i64, api }; let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -208,7 +208,7 @@ pub fn find_pets_by_status(configuration: &configuration::Configuration, status: }; let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -256,7 +256,7 @@ pub fn find_pets_by_tags(configuration: &configuration::Configuration, tags: Vec }; let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -305,7 +305,7 @@ pub fn get_pet_by_id(configuration: &configuration::Configuration, pet_id: i64) }; let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -350,7 +350,7 @@ pub fn update_pet(configuration: &configuration::Configuration, pet: crate::mode local_var_req_builder = local_var_req_builder.json(&pet); let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -402,7 +402,7 @@ pub fn update_pet_with_form(configuration: &configuration::Configuration, pet_id local_var_req_builder = local_var_req_builder.form(&local_var_form_params); let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -454,7 +454,7 @@ pub fn upload_file(configuration: &configuration::Configuration, pet_id: i64, ad local_var_req_builder = local_var_req_builder.multipart(local_var_form); let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/store_api.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/store_api.rs index 0c71e2c08a5..9c777efebfa 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/store_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/store_api.rs @@ -63,7 +63,7 @@ pub fn delete_order(configuration: &configuration::Configuration, order_id: &str } let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -112,7 +112,7 @@ pub fn get_inventory(configuration: &configuration::Configuration, ) -> Result<: }; let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -140,7 +140,7 @@ pub fn get_order_by_id(configuration: &configuration::Configuration, order_id: i } let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -169,7 +169,7 @@ pub fn place_order(configuration: &configuration::Configuration, order: crate::m local_var_req_builder = local_var_req_builder.json(&order); let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/testing_api.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/testing_api.rs index fb84a57345e..1f5d382b3b1 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/testing_api.rs @@ -43,7 +43,7 @@ pub fn tests_file_response_get(configuration: &configuration::Configuration, ) - } let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -70,7 +70,7 @@ pub fn tests_type_testing_get(configuration: &configuration::Configuration, ) -> } let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/user_api.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/user_api.rs index aaa8b8afbc8..953aa2713f2 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/user_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/user_api.rs @@ -119,7 +119,7 @@ pub fn create_user(configuration: &configuration::Configuration, user: crate::mo local_var_req_builder = local_var_req_builder.json(&user); let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -169,7 +169,7 @@ pub fn create_users_with_array_input(configuration: &configuration::Configuratio local_var_req_builder = local_var_req_builder.json(&user); let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -219,7 +219,7 @@ pub fn create_users_with_list_input(configuration: &configuration::Configuration local_var_req_builder = local_var_req_builder.json(&user); let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -268,7 +268,7 @@ pub fn delete_user(configuration: &configuration::Configuration, username: &str) }; let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -296,7 +296,7 @@ pub fn get_user_by_name(configuration: &configuration::Configuration, username: } let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -326,7 +326,7 @@ pub fn login_user(configuration: &configuration::Configuration, username: &str, } let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -375,7 +375,7 @@ pub fn logout_user(configuration: &configuration::Configuration, ) -> Result<(), }; let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -425,7 +425,7 @@ pub fn update_user(configuration: &configuration::Configuration, username: &str, local_var_req_builder = local_var_req_builder.json(&user); let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/action_container.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/action_container.rs index 6a4b7a93f85..7e2d9a0717f 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/action_container.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/action_container.rs @@ -11,7 +11,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ActionContainer { #[serde(rename = "action")] pub action: Box, diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/api_response.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/api_response.rs index 9e2069f0474..1741c9ff9cd 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/api_response.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/api_response.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ApiResponse { #[serde(rename = "code", skip_serializing_if = "Option::is_none")] pub code: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/array_item_ref_test.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/array_item_ref_test.rs index 69cef48f9bb..09e7611f0ef 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/array_item_ref_test.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/array_item_ref_test.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ArrayItemRefTest { #[serde(rename = "list_with_array_ref")] pub list_with_array_ref: Vec>, diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/category.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/category.rs index ed937ac261d..e62af6878b9 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/category.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/category.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Category { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/enum_array_testing.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/enum_array_testing.rs index 36494b390f4..4ad77233833 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/enum_array_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/enum_array_testing.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct EnumArrayTesting { #[serde(rename = "required_enums")] pub required_enums: Vec, diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/model_return.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/model_return.rs index 2ff5f6066bc..d9619444f70 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/model_return.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/model_return.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Return { #[serde(rename = "match", skip_serializing_if = "Option::is_none")] pub r#match: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/nullable_array.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/nullable_array.rs index 7fce0b08570..f177f16192c 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/nullable_array.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/nullable_array.rs @@ -11,7 +11,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct NullableArray { #[serde(rename = "array_nullable", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub array_nullable: Option>>, diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/optional_testing.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/optional_testing.rs index ba41438cfcc..e8f7af5c012 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/optional_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/optional_testing.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct OptionalTesting { #[serde(rename = "optional_nonnull", skip_serializing_if = "Option::is_none")] pub optional_nonnull: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/order.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/order.rs index 3c7d0059100..e3385c8ff03 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/order.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/order.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Order { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/pet.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/pet.rs index 1884034a45e..6661e036994 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/pet.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/pet.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Pet { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/property_test.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/property_test.rs index d9b3982b493..e496a02311c 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/property_test.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/property_test.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct PropertyTest { #[serde(rename = "uuid", skip_serializing_if = "Option::is_none")] pub uuid: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/tag.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/tag.rs index e0ae6e9efcc..1786ebec3ac 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/tag.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/tag.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Tag { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/type_testing.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/type_testing.rs index daa92f87a1c..079ac75daff 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/type_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/type_testing.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct TypeTesting { #[serde(rename = "int32")] pub int32: i32, diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/unique_item_array_testing.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/unique_item_array_testing.rs index a82e3e5773b..854ca0916ae 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/unique_item_array_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/unique_item_array_testing.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UniqueItemArrayTesting { /// Helper object for the unique item array test #[serde(rename = "unique_item_array")] diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/user.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/user.rs index 098482bd457..c52c16ba316 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/user.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/user.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct User { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore/docs/Baz.md b/samples/client/petstore/rust/reqwest/petstore/docs/Baz.md index 68c84b1b1b0..e9c4c693d89 100644 --- a/samples/client/petstore/rust/reqwest/petstore/docs/Baz.md +++ b/samples/client/petstore/rust/reqwest/petstore/docs/Baz.md @@ -1,9 +1,13 @@ # Baz -## Properties +## Enum Variants + +| Name | Value | +|---- | -----| +| A | A | +| B | B | +| Empty | | -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/reqwest/petstore/src/apis/fake_api.rs b/samples/client/petstore/rust/reqwest/petstore/src/apis/fake_api.rs index 13d9b7f851a..d070648614a 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/apis/fake_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/apis/fake_api.rs @@ -46,7 +46,7 @@ pub fn test_nullable_required_param(configuration: &configuration::Configuration } let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; diff --git a/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs index 4fb8e4c8af6..5b70576ff0b 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs @@ -100,7 +100,7 @@ pub fn add_pet(configuration: &configuration::Configuration, pet: crate::models: local_var_req_builder = local_var_req_builder.json(&pet); let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -134,7 +134,7 @@ pub fn delete_pet(configuration: &configuration::Configuration, pet_id: i64, api }; let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -169,7 +169,7 @@ pub fn find_pets_by_status(configuration: &configuration::Configuration, status: }; let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -204,7 +204,7 @@ pub fn find_pets_by_tags(configuration: &configuration::Configuration, tags: Vec }; let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -240,7 +240,7 @@ pub fn get_pet_by_id(configuration: &configuration::Configuration, pet_id: i64) }; let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -272,7 +272,7 @@ pub fn update_pet(configuration: &configuration::Configuration, pet: crate::mode local_var_req_builder = local_var_req_builder.json(&pet); let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -311,7 +311,7 @@ pub fn update_pet_with_form(configuration: &configuration::Configuration, pet_id local_var_req_builder = local_var_req_builder.form(&local_var_form_params); let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -350,7 +350,7 @@ pub fn upload_file(configuration: &configuration::Configuration, pet_id: i64, ad local_var_req_builder = local_var_req_builder.multipart(local_var_form); let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; diff --git a/samples/client/petstore/rust/reqwest/petstore/src/apis/store_api.rs b/samples/client/petstore/rust/reqwest/petstore/src/apis/store_api.rs index 1a621384ddf..000983a6f0e 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/apis/store_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/apis/store_api.rs @@ -63,7 +63,7 @@ pub fn delete_order(configuration: &configuration::Configuration, order_id: &str } let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -99,7 +99,7 @@ pub fn get_inventory(configuration: &configuration::Configuration, ) -> Result<: }; let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -127,7 +127,7 @@ pub fn get_order_by_id(configuration: &configuration::Configuration, order_id: i } let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -156,7 +156,7 @@ pub fn place_order(configuration: &configuration::Configuration, order: crate::m local_var_req_builder = local_var_req_builder.json(&order); let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; diff --git a/samples/client/petstore/rust/reqwest/petstore/src/apis/testing_api.rs b/samples/client/petstore/rust/reqwest/petstore/src/apis/testing_api.rs index fb84a57345e..1f5d382b3b1 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/apis/testing_api.rs @@ -43,7 +43,7 @@ pub fn tests_file_response_get(configuration: &configuration::Configuration, ) - } let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -70,7 +70,7 @@ pub fn tests_type_testing_get(configuration: &configuration::Configuration, ) -> } let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; diff --git a/samples/client/petstore/rust/reqwest/petstore/src/apis/user_api.rs b/samples/client/petstore/rust/reqwest/petstore/src/apis/user_api.rs index e77fef6941f..4f8b6cdeb31 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/apis/user_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/apis/user_api.rs @@ -106,7 +106,7 @@ pub fn create_user(configuration: &configuration::Configuration, user: crate::mo local_var_req_builder = local_var_req_builder.json(&user); let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -143,7 +143,7 @@ pub fn create_users_with_array_input(configuration: &configuration::Configuratio local_var_req_builder = local_var_req_builder.json(&user); let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -180,7 +180,7 @@ pub fn create_users_with_list_input(configuration: &configuration::Configuration local_var_req_builder = local_var_req_builder.json(&user); let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -216,7 +216,7 @@ pub fn delete_user(configuration: &configuration::Configuration, username: &str) }; let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -244,7 +244,7 @@ pub fn get_user_by_name(configuration: &configuration::Configuration, username: } let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -274,7 +274,7 @@ pub fn login_user(configuration: &configuration::Configuration, username: &str, } let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -310,7 +310,7 @@ pub fn logout_user(configuration: &configuration::Configuration, ) -> Result<(), }; let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; @@ -347,7 +347,7 @@ pub fn update_user(configuration: &configuration::Configuration, username: &str, local_var_req_builder = local_var_req_builder.json(&user); let local_var_req = local_var_req_builder.build()?; - let mut local_var_resp = local_var_client.execute(local_var_req)?; + let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); let local_var_content = local_var_resp.text()?; diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/action_container.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/action_container.rs index 6a4b7a93f85..7e2d9a0717f 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/action_container.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/action_container.rs @@ -11,7 +11,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ActionContainer { #[serde(rename = "action")] pub action: Box, diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/api_response.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/api_response.rs index 9e2069f0474..1741c9ff9cd 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/api_response.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/api_response.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ApiResponse { #[serde(rename = "code", skip_serializing_if = "Option::is_none")] pub code: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/array_item_ref_test.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/array_item_ref_test.rs index 69cef48f9bb..09e7611f0ef 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/array_item_ref_test.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/array_item_ref_test.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ArrayItemRefTest { #[serde(rename = "list_with_array_ref")] pub list_with_array_ref: Vec>, diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/category.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/category.rs index ed937ac261d..e62af6878b9 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/category.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/category.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Category { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/enum_array_testing.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/enum_array_testing.rs index 36494b390f4..4ad77233833 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/enum_array_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/enum_array_testing.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct EnumArrayTesting { #[serde(rename = "required_enums")] pub required_enums: Vec, diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/model_return.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/model_return.rs index 2ff5f6066bc..d9619444f70 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/model_return.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/model_return.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Return { #[serde(rename = "match", skip_serializing_if = "Option::is_none")] pub r#match: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/nullable_array.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/nullable_array.rs index 7fce0b08570..f177f16192c 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/nullable_array.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/nullable_array.rs @@ -11,7 +11,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct NullableArray { #[serde(rename = "array_nullable", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub array_nullable: Option>>, diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/optional_testing.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/optional_testing.rs index ba41438cfcc..e8f7af5c012 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/optional_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/optional_testing.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct OptionalTesting { #[serde(rename = "optional_nonnull", skip_serializing_if = "Option::is_none")] pub optional_nonnull: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/order.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/order.rs index d3fe7e2a955..089fc80445d 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/order.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/order.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Order { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/pet.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/pet.rs index 1884034a45e..6661e036994 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/pet.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/pet.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Pet { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/property_test.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/property_test.rs index d9b3982b493..e496a02311c 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/property_test.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/property_test.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct PropertyTest { #[serde(rename = "uuid", skip_serializing_if = "Option::is_none")] pub uuid: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/tag.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/tag.rs index e0ae6e9efcc..1786ebec3ac 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/tag.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/tag.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Tag { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/type_testing.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/type_testing.rs index daa92f87a1c..079ac75daff 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/type_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/type_testing.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct TypeTesting { #[serde(rename = "int32")] pub int32: i32, diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/unique_item_array_testing.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/unique_item_array_testing.rs index a82e3e5773b..854ca0916ae 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/unique_item_array_testing.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/unique_item_array_testing.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UniqueItemArrayTesting { /// Helper object for the unique item array test #[serde(rename = "unique_item_array")] diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/user.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/user.rs index 098482bd457..c52c16ba316 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/user.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/user.rs @@ -12,7 +12,7 @@ -#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct User { #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option,