diff --git a/modules/openapi-generator/src/main/resources/rust/Cargo.mustache b/modules/openapi-generator/src/main/resources/rust/Cargo.mustache index 239b1a8474e..7be71a10b82 100644 --- a/modules/openapi-generator/src/main/resources/rust/Cargo.mustache +++ b/modules/openapi-generator/src/main/resources/rust/Cargo.mustache @@ -37,6 +37,7 @@ serde = { version = "^1.0", features = ["derive"] } serde_with = { version = "^3.8", default-features = false, features = ["base64", "std", "macros"] } {{/serdeWith}} serde_json = "^1.0" +serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } {{#hyper}} diff --git a/modules/openapi-generator/src/main/resources/rust/lib.mustache b/modules/openapi-generator/src/main/resources/rust/lib.mustache index 276ad12cfbb..b51df2b1f1e 100644 --- a/modules/openapi-generator/src/main/resources/rust/lib.mustache +++ b/modules/openapi-generator/src/main/resources/rust/lib.mustache @@ -1,6 +1,7 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] +extern crate serde_repr; extern crate serde; extern crate serde_json; extern crate url; diff --git a/modules/openapi-generator/src/main/resources/rust/model.mustache b/modules/openapi-generator/src/main/resources/rust/model.mustache index dd7ac5a1cdf..79d3cda1c2b 100644 --- a/modules/openapi-generator/src/main/resources/rust/model.mustache +++ b/modules/openapi-generator/src/main/resources/rust/model.mustache @@ -6,11 +6,43 @@ use serde::{Deserialize, Serialize}; {{^isEnum}}{{#vendorExtensions.x-rust-has-byte-array}} use serde_with::serde_as; {{/vendorExtensions.x-rust-has-byte-array}}{{/isEnum}} +{{#isEnum}} +{{#isInteger}} +use serde_repr::{Serialize_repr,Deserialize_repr}; +{{/isInteger}} +{{/isEnum}} {{#description}} /// {{{classname}}} : {{{description}}} {{/description}} +{{!-- for repr(int) enum schemas --}} +{{#isEnum}} +{{#isInteger}} +/// {{{description}}} +#[repr(i64)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize_repr, Deserialize_repr)] +pub enum {{{classname}}} { +{{#allowableValues}} +{{#enumVars}} + {{{name}}} = {{{value}}}, +{{/enumVars}}{{/allowableValues}} +} + +impl ToString for {{{classname}}} { + fn to_string(&self) -> String { + match self { + {{#allowableValues}} + {{#enumVars}} + Self::{{{name}}} => String::from("{{{value}}}"), + {{/enumVars}} + {{/allowableValues}} + } + } +} +{{/isInteger}} +{{/isEnum}} {{!-- for enum schemas --}} {{#isEnum}} +{{^isInteger}} /// {{{description}}} #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum {{{classname}}} { @@ -33,6 +65,7 @@ impl std::fmt::Display for {{{classname}}} { } } +{{/isInteger}} impl Default for {{{classname}}} { fn default() -> {{{classname}}} { {{#allowableValues}} diff --git a/modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml b/modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml index 917b103eb0c..2c5ad0483fb 100644 --- a/modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml @@ -959,6 +959,14 @@ components: nullable: true just_string: type: string + NumericEnumTesting: + description: testing that numeric enums are converted correctly + enum: + - 0 + - 1 + - 2 + - 3 + type: integer ref: description: using reserved word as model name type: object diff --git a/samples/client/others/rust/hyper/api-with-ref-param/Cargo.toml b/samples/client/others/rust/hyper/api-with-ref-param/Cargo.toml index dee5baf694f..00f46b1c7d3 100644 --- a/samples/client/others/rust/hyper/api-with-ref-param/Cargo.toml +++ b/samples/client/others/rust/hyper/api-with-ref-param/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" [dependencies] serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" +serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } hyper = { version = "^1.3.1", features = ["full"] } diff --git a/samples/client/others/rust/hyper/api-with-ref-param/src/lib.rs b/samples/client/others/rust/hyper/api-with-ref-param/src/lib.rs index 1de74d07cff..f5cfd231540 100644 --- a/samples/client/others/rust/hyper/api-with-ref-param/src/lib.rs +++ b/samples/client/others/rust/hyper/api-with-ref-param/src/lib.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] +extern crate serde_repr; extern crate serde; extern crate serde_json; extern crate url; diff --git a/samples/client/others/rust/hyper/composed-oneof/Cargo.toml b/samples/client/others/rust/hyper/composed-oneof/Cargo.toml index 596638d25ac..4c0a00557c5 100644 --- a/samples/client/others/rust/hyper/composed-oneof/Cargo.toml +++ b/samples/client/others/rust/hyper/composed-oneof/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" [dependencies] serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" +serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } hyper = { version = "^1.3.1", features = ["full"] } diff --git a/samples/client/others/rust/hyper/composed-oneof/src/lib.rs b/samples/client/others/rust/hyper/composed-oneof/src/lib.rs index 1de74d07cff..f5cfd231540 100644 --- a/samples/client/others/rust/hyper/composed-oneof/src/lib.rs +++ b/samples/client/others/rust/hyper/composed-oneof/src/lib.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] +extern crate serde_repr; extern crate serde; extern crate serde_json; extern crate url; diff --git a/samples/client/others/rust/hyper/emptyObject/Cargo.toml b/samples/client/others/rust/hyper/emptyObject/Cargo.toml index 240ccddee96..1efb624b65d 100644 --- a/samples/client/others/rust/hyper/emptyObject/Cargo.toml +++ b/samples/client/others/rust/hyper/emptyObject/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" [dependencies] serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" +serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } hyper = { version = "^1.3.1", features = ["full"] } diff --git a/samples/client/others/rust/hyper/emptyObject/src/lib.rs b/samples/client/others/rust/hyper/emptyObject/src/lib.rs index 1de74d07cff..f5cfd231540 100644 --- a/samples/client/others/rust/hyper/emptyObject/src/lib.rs +++ b/samples/client/others/rust/hyper/emptyObject/src/lib.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] +extern crate serde_repr; extern crate serde; extern crate serde_json; extern crate url; diff --git a/samples/client/others/rust/hyper/oneOf-array-map/Cargo.toml b/samples/client/others/rust/hyper/oneOf-array-map/Cargo.toml index 9209f8063af..1bb7aa7bb54 100644 --- a/samples/client/others/rust/hyper/oneOf-array-map/Cargo.toml +++ b/samples/client/others/rust/hyper/oneOf-array-map/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" [dependencies] serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" +serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } hyper = { version = "^1.3.1", features = ["full"] } diff --git a/samples/client/others/rust/hyper/oneOf-array-map/src/lib.rs b/samples/client/others/rust/hyper/oneOf-array-map/src/lib.rs index 1de74d07cff..f5cfd231540 100644 --- a/samples/client/others/rust/hyper/oneOf-array-map/src/lib.rs +++ b/samples/client/others/rust/hyper/oneOf-array-map/src/lib.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] +extern crate serde_repr; extern crate serde; extern crate serde_json; extern crate url; diff --git a/samples/client/others/rust/hyper/oneOf-reuseRef/Cargo.toml b/samples/client/others/rust/hyper/oneOf-reuseRef/Cargo.toml index 167cd6a0ae5..07b8f6cf6d8 100644 --- a/samples/client/others/rust/hyper/oneOf-reuseRef/Cargo.toml +++ b/samples/client/others/rust/hyper/oneOf-reuseRef/Cargo.toml @@ -9,6 +9,7 @@ edition = "2021" [dependencies] serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" +serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } hyper = { version = "^1.3.1", features = ["full"] } diff --git a/samples/client/others/rust/hyper/oneOf-reuseRef/src/lib.rs b/samples/client/others/rust/hyper/oneOf-reuseRef/src/lib.rs index 1de74d07cff..f5cfd231540 100644 --- a/samples/client/others/rust/hyper/oneOf-reuseRef/src/lib.rs +++ b/samples/client/others/rust/hyper/oneOf-reuseRef/src/lib.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] +extern crate serde_repr; extern crate serde; extern crate serde_json; extern crate url; diff --git a/samples/client/others/rust/hyper/oneOf/Cargo.toml b/samples/client/others/rust/hyper/oneOf/Cargo.toml index 82e821be70e..fb78d69e910 100644 --- a/samples/client/others/rust/hyper/oneOf/Cargo.toml +++ b/samples/client/others/rust/hyper/oneOf/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" [dependencies] serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" +serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } hyper = { version = "^1.3.1", features = ["full"] } diff --git a/samples/client/others/rust/hyper/oneOf/src/lib.rs b/samples/client/others/rust/hyper/oneOf/src/lib.rs index 1de74d07cff..f5cfd231540 100644 --- a/samples/client/others/rust/hyper/oneOf/src/lib.rs +++ b/samples/client/others/rust/hyper/oneOf/src/lib.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] +extern crate serde_repr; extern crate serde; extern crate serde_json; extern crate url; diff --git a/samples/client/others/rust/reqwest-regression-16119/Cargo.toml b/samples/client/others/rust/reqwest-regression-16119/Cargo.toml index 1919da46b08..a1e41446d88 100644 --- a/samples/client/others/rust/reqwest-regression-16119/Cargo.toml +++ b/samples/client/others/rust/reqwest-regression-16119/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" [dependencies] serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" +serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] } diff --git a/samples/client/others/rust/reqwest-regression-16119/src/lib.rs b/samples/client/others/rust/reqwest-regression-16119/src/lib.rs index a1837b966dc..e1520628d76 100644 --- a/samples/client/others/rust/reqwest-regression-16119/src/lib.rs +++ b/samples/client/others/rust/reqwest-regression-16119/src/lib.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] +extern crate serde_repr; extern crate serde; extern crate serde_json; extern crate url; diff --git a/samples/client/others/rust/reqwest/api-with-ref-param/Cargo.toml b/samples/client/others/rust/reqwest/api-with-ref-param/Cargo.toml index 7fc367e02dd..e4edc99b719 100644 --- a/samples/client/others/rust/reqwest/api-with-ref-param/Cargo.toml +++ b/samples/client/others/rust/reqwest/api-with-ref-param/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" [dependencies] serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" +serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } reqwest = { version = "^0.12", features = ["json", "multipart"] } diff --git a/samples/client/others/rust/reqwest/api-with-ref-param/src/lib.rs b/samples/client/others/rust/reqwest/api-with-ref-param/src/lib.rs index a1837b966dc..e1520628d76 100644 --- a/samples/client/others/rust/reqwest/api-with-ref-param/src/lib.rs +++ b/samples/client/others/rust/reqwest/api-with-ref-param/src/lib.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] +extern crate serde_repr; extern crate serde; extern crate serde_json; extern crate url; diff --git a/samples/client/others/rust/reqwest/composed-oneof/Cargo.toml b/samples/client/others/rust/reqwest/composed-oneof/Cargo.toml index 0a06ebb4f87..f06effdcb10 100644 --- a/samples/client/others/rust/reqwest/composed-oneof/Cargo.toml +++ b/samples/client/others/rust/reqwest/composed-oneof/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" [dependencies] serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" +serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] } diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/lib.rs b/samples/client/others/rust/reqwest/composed-oneof/src/lib.rs index a1837b966dc..e1520628d76 100644 --- a/samples/client/others/rust/reqwest/composed-oneof/src/lib.rs +++ b/samples/client/others/rust/reqwest/composed-oneof/src/lib.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] +extern crate serde_repr; extern crate serde; extern crate serde_json; extern crate url; diff --git a/samples/client/others/rust/reqwest/emptyObject/Cargo.toml b/samples/client/others/rust/reqwest/emptyObject/Cargo.toml index 8245af0063c..d35bad9e88d 100644 --- a/samples/client/others/rust/reqwest/emptyObject/Cargo.toml +++ b/samples/client/others/rust/reqwest/emptyObject/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" [dependencies] serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" +serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] } diff --git a/samples/client/others/rust/reqwest/emptyObject/src/lib.rs b/samples/client/others/rust/reqwest/emptyObject/src/lib.rs index a1837b966dc..e1520628d76 100644 --- a/samples/client/others/rust/reqwest/emptyObject/src/lib.rs +++ b/samples/client/others/rust/reqwest/emptyObject/src/lib.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] +extern crate serde_repr; extern crate serde; extern crate serde_json; extern crate url; diff --git a/samples/client/others/rust/reqwest/oneOf-array-map/Cargo.toml b/samples/client/others/rust/reqwest/oneOf-array-map/Cargo.toml index 0b23d93ace1..5f2d99d1804 100644 --- a/samples/client/others/rust/reqwest/oneOf-array-map/Cargo.toml +++ b/samples/client/others/rust/reqwest/oneOf-array-map/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" [dependencies] serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" +serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] } diff --git a/samples/client/others/rust/reqwest/oneOf-array-map/src/lib.rs b/samples/client/others/rust/reqwest/oneOf-array-map/src/lib.rs index a1837b966dc..e1520628d76 100644 --- a/samples/client/others/rust/reqwest/oneOf-array-map/src/lib.rs +++ b/samples/client/others/rust/reqwest/oneOf-array-map/src/lib.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] +extern crate serde_repr; extern crate serde; extern crate serde_json; extern crate url; diff --git a/samples/client/others/rust/reqwest/oneOf-reuseRef/Cargo.toml b/samples/client/others/rust/reqwest/oneOf-reuseRef/Cargo.toml index 4d69b38b2e5..64b0d4bf92f 100644 --- a/samples/client/others/rust/reqwest/oneOf-reuseRef/Cargo.toml +++ b/samples/client/others/rust/reqwest/oneOf-reuseRef/Cargo.toml @@ -9,6 +9,7 @@ edition = "2021" [dependencies] serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" +serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] } diff --git a/samples/client/others/rust/reqwest/oneOf-reuseRef/src/lib.rs b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/lib.rs index a1837b966dc..e1520628d76 100644 --- a/samples/client/others/rust/reqwest/oneOf-reuseRef/src/lib.rs +++ b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/lib.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] +extern crate serde_repr; extern crate serde; extern crate serde_json; extern crate url; diff --git a/samples/client/others/rust/reqwest/oneOf/Cargo.toml b/samples/client/others/rust/reqwest/oneOf/Cargo.toml index 89997ba9566..8966bd1292c 100644 --- a/samples/client/others/rust/reqwest/oneOf/Cargo.toml +++ b/samples/client/others/rust/reqwest/oneOf/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" [dependencies] serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" +serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] } diff --git a/samples/client/others/rust/reqwest/oneOf/src/lib.rs b/samples/client/others/rust/reqwest/oneOf/src/lib.rs index a1837b966dc..e1520628d76 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/lib.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/lib.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] +extern crate serde_repr; extern crate serde; extern crate serde_json; extern crate url; diff --git a/samples/client/petstore/rust/hyper/petstore/.openapi-generator/FILES b/samples/client/petstore/rust/hyper/petstore/.openapi-generator/FILES index eb23185b873..078bc10bcb4 100644 --- a/samples/client/petstore/rust/hyper/petstore/.openapi-generator/FILES +++ b/samples/client/petstore/rust/hyper/petstore/.openapi-generator/FILES @@ -10,6 +10,7 @@ docs/Category.md docs/EnumArrayTesting.md docs/FakeApi.md docs/NullableArray.md +docs/NumericEnumTesting.md docs/OptionalTesting.md docs/Order.md docs/Pet.md @@ -45,6 +46,7 @@ src/models/mod.rs src/models/model_ref.rs src/models/model_return.rs src/models/nullable_array.rs +src/models/numeric_enum_testing.rs src/models/optional_testing.rs src/models/order.rs src/models/pet.rs diff --git a/samples/client/petstore/rust/hyper/petstore/Cargo.toml b/samples/client/petstore/rust/hyper/petstore/Cargo.toml index 3f243da8d4b..a9eedf18dea 100644 --- a/samples/client/petstore/rust/hyper/petstore/Cargo.toml +++ b/samples/client/petstore/rust/hyper/petstore/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" serde = { version = "^1.0", features = ["derive"] } serde_with = { version = "^3.8", default-features = false, features = ["base64", "std", "macros"] } serde_json = "^1.0" +serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } hyper = { version = "^1.3.1", features = ["full"] } diff --git a/samples/client/petstore/rust/hyper/petstore/README.md b/samples/client/petstore/rust/hyper/petstore/README.md index 2bea68a6be3..b7c9fb7df17 100644 --- a/samples/client/petstore/rust/hyper/petstore/README.md +++ b/samples/client/petstore/rust/hyper/petstore/README.md @@ -60,6 +60,7 @@ Class | Method | HTTP request | Description - [Category](docs/Category.md) - [EnumArrayTesting](docs/EnumArrayTesting.md) - [NullableArray](docs/NullableArray.md) + - [NumericEnumTesting](docs/NumericEnumTesting.md) - [OptionalTesting](docs/OptionalTesting.md) - [Order](docs/Order.md) - [Pet](docs/Pet.md) diff --git a/samples/client/petstore/rust/hyper/petstore/docs/NumericEnumTesting.md b/samples/client/petstore/rust/hyper/petstore/docs/NumericEnumTesting.md new file mode 100644 index 00000000000..6e99038d397 --- /dev/null +++ b/samples/client/petstore/rust/hyper/petstore/docs/NumericEnumTesting.md @@ -0,0 +1,15 @@ +# NumericEnumTesting + +## Enum Variants + +| Name | Value | +|---- | -----| +| Variant0 | 0 | +| Variant1 | 1 | +| Variant2 | 2 | +| Variant3 | 3 | + + +[[Back to Model list]](../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/lib.rs b/samples/client/petstore/rust/hyper/petstore/src/lib.rs index 1de74d07cff..f5cfd231540 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/lib.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/lib.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] +extern crate serde_repr; extern crate serde; extern crate serde_json; extern crate url; diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/mod.rs b/samples/client/petstore/rust/hyper/petstore/src/models/mod.rs index 884357e8604..b7e684d8071 100644 --- a/samples/client/petstore/rust/hyper/petstore/src/models/mod.rs +++ b/samples/client/petstore/rust/hyper/petstore/src/models/mod.rs @@ -12,6 +12,8 @@ pub mod enum_array_testing; pub use self::enum_array_testing::EnumArrayTesting; pub mod nullable_array; pub use self::nullable_array::NullableArray; +pub mod numeric_enum_testing; +pub use self::numeric_enum_testing::NumericEnumTesting; pub mod optional_testing; pub use self::optional_testing::OptionalTesting; pub mod order; diff --git a/samples/client/petstore/rust/hyper/petstore/src/models/numeric_enum_testing.rs b/samples/client/petstore/rust/hyper/petstore/src/models/numeric_enum_testing.rs new file mode 100644 index 00000000000..9b8f0cb0465 --- /dev/null +++ b/samples/client/petstore/rust/hyper/petstore/src/models/numeric_enum_testing.rs @@ -0,0 +1,42 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_repr::{Serialize_repr,Deserialize_repr}; +/// NumericEnumTesting : testing that numeric enums are converted correctly +/// testing that numeric enums are converted correctly +#[repr(i64)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize_repr, Deserialize_repr)] +pub enum NumericEnumTesting { + Variant0 = 0, + Variant1 = 1, + Variant2 = 2, + Variant3 = 3, + +} + +impl ToString for NumericEnumTesting { + fn to_string(&self) -> String { + match self { + Self::Variant0 => String::from("0"), + Self::Variant1 => String::from("1"), + Self::Variant2 => String::from("2"), + Self::Variant3 => String::from("3"), + } + } +} +impl Default for NumericEnumTesting { + fn default() -> NumericEnumTesting { + Self::Variant0 + } +} + diff --git a/samples/client/petstore/rust/hyper0x/petstore/.openapi-generator/FILES b/samples/client/petstore/rust/hyper0x/petstore/.openapi-generator/FILES index bcfaf169317..6d5eacd5c07 100644 --- a/samples/client/petstore/rust/hyper0x/petstore/.openapi-generator/FILES +++ b/samples/client/petstore/rust/hyper0x/petstore/.openapi-generator/FILES @@ -10,6 +10,7 @@ docs/Category.md docs/EnumArrayTesting.md docs/FakeApi.md docs/NullableArray.md +docs/NumericEnumTesting.md docs/OptionalTesting.md docs/Order.md docs/Pet.md @@ -43,6 +44,7 @@ src/models/mod.rs src/models/model_ref.rs src/models/model_return.rs src/models/nullable_array.rs +src/models/numeric_enum_testing.rs src/models/optional_testing.rs src/models/order.rs src/models/pet.rs diff --git a/samples/client/petstore/rust/hyper0x/petstore/Cargo.toml b/samples/client/petstore/rust/hyper0x/petstore/Cargo.toml index 1d9fe70961c..a1b39ea2340 100644 --- a/samples/client/petstore/rust/hyper0x/petstore/Cargo.toml +++ b/samples/client/petstore/rust/hyper0x/petstore/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" serde = { version = "^1.0", features = ["derive"] } serde_with = { version = "^3.8", default-features = false, features = ["base64", "std", "macros"] } serde_json = "^1.0" +serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } hyper = { version = "~0.14", features = ["full"] } diff --git a/samples/client/petstore/rust/hyper0x/petstore/README.md b/samples/client/petstore/rust/hyper0x/petstore/README.md index b7f95f0a85c..c04aee70dfb 100644 --- a/samples/client/petstore/rust/hyper0x/petstore/README.md +++ b/samples/client/petstore/rust/hyper0x/petstore/README.md @@ -60,6 +60,7 @@ Class | Method | HTTP request | Description - [Category](docs/Category.md) - [EnumArrayTesting](docs/EnumArrayTesting.md) - [NullableArray](docs/NullableArray.md) + - [NumericEnumTesting](docs/NumericEnumTesting.md) - [OptionalTesting](docs/OptionalTesting.md) - [Order](docs/Order.md) - [Pet](docs/Pet.md) diff --git a/samples/client/petstore/rust/hyper0x/petstore/docs/NumericEnumTesting.md b/samples/client/petstore/rust/hyper0x/petstore/docs/NumericEnumTesting.md new file mode 100644 index 00000000000..6e99038d397 --- /dev/null +++ b/samples/client/petstore/rust/hyper0x/petstore/docs/NumericEnumTesting.md @@ -0,0 +1,15 @@ +# NumericEnumTesting + +## Enum Variants + +| Name | Value | +|---- | -----| +| Variant0 | 0 | +| Variant1 | 1 | +| Variant2 | 2 | +| Variant3 | 3 | + + +[[Back to Model list]](../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/hyper0x/petstore/src/lib.rs b/samples/client/petstore/rust/hyper0x/petstore/src/lib.rs index 1de74d07cff..f5cfd231540 100644 --- a/samples/client/petstore/rust/hyper0x/petstore/src/lib.rs +++ b/samples/client/petstore/rust/hyper0x/petstore/src/lib.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] +extern crate serde_repr; extern crate serde; extern crate serde_json; extern crate url; diff --git a/samples/client/petstore/rust/hyper0x/petstore/src/models/mod.rs b/samples/client/petstore/rust/hyper0x/petstore/src/models/mod.rs index 884357e8604..b7e684d8071 100644 --- a/samples/client/petstore/rust/hyper0x/petstore/src/models/mod.rs +++ b/samples/client/petstore/rust/hyper0x/petstore/src/models/mod.rs @@ -12,6 +12,8 @@ pub mod enum_array_testing; pub use self::enum_array_testing::EnumArrayTesting; pub mod nullable_array; pub use self::nullable_array::NullableArray; +pub mod numeric_enum_testing; +pub use self::numeric_enum_testing::NumericEnumTesting; pub mod optional_testing; pub use self::optional_testing::OptionalTesting; pub mod order; diff --git a/samples/client/petstore/rust/hyper0x/petstore/src/models/numeric_enum_testing.rs b/samples/client/petstore/rust/hyper0x/petstore/src/models/numeric_enum_testing.rs new file mode 100644 index 00000000000..9b8f0cb0465 --- /dev/null +++ b/samples/client/petstore/rust/hyper0x/petstore/src/models/numeric_enum_testing.rs @@ -0,0 +1,42 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_repr::{Serialize_repr,Deserialize_repr}; +/// NumericEnumTesting : testing that numeric enums are converted correctly +/// testing that numeric enums are converted correctly +#[repr(i64)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize_repr, Deserialize_repr)] +pub enum NumericEnumTesting { + Variant0 = 0, + Variant1 = 1, + Variant2 = 2, + Variant3 = 3, + +} + +impl ToString for NumericEnumTesting { + fn to_string(&self) -> String { + match self { + Self::Variant0 => String::from("0"), + Self::Variant1 => String::from("1"), + Self::Variant2 => String::from("2"), + Self::Variant3 => String::from("3"), + } + } +} +impl Default for NumericEnumTesting { + fn default() -> NumericEnumTesting { + Self::Variant0 + } +} + diff --git a/samples/client/petstore/rust/reqwest/name-mapping/Cargo.toml b/samples/client/petstore/rust/reqwest/name-mapping/Cargo.toml index 120ba16c882..172f74f4e1f 100644 --- a/samples/client/petstore/rust/reqwest/name-mapping/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/name-mapping/Cargo.toml @@ -9,6 +9,7 @@ edition = "2021" [dependencies] serde = { version = "^1.0", features = ["derive"] } serde_json = "^1.0" +serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] } diff --git a/samples/client/petstore/rust/reqwest/name-mapping/src/lib.rs b/samples/client/petstore/rust/reqwest/name-mapping/src/lib.rs index a1837b966dc..e1520628d76 100644 --- a/samples/client/petstore/rust/reqwest/name-mapping/src/lib.rs +++ b/samples/client/petstore/rust/reqwest/name-mapping/src/lib.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] +extern crate serde_repr; extern crate serde; extern crate serde_json; extern crate url; diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/.openapi-generator/FILES b/samples/client/petstore/rust/reqwest/petstore-async-middleware/.openapi-generator/FILES index bcfaf169317..6d5eacd5c07 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/.openapi-generator/FILES +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/.openapi-generator/FILES @@ -10,6 +10,7 @@ docs/Category.md docs/EnumArrayTesting.md docs/FakeApi.md docs/NullableArray.md +docs/NumericEnumTesting.md docs/OptionalTesting.md docs/Order.md docs/Pet.md @@ -43,6 +44,7 @@ src/models/mod.rs src/models/model_ref.rs src/models/model_return.rs src/models/nullable_array.rs +src/models/numeric_enum_testing.rs src/models/optional_testing.rs src/models/order.rs src/models/pet.rs diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/Cargo.toml b/samples/client/petstore/rust/reqwest/petstore-async-middleware/Cargo.toml index cd7d83abaa6..2bbf314d7e8 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" serde = { version = "^1.0", features = ["derive"] } serde_with = { version = "^3.8", default-features = false, features = ["base64", "std", "macros"] } serde_json = "^1.0" +serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } reqwest = { version = "^0.12", features = ["json", "multipart"] } diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/README.md b/samples/client/petstore/rust/reqwest/petstore-async-middleware/README.md index f6ec4091878..8c45ec4babd 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/README.md +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/README.md @@ -60,6 +60,7 @@ Class | Method | HTTP request | Description - [Category](docs/Category.md) - [EnumArrayTesting](docs/EnumArrayTesting.md) - [NullableArray](docs/NullableArray.md) + - [NumericEnumTesting](docs/NumericEnumTesting.md) - [OptionalTesting](docs/OptionalTesting.md) - [Order](docs/Order.md) - [Pet](docs/Pet.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/NumericEnumTesting.md b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/NumericEnumTesting.md new file mode 100644 index 00000000000..6e99038d397 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/docs/NumericEnumTesting.md @@ -0,0 +1,15 @@ +# NumericEnumTesting + +## Enum Variants + +| Name | Value | +|---- | -----| +| Variant0 | 0 | +| Variant1 | 1 | +| Variant2 | 2 | +| Variant3 | 3 | + + +[[Back to Model list]](../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/lib.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/lib.rs index a1837b966dc..e1520628d76 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/lib.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/lib.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] +extern crate serde_repr; extern crate serde; extern crate serde_json; extern crate url; diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/mod.rs index 884357e8604..b7e684d8071 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/mod.rs @@ -12,6 +12,8 @@ pub mod enum_array_testing; pub use self::enum_array_testing::EnumArrayTesting; pub mod nullable_array; pub use self::nullable_array::NullableArray; +pub mod numeric_enum_testing; +pub use self::numeric_enum_testing::NumericEnumTesting; pub mod optional_testing; pub use self::optional_testing::OptionalTesting; pub mod order; diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/numeric_enum_testing.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/numeric_enum_testing.rs new file mode 100644 index 00000000000..9b8f0cb0465 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/models/numeric_enum_testing.rs @@ -0,0 +1,42 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_repr::{Serialize_repr,Deserialize_repr}; +/// NumericEnumTesting : testing that numeric enums are converted correctly +/// testing that numeric enums are converted correctly +#[repr(i64)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize_repr, Deserialize_repr)] +pub enum NumericEnumTesting { + Variant0 = 0, + Variant1 = 1, + Variant2 = 2, + Variant3 = 3, + +} + +impl ToString for NumericEnumTesting { + fn to_string(&self) -> String { + match self { + Self::Variant0 => String::from("0"), + Self::Variant1 => String::from("1"), + Self::Variant2 => String::from("2"), + Self::Variant3 => String::from("3"), + } + } +} +impl Default for NumericEnumTesting { + fn default() -> NumericEnumTesting { + Self::Variant0 + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-async/.openapi-generator/FILES b/samples/client/petstore/rust/reqwest/petstore-async/.openapi-generator/FILES index bcfaf169317..6d5eacd5c07 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/.openapi-generator/FILES +++ b/samples/client/petstore/rust/reqwest/petstore-async/.openapi-generator/FILES @@ -10,6 +10,7 @@ docs/Category.md docs/EnumArrayTesting.md docs/FakeApi.md docs/NullableArray.md +docs/NumericEnumTesting.md docs/OptionalTesting.md docs/Order.md docs/Pet.md @@ -43,6 +44,7 @@ src/models/mod.rs src/models/model_ref.rs src/models/model_return.rs src/models/nullable_array.rs +src/models/numeric_enum_testing.rs src/models/optional_testing.rs src/models/order.rs src/models/pet.rs diff --git a/samples/client/petstore/rust/reqwest/petstore-async/Cargo.toml b/samples/client/petstore/rust/reqwest/petstore-async/Cargo.toml index 8fa64e90a2f..3803423fe92 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/petstore-async/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" serde = { version = "^1.0", features = ["derive"] } serde_with = { version = "^3.8", default-features = false, features = ["base64", "std", "macros"] } serde_json = "^1.0" +serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } reqwest = { version = "^0.12", features = ["json", "multipart"] } diff --git a/samples/client/petstore/rust/reqwest/petstore-async/README.md b/samples/client/petstore/rust/reqwest/petstore-async/README.md index ae58aeea814..688b07b78ae 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/README.md +++ b/samples/client/petstore/rust/reqwest/petstore-async/README.md @@ -60,6 +60,7 @@ Class | Method | HTTP request | Description - [Category](docs/Category.md) - [EnumArrayTesting](docs/EnumArrayTesting.md) - [NullableArray](docs/NullableArray.md) + - [NumericEnumTesting](docs/NumericEnumTesting.md) - [OptionalTesting](docs/OptionalTesting.md) - [Order](docs/Order.md) - [Pet](docs/Pet.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-async/docs/NumericEnumTesting.md b/samples/client/petstore/rust/reqwest/petstore-async/docs/NumericEnumTesting.md new file mode 100644 index 00000000000..6e99038d397 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async/docs/NumericEnumTesting.md @@ -0,0 +1,15 @@ +# NumericEnumTesting + +## Enum Variants + +| Name | Value | +|---- | -----| +| Variant0 | 0 | +| Variant1 | 1 | +| Variant2 | 2 | +| Variant3 | 3 | + + +[[Back to Model list]](../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/lib.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/lib.rs index a1837b966dc..e1520628d76 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/lib.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/lib.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] +extern crate serde_repr; extern crate serde; extern crate serde_json; extern crate url; diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/mod.rs index 884357e8604..b7e684d8071 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/mod.rs @@ -12,6 +12,8 @@ pub mod enum_array_testing; pub use self::enum_array_testing::EnumArrayTesting; pub mod nullable_array; pub use self::nullable_array::NullableArray; +pub mod numeric_enum_testing; +pub use self::numeric_enum_testing::NumericEnumTesting; pub mod optional_testing; pub use self::optional_testing::OptionalTesting; pub mod order; diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/models/numeric_enum_testing.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/models/numeric_enum_testing.rs new file mode 100644 index 00000000000..9b8f0cb0465 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/models/numeric_enum_testing.rs @@ -0,0 +1,42 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_repr::{Serialize_repr,Deserialize_repr}; +/// NumericEnumTesting : testing that numeric enums are converted correctly +/// testing that numeric enums are converted correctly +#[repr(i64)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize_repr, Deserialize_repr)] +pub enum NumericEnumTesting { + Variant0 = 0, + Variant1 = 1, + Variant2 = 2, + Variant3 = 3, + +} + +impl ToString for NumericEnumTesting { + fn to_string(&self) -> String { + match self { + Self::Variant0 => String::from("0"), + Self::Variant1 => String::from("1"), + Self::Variant2 => String::from("2"), + Self::Variant3 => String::from("3"), + } + } +} +impl Default for NumericEnumTesting { + fn default() -> NumericEnumTesting { + Self::Variant0 + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/.openapi-generator/FILES b/samples/client/petstore/rust/reqwest/petstore-avoid-box/.openapi-generator/FILES index bcfaf169317..6d5eacd5c07 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/.openapi-generator/FILES +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/.openapi-generator/FILES @@ -10,6 +10,7 @@ docs/Category.md docs/EnumArrayTesting.md docs/FakeApi.md docs/NullableArray.md +docs/NumericEnumTesting.md docs/OptionalTesting.md docs/Order.md docs/Pet.md @@ -43,6 +44,7 @@ src/models/mod.rs src/models/model_ref.rs src/models/model_return.rs src/models/nullable_array.rs +src/models/numeric_enum_testing.rs src/models/optional_testing.rs src/models/order.rs src/models/pet.rs diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/Cargo.toml b/samples/client/petstore/rust/reqwest/petstore-avoid-box/Cargo.toml index 99fe8589bc8..a3312a3a7ee 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" serde = { version = "^1.0", features = ["derive"] } serde_with = { version = "^3.8", default-features = false, features = ["base64", "std", "macros"] } serde_json = "^1.0" +serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } reqwest = { version = "^0.12", features = ["json", "multipart"] } diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/README.md b/samples/client/petstore/rust/reqwest/petstore-avoid-box/README.md index 5b24f984091..cd58e3468f0 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/README.md +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/README.md @@ -60,6 +60,7 @@ Class | Method | HTTP request | Description - [Category](docs/Category.md) - [EnumArrayTesting](docs/EnumArrayTesting.md) - [NullableArray](docs/NullableArray.md) + - [NumericEnumTesting](docs/NumericEnumTesting.md) - [OptionalTesting](docs/OptionalTesting.md) - [Order](docs/Order.md) - [Pet](docs/Pet.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/NumericEnumTesting.md b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/NumericEnumTesting.md new file mode 100644 index 00000000000..6e99038d397 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/docs/NumericEnumTesting.md @@ -0,0 +1,15 @@ +# NumericEnumTesting + +## Enum Variants + +| Name | Value | +|---- | -----| +| Variant0 | 0 | +| Variant1 | 1 | +| Variant2 | 2 | +| Variant3 | 3 | + + +[[Back to Model list]](../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-avoid-box/src/lib.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/lib.rs index a1837b966dc..e1520628d76 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/lib.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/lib.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] +extern crate serde_repr; extern crate serde; extern crate serde_json; extern crate url; diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/mod.rs index 884357e8604..b7e684d8071 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/mod.rs @@ -12,6 +12,8 @@ pub mod enum_array_testing; pub use self::enum_array_testing::EnumArrayTesting; pub mod nullable_array; pub use self::nullable_array::NullableArray; +pub mod numeric_enum_testing; +pub use self::numeric_enum_testing::NumericEnumTesting; pub mod optional_testing; pub use self::optional_testing::OptionalTesting; pub mod order; diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/numeric_enum_testing.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/numeric_enum_testing.rs new file mode 100644 index 00000000000..9b8f0cb0465 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/models/numeric_enum_testing.rs @@ -0,0 +1,42 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_repr::{Serialize_repr,Deserialize_repr}; +/// NumericEnumTesting : testing that numeric enums are converted correctly +/// testing that numeric enums are converted correctly +#[repr(i64)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize_repr, Deserialize_repr)] +pub enum NumericEnumTesting { + Variant0 = 0, + Variant1 = 1, + Variant2 = 2, + Variant3 = 3, + +} + +impl ToString for NumericEnumTesting { + fn to_string(&self) -> String { + match self { + Self::Variant0 => String::from("0"), + Self::Variant1 => String::from("1"), + Self::Variant2 => String::from("2"), + Self::Variant3 => String::from("3"), + } + } +} +impl Default for NumericEnumTesting { + fn default() -> NumericEnumTesting { + Self::Variant0 + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/.openapi-generator/FILES b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/.openapi-generator/FILES index bcfaf169317..6d5eacd5c07 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/.openapi-generator/FILES +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/.openapi-generator/FILES @@ -10,6 +10,7 @@ docs/Category.md docs/EnumArrayTesting.md docs/FakeApi.md docs/NullableArray.md +docs/NumericEnumTesting.md docs/OptionalTesting.md docs/Order.md docs/Pet.md @@ -43,6 +44,7 @@ src/models/mod.rs src/models/model_ref.rs src/models/model_return.rs src/models/nullable_array.rs +src/models/numeric_enum_testing.rs src/models/optional_testing.rs src/models/order.rs src/models/pet.rs diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/Cargo.toml b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/Cargo.toml index 31b50f4eed1..d5a2bac56a2 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" serde = { version = "^1.0", features = ["derive"] } serde_with = { version = "^3.8", default-features = false, features = ["base64", "std", "macros"] } serde_json = "^1.0" +serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } aws-sigv4 = "0.3.0" diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/README.md b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/README.md index fcd82cf8745..7e9c88bf4a6 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/README.md +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/README.md @@ -60,6 +60,7 @@ Class | Method | HTTP request | Description - [Category](docs/Category.md) - [EnumArrayTesting](docs/EnumArrayTesting.md) - [NullableArray](docs/NullableArray.md) + - [NumericEnumTesting](docs/NumericEnumTesting.md) - [OptionalTesting](docs/OptionalTesting.md) - [Order](docs/Order.md) - [Pet](docs/Pet.md) diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/NumericEnumTesting.md b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/NumericEnumTesting.md new file mode 100644 index 00000000000..6e99038d397 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/docs/NumericEnumTesting.md @@ -0,0 +1,15 @@ +# NumericEnumTesting + +## Enum Variants + +| Name | Value | +|---- | -----| +| Variant0 | 0 | +| Variant1 | 1 | +| Variant2 | 2 | +| Variant3 | 3 | + + +[[Back to Model list]](../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/lib.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/lib.rs index a1837b966dc..e1520628d76 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/lib.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/lib.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] +extern crate serde_repr; extern crate serde; extern crate serde_json; extern crate url; diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/mod.rs index 884357e8604..b7e684d8071 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/mod.rs @@ -12,6 +12,8 @@ pub mod enum_array_testing; pub use self::enum_array_testing::EnumArrayTesting; pub mod nullable_array; pub use self::nullable_array::NullableArray; +pub mod numeric_enum_testing; +pub use self::numeric_enum_testing::NumericEnumTesting; pub mod optional_testing; pub use self::optional_testing::OptionalTesting; pub mod order; diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/numeric_enum_testing.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/numeric_enum_testing.rs new file mode 100644 index 00000000000..9b8f0cb0465 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/models/numeric_enum_testing.rs @@ -0,0 +1,42 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_repr::{Serialize_repr,Deserialize_repr}; +/// NumericEnumTesting : testing that numeric enums are converted correctly +/// testing that numeric enums are converted correctly +#[repr(i64)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize_repr, Deserialize_repr)] +pub enum NumericEnumTesting { + Variant0 = 0, + Variant1 = 1, + Variant2 = 2, + Variant3 = 3, + +} + +impl ToString for NumericEnumTesting { + fn to_string(&self) -> String { + match self { + Self::Variant0 => String::from("0"), + Self::Variant1 => String::from("1"), + Self::Variant2 => String::from("2"), + Self::Variant3 => String::from("3"), + } + } +} +impl Default for NumericEnumTesting { + fn default() -> NumericEnumTesting { + Self::Variant0 + } +} + diff --git a/samples/client/petstore/rust/reqwest/petstore/.openapi-generator/FILES b/samples/client/petstore/rust/reqwest/petstore/.openapi-generator/FILES index bcfaf169317..6d5eacd5c07 100644 --- a/samples/client/petstore/rust/reqwest/petstore/.openapi-generator/FILES +++ b/samples/client/petstore/rust/reqwest/petstore/.openapi-generator/FILES @@ -10,6 +10,7 @@ docs/Category.md docs/EnumArrayTesting.md docs/FakeApi.md docs/NullableArray.md +docs/NumericEnumTesting.md docs/OptionalTesting.md docs/Order.md docs/Pet.md @@ -43,6 +44,7 @@ src/models/mod.rs src/models/model_ref.rs src/models/model_return.rs src/models/nullable_array.rs +src/models/numeric_enum_testing.rs src/models/optional_testing.rs src/models/order.rs src/models/pet.rs diff --git a/samples/client/petstore/rust/reqwest/petstore/Cargo.toml b/samples/client/petstore/rust/reqwest/petstore/Cargo.toml index 5e0e14f5120..0dd7e914941 100644 --- a/samples/client/petstore/rust/reqwest/petstore/Cargo.toml +++ b/samples/client/petstore/rust/reqwest/petstore/Cargo.toml @@ -10,6 +10,7 @@ edition = "2021" serde = { version = "^1.0", features = ["derive"] } serde_with = { version = "^3.8", default-features = false, features = ["base64", "std", "macros"] } serde_json = "^1.0" +serde_repr = "^0.1" url = "^2.5" uuid = { version = "^1.8", features = ["serde", "v4"] } reqwest = { version = "^0.12", features = ["json", "blocking", "multipart"] } diff --git a/samples/client/petstore/rust/reqwest/petstore/README.md b/samples/client/petstore/rust/reqwest/petstore/README.md index 1d7130cd5b1..e8ac7caa987 100644 --- a/samples/client/petstore/rust/reqwest/petstore/README.md +++ b/samples/client/petstore/rust/reqwest/petstore/README.md @@ -60,6 +60,7 @@ Class | Method | HTTP request | Description - [Category](docs/Category.md) - [EnumArrayTesting](docs/EnumArrayTesting.md) - [NullableArray](docs/NullableArray.md) + - [NumericEnumTesting](docs/NumericEnumTesting.md) - [OptionalTesting](docs/OptionalTesting.md) - [Order](docs/Order.md) - [Pet](docs/Pet.md) diff --git a/samples/client/petstore/rust/reqwest/petstore/docs/NumericEnumTesting.md b/samples/client/petstore/rust/reqwest/petstore/docs/NumericEnumTesting.md new file mode 100644 index 00000000000..6e99038d397 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore/docs/NumericEnumTesting.md @@ -0,0 +1,15 @@ +# NumericEnumTesting + +## Enum Variants + +| Name | Value | +|---- | -----| +| Variant0 | 0 | +| Variant1 | 1 | +| Variant2 | 2 | +| Variant3 | 3 | + + +[[Back to Model list]](../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/lib.rs b/samples/client/petstore/rust/reqwest/petstore/src/lib.rs index a1837b966dc..e1520628d76 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/lib.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/lib.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] +extern crate serde_repr; extern crate serde; extern crate serde_json; extern crate url; diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/mod.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/mod.rs index 884357e8604..b7e684d8071 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/models/mod.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/mod.rs @@ -12,6 +12,8 @@ pub mod enum_array_testing; pub use self::enum_array_testing::EnumArrayTesting; pub mod nullable_array; pub use self::nullable_array::NullableArray; +pub mod numeric_enum_testing; +pub use self::numeric_enum_testing::NumericEnumTesting; pub mod optional_testing; pub use self::optional_testing::OptionalTesting; pub mod order; diff --git a/samples/client/petstore/rust/reqwest/petstore/src/models/numeric_enum_testing.rs b/samples/client/petstore/rust/reqwest/petstore/src/models/numeric_enum_testing.rs new file mode 100644 index 00000000000..9b8f0cb0465 --- /dev/null +++ b/samples/client/petstore/rust/reqwest/petstore/src/models/numeric_enum_testing.rs @@ -0,0 +1,42 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +use serde_repr::{Serialize_repr,Deserialize_repr}; +/// NumericEnumTesting : testing that numeric enums are converted correctly +/// testing that numeric enums are converted correctly +#[repr(i64)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize_repr, Deserialize_repr)] +pub enum NumericEnumTesting { + Variant0 = 0, + Variant1 = 1, + Variant2 = 2, + Variant3 = 3, + +} + +impl ToString for NumericEnumTesting { + fn to_string(&self) -> String { + match self { + Self::Variant0 => String::from("0"), + Self::Variant1 => String::from("1"), + Self::Variant2 => String::from("2"), + Self::Variant3 => String::from("3"), + } + } +} +impl Default for NumericEnumTesting { + fn default() -> NumericEnumTesting { + Self::Variant0 + } +} +