From b54f76e3b677afe8ca7eb81af1d756d92127702e Mon Sep 17 00:00:00 2001 From: "victoria.casasampere@beethedata.com" Date: Thu, 14 Nov 2024 12:58:43 +0100 Subject: [PATCH 1/3] Dynamically set the types of integer literals --- .../main/resources/rust-axum/models.mustache | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/rust-axum/models.mustache b/modules/openapi-generator/src/main/resources/rust-axum/models.mustache index f3c4088bd7b3..7e4a5d07b95b 100644 --- a/modules/openapi-generator/src/main/resources/rust-axum/models.mustache +++ b/modules/openapi-generator/src/main/resources/rust-axum/models.mustache @@ -23,15 +23,15 @@ use crate::{models, types::*}; #[validate( {{#maxLength}} {{#minLength}} - length(min = {{minLength}}, max = {{maxLength}}), + length(min = {{minLength}}usize, max = {{maxLength}}usize), {{/minLength}} {{^minLength}} - length(max = {{maxLength}}), + length(max = {{maxLength}}usize), {{/minLength}} {{/maxLength}} {{^maxLength}} {{#minLength}} - length(min = {{minLength}}), + length(min = {{minLength}}usize), {{/minLength}} {{/maxLength}} {{#pattern}} @@ -44,28 +44,28 @@ use crate::{models, types::*}; {{/pattern}} {{#maximum}} {{#minimum}} - range(min = {{minimum}}, max = {{maximum}}), + range(min = {{minimum}}{{{dataType}}}, max = {{maximum}}{{{dataType}}}), {{/minimum}} {{^minimum}} - range(max = {{maximum}}), + range(max = {{maximum}}{{{dataType}}}), {{/minimum}} {{/maximum}} {{#minimum}} {{^maximum}} - range(min = {{minimum}}), + range(min = {{minimum}}{{{dataType}}}), {{/maximum}} {{/minimum}} {{#maxItems}} {{#minItems}} - length(min = {{minItems}}, max = {{maxItems}}), + length(min = {{minItems}}usize, max = {{maxItems}}usize), {{/minItems}} {{^minItems}} - length(max = {{maxItems}}), + length(max = {{maxItems}}usize), {{/minItems}} {{/maxItems}} {{^maxItems}} {{#minItems}} - length(min = {{minItems}}), + length(min = {{minItems}}usize), {{/minItems}} {{/maxItems}} )] @@ -115,15 +115,15 @@ use crate::{models, types::*}; #[validate( {{#maxLength}} {{#minLength}} - length(min = {{minLength}}, max = {{maxLength}}), + length(min = {{minLength}}usize, max = {{maxLength}}usize), {{/minLength}} {{^minLength}} - length(max = {{maxLength}}), + length(max = {{maxLength}}usize), {{/minLength}} {{/maxLength}} {{^maxLength}} {{#minLength}} - length(min = {{minLength}}), + length(min = {{minLength}}usize), {{/minLength}} {{/maxLength}} {{#pattern}} @@ -136,28 +136,28 @@ use crate::{models, types::*}; {{/pattern}} {{#maximum}} {{#minimum}} - range(min = {{minimum}}, max = {{maximum}}), + range(min = {{minimum}}{{{dataType}}}, max = {{maximum}}{{{dataType}}}), {{/minimum}} {{^minimum}} - range(max = {{maximum}}), + range(max = {{maximum}}{{{dataType}}}), {{/minimum}} {{/maximum}} {{#minimum}} {{^maximum}} - range(min = {{minimum}}), + range(min = {{minimum}}{{{dataType}}}), {{/maximum}} {{/minimum}} {{#maxItems}} {{#minItems}} - length(min = {{minItems}}, max = {{maxItems}}), + length(min = {{minItems}}usize, max = {{maxItems}}usize), {{/minItems}} {{^minItems}} - length(max = {{maxItems}}), + length(max = {{maxItems}}usize), {{/minItems}} {{/maxItems}} {{^maxItems}} {{#minItems}} - length(min = {{minItems}}), + length(min = {{minItems}}usize), {{/minItems}} {{/maxItems}} )] @@ -219,15 +219,15 @@ use crate::{models, types::*}; #[validate( {{#maxLength}} {{#minLength}} - length(min = {{minLength}}, max = {{maxLength}}), + length(min = {{minLength}}usize, max = {{maxLength}}usize), {{/minLength}} {{^minLength}} - length(max = {{maxLength}}), + length(max = {{maxLength}}usize), {{/minLength}} {{/maxLength}} {{^maxLength}} {{#minLength}} - length(min = {{minLength}}), + length(min = {{minLength}}usize), {{/minLength}} {{/maxLength}} {{#pattern}} @@ -240,28 +240,28 @@ use crate::{models, types::*}; {{/pattern}} {{#maximum}} {{#minimum}} - range(min = {{minimum}}, max = {{maximum}}), + range(min = {{minimum}}{{{dataType}}}, max = {{maximum}}{{{dataType}}}), {{/minimum}} {{^minimum}} - range(max = {{maximum}}), + range(max = {{maximum}}{{{dataType}}}), {{/minimum}} {{/maximum}} {{#minimum}} {{^maximum}} - range(min = {{minimum}}), + range(min = {{minimum}}{{{dataType}}}), {{/maximum}} {{/minimum}} {{#maxItems}} {{#minItems}} - length(min = {{minItems}}, max = {{maxItems}}), + length(min = {{minItems}}usize, max = {{maxItems}}usize), {{/minItems}} {{^minItems}} - length(max = {{maxItems}}), + length(max = {{maxItems}}usize), {{/minItems}} {{/maxItems}} {{^maxItems}} {{#minItems}} - length(min = {{minItems}}), + length(min = {{minItems}}usize), {{/minItems}} {{/maxItems}} )] @@ -623,15 +623,15 @@ pub struct {{{classname}}} { #[validate( {{#maxLength}} {{#minLength}} - length(min = {{minLength}}, max = {{maxLength}}), + length(min = {{minLength}}usize, max = {{maxLength}}usize), {{/minLength}} {{^minLength}} - length(max = {{maxLength}}), + length(max = {{maxLength}}usize), {{/minLength}} {{/maxLength}} {{^maxLength}} {{#minLength}} - length(min = {{minLength}}), + length(min = {{minLength}}usize), {{/minLength}} {{/maxLength}} {{#pattern}} @@ -644,28 +644,28 @@ pub struct {{{classname}}} { {{/pattern}} {{#maximum}} {{#minimum}} - range(min = {{minimum}}, max = {{maximum}}), + range(min = {{minimum}}{{{dataType}}}, max = {{maximum}}{{{dataType}}}), {{/minimum}} {{^minimum}} - range(max = {{maximum}}), + range(max = {{maximum}}{{{dataType}}}), {{/minimum}} {{/maximum}} {{#minimum}} {{^maximum}} - range(min = {{minimum}}), + range(min = {{minimum}}{{{dataType}}}), {{/maximum}} {{/minimum}} {{#maxItems}} {{#minItems}} - length(min = {{minItems}}, max = {{maxItems}}), + length(min = {{minItems}}usize, max = {{maxItems}}usize), {{/minItems}} {{^minItems}} - length(max = {{maxItems}}), + length(max = {{maxItems}}usize), {{/minItems}} {{/maxItems}} {{^maxItems}} {{#minItems}} - length(min = {{minItems}}), + length(min = {{minItems}}usize), {{/minItems}} {{/maxItems}} )] From 5b53d57c0c838ed78a198682c2f2aad6133f9415 Mon Sep 17 00:00:00 2001 From: "victoria.casasampere@beethedata.com" Date: Tue, 19 Nov 2024 07:05:54 +0100 Subject: [PATCH 2/3] Change the literal limits from i32 to adaptive limits --- .../main/resources/rust-axum/models.mustache | 48 +++++++++---------- .../apikey-auths/.openapi-generator/VERSION | 2 +- .../rust-axum/output/apikey-auths/README.md | 2 +- .../multipart-v3/.openapi-generator/VERSION | 2 +- .../rust-axum/output/multipart-v3/README.md | 2 +- .../openapi-v3/.openapi-generator/VERSION | 2 +- .../rust-axum/output/openapi-v3/README.md | 2 +- .../rust-axum/output/openapi-v3/src/models.rs | 8 ++-- .../output/ops-v3/.openapi-generator/VERSION | 2 +- .../rust-axum/output/ops-v3/README.md | 2 +- .../.openapi-generator/VERSION | 2 +- .../README.md | 2 +- .../src/models.rs | 22 ++++----- .../petstore/.openapi-generator/VERSION | 2 +- .../rust-axum/output/petstore/README.md | 2 +- .../rust-axum/output/petstore/src/models.rs | 2 +- .../.openapi-generator/VERSION | 2 +- .../output/ping-bearer-auth/README.md | 2 +- .../.openapi-generator/VERSION | 2 +- .../output/rust-axum-header-uuid/README.md | 2 +- .../rust-axum-test/.openapi-generator/VERSION | 2 +- .../rust-axum/output/rust-axum-test/README.md | 2 +- .../.openapi-generator/VERSION | 2 +- .../rust-axum-validation-test/README.md | 2 +- 24 files changed, 60 insertions(+), 60 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/rust-axum/models.mustache b/modules/openapi-generator/src/main/resources/rust-axum/models.mustache index 7e4a5d07b95b..d0397765f69c 100644 --- a/modules/openapi-generator/src/main/resources/rust-axum/models.mustache +++ b/modules/openapi-generator/src/main/resources/rust-axum/models.mustache @@ -23,15 +23,15 @@ use crate::{models, types::*}; #[validate( {{#maxLength}} {{#minLength}} - length(min = {{minLength}}usize, max = {{maxLength}}usize), + length(min = {{minLength}}, max = {{maxLength}}), {{/minLength}} {{^minLength}} - length(max = {{maxLength}}usize), + length(max = {{maxLength}}), {{/minLength}} {{/maxLength}} {{^maxLength}} {{#minLength}} - length(min = {{minLength}}usize), + length(min = {{minLength}}), {{/minLength}} {{/maxLength}} {{#pattern}} @@ -57,15 +57,15 @@ use crate::{models, types::*}; {{/minimum}} {{#maxItems}} {{#minItems}} - length(min = {{minItems}}usize, max = {{maxItems}}usize), + length(min = {{minItems}}u64, max = {{maxItems}}u64), {{/minItems}} {{^minItems}} - length(max = {{maxItems}}usize), + length(max = {{maxItems}}u64), {{/minItems}} {{/maxItems}} {{^maxItems}} {{#minItems}} - length(min = {{minItems}}usize), + length(min = {{minItems}}u64), {{/minItems}} {{/maxItems}} )] @@ -115,15 +115,15 @@ use crate::{models, types::*}; #[validate( {{#maxLength}} {{#minLength}} - length(min = {{minLength}}usize, max = {{maxLength}}usize), + length(min = {{minLength}}, max = {{maxLength}}), {{/minLength}} {{^minLength}} - length(max = {{maxLength}}usize), + length(max = {{maxLength}}), {{/minLength}} {{/maxLength}} {{^maxLength}} {{#minLength}} - length(min = {{minLength}}usize), + length(min = {{minLength}}), {{/minLength}} {{/maxLength}} {{#pattern}} @@ -149,15 +149,15 @@ use crate::{models, types::*}; {{/minimum}} {{#maxItems}} {{#minItems}} - length(min = {{minItems}}usize, max = {{maxItems}}usize), + length(min = {{minItems}}u64, max = {{maxItems}}u64), {{/minItems}} {{^minItems}} - length(max = {{maxItems}}usize), + length(max = {{maxItems}}u64), {{/minItems}} {{/maxItems}} {{^maxItems}} {{#minItems}} - length(min = {{minItems}}usize), + length(min = {{minItems}}u64), {{/minItems}} {{/maxItems}} )] @@ -219,15 +219,15 @@ use crate::{models, types::*}; #[validate( {{#maxLength}} {{#minLength}} - length(min = {{minLength}}usize, max = {{maxLength}}usize), + length(min = {{minLength}}, max = {{maxLength}}), {{/minLength}} {{^minLength}} - length(max = {{maxLength}}usize), + length(max = {{maxLength}}), {{/minLength}} {{/maxLength}} {{^maxLength}} {{#minLength}} - length(min = {{minLength}}usize), + length(min = {{minLength}}), {{/minLength}} {{/maxLength}} {{#pattern}} @@ -253,15 +253,15 @@ use crate::{models, types::*}; {{/minimum}} {{#maxItems}} {{#minItems}} - length(min = {{minItems}}usize, max = {{maxItems}}usize), + length(min = {{minItems}}u64, max = {{maxItems}}u64), {{/minItems}} {{^minItems}} - length(max = {{maxItems}}usize), + length(max = {{maxItems}}u64), {{/minItems}} {{/maxItems}} {{^maxItems}} {{#minItems}} - length(min = {{minItems}}usize), + length(min = {{minItems}}u64), {{/minItems}} {{/maxItems}} )] @@ -623,15 +623,15 @@ pub struct {{{classname}}} { #[validate( {{#maxLength}} {{#minLength}} - length(min = {{minLength}}usize, max = {{maxLength}}usize), + length(min = {{minLength}}, max = {{maxLength}}), {{/minLength}} {{^minLength}} - length(max = {{maxLength}}usize), + length(max = {{maxLength}}), {{/minLength}} {{/maxLength}} {{^maxLength}} {{#minLength}} - length(min = {{minLength}}usize), + length(min = {{minLength}}), {{/minLength}} {{/maxLength}} {{#pattern}} @@ -657,15 +657,15 @@ pub struct {{{classname}}} { {{/minimum}} {{#maxItems}} {{#minItems}} - length(min = {{minItems}}usize, max = {{maxItems}}usize), + length(min = {{minItems}}u64, max = {{maxItems}}u64), {{/minItems}} {{^minItems}} - length(max = {{maxItems}}usize), + length(max = {{maxItems}}u64), {{/minItems}} {{/maxItems}} {{^maxItems}} {{#minItems}} - length(min = {{minItems}}usize), + length(min = {{minItems}}u64), {{/minItems}} {{/maxItems}} )] diff --git a/samples/server/petstore/rust-axum/output/apikey-auths/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/apikey-auths/.openapi-generator/VERSION index 6935482704c1..884119126398 100644 --- a/samples/server/petstore/rust-axum/output/apikey-auths/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/apikey-auths/.openapi-generator/VERSION @@ -1 +1 @@ -7.10.0-SNAPSHOT +7.11.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/apikey-auths/README.md b/samples/server/petstore/rust-axum/output/apikey-auths/README.md index 3e6003431942..143e1c1b27bb 100644 --- a/samples/server/petstore/rust-axum/output/apikey-auths/README.md +++ b/samples/server/petstore/rust-axum/output/apikey-auths/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 1.0.0 -- Generator version: 7.10.0-SNAPSHOT +- Generator version: 7.11.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/multipart-v3/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/multipart-v3/.openapi-generator/VERSION index 6935482704c1..884119126398 100644 --- a/samples/server/petstore/rust-axum/output/multipart-v3/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/multipart-v3/.openapi-generator/VERSION @@ -1 +1 @@ -7.10.0-SNAPSHOT +7.11.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/multipart-v3/README.md b/samples/server/petstore/rust-axum/output/multipart-v3/README.md index 2fef39669660..4944ebb95cdf 100644 --- a/samples/server/petstore/rust-axum/output/multipart-v3/README.md +++ b/samples/server/petstore/rust-axum/output/multipart-v3/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 1.0.7 -- Generator version: 7.10.0-SNAPSHOT +- Generator version: 7.11.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/openapi-v3/.openapi-generator/VERSION index 6935482704c1..884119126398 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/openapi-v3/.openapi-generator/VERSION @@ -1 +1 @@ -7.10.0-SNAPSHOT +7.11.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/README.md b/samples/server/petstore/rust-axum/output/openapi-v3/README.md index 207b5efcb324..3054fe00af70 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/README.md +++ b/samples/server/petstore/rust-axum/output/openapi-v3/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 1.0.7 -- Generator version: 7.10.0-SNAPSHOT +- Generator version: 7.11.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/src/models.rs b/samples/server/petstore/rust-axum/output/openapi-v3/src/models.rs index 5437c7abd43b..313f13f6420b 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/src/models.rs +++ b/samples/server/petstore/rust-axum/output/openapi-v3/src/models.rs @@ -12,7 +12,7 @@ use crate::{models, types::*}; pub struct AnyOfGetQueryParams { /// list of any of objects #[serde(rename = "any-of")] - #[validate(length(min = 1))] + #[validate(length(min = 1u64))] #[serde(skip_serializing_if = "Option::is_none")] pub any_of: Option>, } @@ -1806,17 +1806,17 @@ pub struct NullableTest { pub nullable_array: Option>>, #[serde(rename = "min_item_test")] - #[validate(length(min = 1))] + #[validate(length(min = 1u64))] #[serde(skip_serializing_if = "Option::is_none")] pub min_item_test: Option>, #[serde(rename = "max_item_test")] - #[validate(length(max = 2))] + #[validate(length(max = 2u64))] #[serde(skip_serializing_if = "Option::is_none")] pub max_item_test: Option>, #[serde(rename = "min_max_item_test")] - #[validate(length(min = 1, max = 3))] + #[validate(length(min = 1u64, max = 3u64))] #[serde(skip_serializing_if = "Option::is_none")] pub min_max_item_test: Option>, } diff --git a/samples/server/petstore/rust-axum/output/ops-v3/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/ops-v3/.openapi-generator/VERSION index 6935482704c1..884119126398 100644 --- a/samples/server/petstore/rust-axum/output/ops-v3/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/ops-v3/.openapi-generator/VERSION @@ -1 +1 @@ -7.10.0-SNAPSHOT +7.11.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/ops-v3/README.md b/samples/server/petstore/rust-axum/output/ops-v3/README.md index 2a5a944ad346..dd0e372a0747 100644 --- a/samples/server/petstore/rust-axum/output/ops-v3/README.md +++ b/samples/server/petstore/rust-axum/output/ops-v3/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 0.0.1 -- Generator version: 7.10.0-SNAPSHOT +- Generator version: 7.11.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/.openapi-generator/VERSION index 6935482704c1..884119126398 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/.openapi-generator/VERSION @@ -1 +1 @@ -7.10.0-SNAPSHOT +7.11.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/README.md b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/README.md index 66f09c3b89f4..abfcfff517be 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/README.md +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 1.0.0 -- Generator version: 7.10.0-SNAPSHOT +- Generator version: 7.11.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/models.rs b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/models.rs index 608d5b3175c0..65d9e95ad9ec 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/models.rs +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/models.rs @@ -115,7 +115,7 @@ pub struct DeleteOrderPathParams { #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct GetOrderByIdPathParams { /// ID of pet that needs to be fetched - #[validate(range(min = 1, max = 5))] + #[validate(range(min = 1i64, max = 5i64))] pub order_id: i64, } @@ -2739,12 +2739,12 @@ impl std::convert::TryFrom for header::IntoHeaderValue { #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct FormatTest { #[serde(rename = "integer")] - #[validate(range(min = 10, max = 100))] + #[validate(range(min = 10u8, max = 100u8))] #[serde(skip_serializing_if = "Option::is_none")] pub integer: Option, #[serde(rename = "int32")] - #[validate(range(min = 20, max = 200))] + #[validate(range(min = 20u8, max = 200u8))] #[serde(skip_serializing_if = "Option::is_none")] pub int32: Option, @@ -2753,16 +2753,16 @@ pub struct FormatTest { pub int64: Option, #[serde(rename = "number")] - #[validate(range(min = 32.1, max = 543.2))] + #[validate(range(min = 32.1f64, max = 543.2f64))] pub number: f64, #[serde(rename = "float")] - #[validate(range(min = 54.3, max = 987.6))] + #[validate(range(min = 54.3f32, max = 987.6f32))] #[serde(skip_serializing_if = "Option::is_none")] pub float: Option, #[serde(rename = "double")] - #[validate(range(min = 67.8, max = 123.4))] + #[validate(range(min = 67.8f64, max = 123.4f64))] #[serde(skip_serializing_if = "Option::is_none")] pub double: Option, @@ -5522,13 +5522,13 @@ impl std::convert::TryFrom for header::IntoHeaderValue { pub struct TestEndpointParametersRequest { /// None #[serde(rename = "integer")] - #[validate(range(min = 10, max = 100))] + #[validate(range(min = 10u8, max = 100u8))] #[serde(skip_serializing_if = "Option::is_none")] pub integer: Option, /// None #[serde(rename = "int32")] - #[validate(range(min = 20, max = 200))] + #[validate(range(min = 20u8, max = 200u8))] #[serde(skip_serializing_if = "Option::is_none")] pub int32: Option, @@ -5539,18 +5539,18 @@ pub struct TestEndpointParametersRequest { /// None #[serde(rename = "number")] - #[validate(range(min = 32.1, max = 543.2))] + #[validate(range(min = 32.1f64, max = 543.2f64))] pub number: f64, /// None #[serde(rename = "float")] - #[validate(range(max = 987.6))] + #[validate(range(max = 987.6f32))] #[serde(skip_serializing_if = "Option::is_none")] pub float: Option, /// None #[serde(rename = "double")] - #[validate(range(min = 67.8, max = 123.4))] + #[validate(range(min = 67.8f64, max = 123.4f64))] pub double: f64, /// None diff --git a/samples/server/petstore/rust-axum/output/petstore/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/petstore/.openapi-generator/VERSION index 6935482704c1..884119126398 100644 --- a/samples/server/petstore/rust-axum/output/petstore/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/petstore/.openapi-generator/VERSION @@ -1 +1 @@ -7.10.0-SNAPSHOT +7.11.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/petstore/README.md b/samples/server/petstore/rust-axum/output/petstore/README.md index bad83d5ef10c..e2f49a93712b 100644 --- a/samples/server/petstore/rust-axum/output/petstore/README.md +++ b/samples/server/petstore/rust-axum/output/petstore/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 1.0.0 -- Generator version: 7.10.0-SNAPSHOT +- Generator version: 7.11.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/petstore/src/models.rs b/samples/server/petstore/rust-axum/output/petstore/src/models.rs index 6a84bb364976..01eb66c5e6e8 100644 --- a/samples/server/petstore/rust-axum/output/petstore/src/models.rs +++ b/samples/server/petstore/rust-axum/output/petstore/src/models.rs @@ -69,7 +69,7 @@ pub struct DeleteOrderPathParams { #[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))] pub struct GetOrderByIdPathParams { /// ID of pet that needs to be fetched - #[validate(range(min = 1, max = 5))] + #[validate(range(min = 1i64, max = 5i64))] pub order_id: i64, } diff --git a/samples/server/petstore/rust-axum/output/ping-bearer-auth/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/ping-bearer-auth/.openapi-generator/VERSION index 6935482704c1..884119126398 100644 --- a/samples/server/petstore/rust-axum/output/ping-bearer-auth/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/ping-bearer-auth/.openapi-generator/VERSION @@ -1 +1 @@ -7.10.0-SNAPSHOT +7.11.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/ping-bearer-auth/README.md b/samples/server/petstore/rust-axum/output/ping-bearer-auth/README.md index 1b64ea5db3ed..5b152c6a4fb2 100644 --- a/samples/server/petstore/rust-axum/output/ping-bearer-auth/README.md +++ b/samples/server/petstore/rust-axum/output/ping-bearer-auth/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 1.0 -- Generator version: 7.10.0-SNAPSHOT +- Generator version: 7.11.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.openapi-generator/VERSION index 6935482704c1..884119126398 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.openapi-generator/VERSION @@ -1 +1 @@ -7.10.0-SNAPSHOT +7.11.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/README.md b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/README.md index c02b2c33f229..56220aaf10fd 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/README.md +++ b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 0.1.9 -- Generator version: 7.10.0-SNAPSHOT +- Generator version: 7.11.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-test/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/rust-axum-test/.openapi-generator/VERSION index 6935482704c1..884119126398 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-test/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/rust-axum-test/.openapi-generator/VERSION @@ -1 +1 @@ -7.10.0-SNAPSHOT +7.11.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-test/README.md b/samples/server/petstore/rust-axum/output/rust-axum-test/README.md index cb953a6fb1ef..17add5a653eb 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-test/README.md +++ b/samples/server/petstore/rust-axum/output/rust-axum-test/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 2.3.4 -- Generator version: 7.10.0-SNAPSHOT +- Generator version: 7.11.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.openapi-generator/VERSION index 6935482704c1..884119126398 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.openapi-generator/VERSION @@ -1 +1 @@ -7.10.0-SNAPSHOT +7.11.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/README.md b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/README.md index a5ce8d3f4103..fbff4455f06b 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/README.md +++ b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 0.0.1 -- Generator version: 7.10.0-SNAPSHOT +- Generator version: 7.11.0-SNAPSHOT From a69aa55357696fc580f68e97714b8d85bbdc7728 Mon Sep 17 00:00:00 2001 From: "victoria.casasampere@beethedata.com" Date: Wed, 20 Nov 2024 04:31:07 +0100 Subject: [PATCH 3/3] Remove length literal types --- .../main/resources/rust-axum/models.mustache | 24 +++++++++---------- .../rust-axum/output/openapi-v3/src/models.rs | 8 +++---- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/rust-axum/models.mustache b/modules/openapi-generator/src/main/resources/rust-axum/models.mustache index d0397765f69c..6c158a02b0b3 100644 --- a/modules/openapi-generator/src/main/resources/rust-axum/models.mustache +++ b/modules/openapi-generator/src/main/resources/rust-axum/models.mustache @@ -57,15 +57,15 @@ use crate::{models, types::*}; {{/minimum}} {{#maxItems}} {{#minItems}} - length(min = {{minItems}}u64, max = {{maxItems}}u64), + length(min = {{minItems}}, max = {{maxItems}}), {{/minItems}} {{^minItems}} - length(max = {{maxItems}}u64), + length(max = {{maxItems}}), {{/minItems}} {{/maxItems}} {{^maxItems}} {{#minItems}} - length(min = {{minItems}}u64), + length(min = {{minItems}}), {{/minItems}} {{/maxItems}} )] @@ -149,15 +149,15 @@ use crate::{models, types::*}; {{/minimum}} {{#maxItems}} {{#minItems}} - length(min = {{minItems}}u64, max = {{maxItems}}u64), + length(min = {{minItems}}, max = {{maxItems}}), {{/minItems}} {{^minItems}} - length(max = {{maxItems}}u64), + length(max = {{maxItems}}), {{/minItems}} {{/maxItems}} {{^maxItems}} {{#minItems}} - length(min = {{minItems}}u64), + length(min = {{minItems}}), {{/minItems}} {{/maxItems}} )] @@ -253,15 +253,15 @@ use crate::{models, types::*}; {{/minimum}} {{#maxItems}} {{#minItems}} - length(min = {{minItems}}u64, max = {{maxItems}}u64), + length(min = {{minItems}}, max = {{maxItems}}), {{/minItems}} {{^minItems}} - length(max = {{maxItems}}u64), + length(max = {{maxItems}}), {{/minItems}} {{/maxItems}} {{^maxItems}} {{#minItems}} - length(min = {{minItems}}u64), + length(min = {{minItems}}), {{/minItems}} {{/maxItems}} )] @@ -657,15 +657,15 @@ pub struct {{{classname}}} { {{/minimum}} {{#maxItems}} {{#minItems}} - length(min = {{minItems}}u64, max = {{maxItems}}u64), + length(min = {{minItems}}, max = {{maxItems}}), {{/minItems}} {{^minItems}} - length(max = {{maxItems}}u64), + length(max = {{maxItems}}), {{/minItems}} {{/maxItems}} {{^maxItems}} {{#minItems}} - length(min = {{minItems}}u64), + length(min = {{minItems}}), {{/minItems}} {{/maxItems}} )] diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/src/models.rs b/samples/server/petstore/rust-axum/output/openapi-v3/src/models.rs index 313f13f6420b..5437c7abd43b 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/src/models.rs +++ b/samples/server/petstore/rust-axum/output/openapi-v3/src/models.rs @@ -12,7 +12,7 @@ use crate::{models, types::*}; pub struct AnyOfGetQueryParams { /// list of any of objects #[serde(rename = "any-of")] - #[validate(length(min = 1u64))] + #[validate(length(min = 1))] #[serde(skip_serializing_if = "Option::is_none")] pub any_of: Option>, } @@ -1806,17 +1806,17 @@ pub struct NullableTest { pub nullable_array: Option>>, #[serde(rename = "min_item_test")] - #[validate(length(min = 1u64))] + #[validate(length(min = 1))] #[serde(skip_serializing_if = "Option::is_none")] pub min_item_test: Option>, #[serde(rename = "max_item_test")] - #[validate(length(max = 2u64))] + #[validate(length(max = 2))] #[serde(skip_serializing_if = "Option::is_none")] pub max_item_test: Option>, #[serde(rename = "min_max_item_test")] - #[validate(length(min = 1u64, max = 3u64))] + #[validate(length(min = 1, max = 3))] #[serde(skip_serializing_if = "Option::is_none")] pub min_max_item_test: Option>, }