Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1941,15 +1941,15 @@ private static void setNumericValidations(Schema schema, BigDecimal multipleOf,
if (multipleOf != null) target.setMultipleOf(multipleOf);
if (minimum != null) {
if (isIntegerSchema(schema)) {
target.setMinimum(String.valueOf(minimum.longValue()));
target.setMinimum(String.valueOf(minimum.toBigInteger()));
} else {
target.setMinimum(String.valueOf(minimum));
}
if (exclusiveMinimum != null) target.setExclusiveMinimum(exclusiveMinimum);
}
if (maximum != null) {
if (isIntegerSchema(schema)) {
target.setMaximum(String.valueOf(maximum.longValue()));
target.setMaximum(String.valueOf(maximum.toBigInteger()));
} else {
target.setMaximum(String.valueOf(maximum));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,15 +312,15 @@ 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}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,9 @@ components:
type: boolean
optionalParam:
type: integer
minimum: 1
maximum: 10000000000000000000
example: 100
ObjectHeader:
type: object
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,11 +735,14 @@ components:
ObjectParam:
example:
requiredParam: true
optionalParam: 0
optionalParam: 100
properties:
requiredParam:
type: boolean
optionalParam:
example: 100
maximum: 10000000000000000000
minimum: 1
type: integer
required:
- requiredParam
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**required_param** | **bool** | |
**optional_param** | **i32** | | [optional] [default to None]
**optional_param** | **u64** | | [optional] [default to None]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3597,8 +3597,11 @@ pub struct ObjectParam {
pub required_param: bool,

#[serde(rename = "optionalParam")]
#[validate(
range(min = 1, max = 10000000000000000000),
)]
#[serde(skip_serializing_if="Option::is_none")]
pub optional_param: Option<i32>,
pub optional_param: Option<u64>,

}

Expand Down Expand Up @@ -3645,7 +3648,7 @@ impl std::str::FromStr for ObjectParam {
#[allow(dead_code)]
struct IntermediateRep {
pub required_param: Vec<bool>,
pub optional_param: Vec<i32>,
pub optional_param: Vec<u64>,
}

let mut intermediate_rep = IntermediateRep::default();
Expand All @@ -3666,7 +3669,7 @@ impl std::str::FromStr for ObjectParam {
#[allow(clippy::redundant_clone)]
"requiredParam" => intermediate_rep.required_param.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
#[allow(clippy::redundant_clone)]
"optionalParam" => intermediate_rep.optional_param.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
"optionalParam" => intermediate_rep.optional_param.push(<u64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
_ => return std::result::Result::Err("Unexpected key while parsing ObjectParam".to_string())
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,11 +735,14 @@ components:
ObjectParam:
example:
requiredParam: true
optionalParam: 0
optionalParam: 100
properties:
requiredParam:
type: boolean
optionalParam:
example: 100
maximum: 10000000000000000000
minimum: 1
type: integer
required:
- requiredParam
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**required_param** | **bool** | |
**optional_param** | **i32** | | [optional] [default to None]
**optional_param** | **u64** | | [optional] [default to None]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3597,8 +3597,11 @@ pub struct ObjectParam {
pub required_param: bool,

#[serde(rename = "optionalParam")]
#[validate(
range(min = 1u64, max = 10000000000000000000u64),
)]
#[serde(skip_serializing_if="Option::is_none")]
pub optional_param: Option<i32>,
pub optional_param: Option<u64>,

}

Expand Down Expand Up @@ -3645,7 +3648,7 @@ impl std::str::FromStr for ObjectParam {
#[allow(dead_code)]
struct IntermediateRep {
pub required_param: Vec<bool>,
pub optional_param: Vec<i32>,
pub optional_param: Vec<u64>,
}

let mut intermediate_rep = IntermediateRep::default();
Expand All @@ -3666,7 +3669,7 @@ impl std::str::FromStr for ObjectParam {
#[allow(clippy::redundant_clone)]
"requiredParam" => intermediate_rep.required_param.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
#[allow(clippy::redundant_clone)]
"optionalParam" => intermediate_rep.optional_param.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
"optionalParam" => intermediate_rep.optional_param.push(<u64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
_ => return std::result::Result::Err("Unexpected key while parsing ObjectParam".to_string())
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3857,14 +3857,14 @@ impl FindPetsByStatusStatusParameterInner {
pub struct FormatTest {
#[serde(rename = "integer")]
#[validate(
range(min = 10, max = 100),
range(min = 10u8, max = 100u8),
)]
#[serde(skip_serializing_if="Option::is_none")]
pub integer: Option<u8>,

#[serde(rename = "int32")]
#[validate(
range(min = 20, max = 200),
range(min = 20u32, max = 200u32),
)]
#[serde(skip_serializing_if="Option::is_none")]
pub int32: Option<u32>,
Expand All @@ -3875,20 +3875,20 @@ pub struct FormatTest {

#[serde(rename = "number")]
#[validate(
range(min = 32.1, max = 543.2),
range(min = 32.1f64, max = 543.2f64),
)]
pub number: f64,

#[serde(rename = "float")]
#[validate(
range(min = 54.3, max = 987.6),
range(min = 54.3f32, max = 987.6f32),
)]
#[serde(skip_serializing_if="Option::is_none")]
pub float: Option<f32>,

#[serde(rename = "double")]
#[validate(
range(min = 67.8, max = 123.4),
range(min = 67.8f64, max = 123.4f64),
)]
#[serde(skip_serializing_if="Option::is_none")]
pub double: Option<f64>,
Expand Down
Loading