Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rust] Fixed compiler errors for decimal types #20708

Merged
merged 1 commit into from
Feb 22, 2025
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 @@ -206,6 +206,8 @@ public RustClientCodegen() {
typeMapping.put("date", "string");
typeMapping.put("DateTime", "String");
typeMapping.put("password", "String");
typeMapping.put("decimal", "String");

// TODO(bcourtine): review file mapping.
// I tried to map as "std::io::File", but Reqwest multipart file requires a "AsRef<Path>" param.
// Getting a file from a Path is simple, but the opposite is difficult. So I map as "std::path::Path".
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,7 @@ components:
- boolean
- uuid
- bytes
- decimal
properties:
int32:
type: integer
Expand All @@ -894,6 +895,9 @@ components:
bytes:
type: string
format: byte
decimal:
type: string
format: number
Return:
description: Test using keywords
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Name | Type | Description | Notes
**boolean** | **bool** | |
**uuid** | [**uuid::Uuid**](uuid::Uuid.md) | |
**bytes** | **String** | |
**decimal** | **String** | |

[[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 @@ -34,11 +34,13 @@ pub struct TypeTesting {
#[serde_as(as = "serde_with::base64::Base64")]
#[serde(rename = "bytes")]
pub bytes: Vec<u8>,
#[serde(rename = "decimal")]
pub decimal: String,
}

impl TypeTesting {
/// Test handling of different field data types
pub fn new(int32: i32, int64: i64, float: f32, double: f64, string: String, boolean: bool, uuid: uuid::Uuid, bytes: Vec<u8>) -> TypeTesting {
pub fn new(int32: i32, int64: i64, float: f32, double: f64, string: String, boolean: bool, uuid: uuid::Uuid, bytes: Vec<u8>, decimal: String) -> TypeTesting {
TypeTesting {
int32,
int64,
Expand All @@ -48,6 +50,7 @@ impl TypeTesting {
boolean,
uuid,
bytes,
decimal,
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Name | Type | Description | Notes
**boolean** | **bool** | |
**uuid** | [**uuid::Uuid**](uuid::Uuid.md) | |
**bytes** | **String** | |
**decimal** | **String** | |

[[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 @@ -34,11 +34,13 @@ pub struct TypeTesting {
#[serde_as(as = "serde_with::base64::Base64")]
#[serde(rename = "bytes")]
pub bytes: Vec<u8>,
#[serde(rename = "decimal")]
pub decimal: String,
}

impl TypeTesting {
/// Test handling of different field data types
pub fn new(int32: i32, int64: i64, float: f32, double: f64, string: String, boolean: bool, uuid: uuid::Uuid, bytes: Vec<u8>) -> TypeTesting {
pub fn new(int32: i32, int64: i64, float: f32, double: f64, string: String, boolean: bool, uuid: uuid::Uuid, bytes: Vec<u8>, decimal: String) -> TypeTesting {
TypeTesting {
int32,
int64,
Expand All @@ -48,6 +50,7 @@ impl TypeTesting {
boolean,
uuid,
bytes,
decimal,
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Name | Type | Description | Notes
**boolean** | **bool** | |
**uuid** | [**uuid::Uuid**](uuid::Uuid.md) | |
**bytes** | **String** | |
**decimal** | **String** | |

[[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 @@ -34,11 +34,13 @@ pub struct TypeTesting {
#[serde_as(as = "serde_with::base64::Base64")]
#[serde(rename = "bytes")]
pub bytes: Vec<u8>,
#[serde(rename = "decimal")]
pub decimal: String,
}

impl TypeTesting {
/// Test handling of different field data types
pub fn new(int32: i32, int64: i64, float: f32, double: f64, string: String, boolean: bool, uuid: uuid::Uuid, bytes: Vec<u8>) -> TypeTesting {
pub fn new(int32: i32, int64: i64, float: f32, double: f64, string: String, boolean: bool, uuid: uuid::Uuid, bytes: Vec<u8>, decimal: String) -> TypeTesting {
TypeTesting {
int32,
int64,
Expand All @@ -48,6 +50,7 @@ impl TypeTesting {
boolean,
uuid,
bytes,
decimal,
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Name | Type | Description | Notes
**boolean** | **bool** | |
**uuid** | [**uuid::Uuid**](uuid::Uuid.md) | |
**bytes** | **String** | |
**decimal** | **String** | |

[[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 @@ -34,11 +34,13 @@ pub struct TypeTesting {
#[serde_as(as = "serde_with::base64::Base64")]
#[serde(rename = "bytes")]
pub bytes: Vec<u8>,
#[serde(rename = "decimal")]
pub decimal: String,
}

impl TypeTesting {
/// Test handling of different field data types
pub fn new(int32: i32, int64: i64, float: f32, double: f64, string: String, boolean: bool, uuid: uuid::Uuid, bytes: Vec<u8>) -> TypeTesting {
pub fn new(int32: i32, int64: i64, float: f32, double: f64, string: String, boolean: bool, uuid: uuid::Uuid, bytes: Vec<u8>, decimal: String) -> TypeTesting {
TypeTesting {
int32,
int64,
Expand All @@ -48,6 +50,7 @@ impl TypeTesting {
boolean,
uuid,
bytes,
decimal,
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Name | Type | Description | Notes
**boolean** | **bool** | |
**uuid** | [**uuid::Uuid**](uuid::Uuid.md) | |
**bytes** | **String** | |
**decimal** | **String** | |

[[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 @@ -34,11 +34,13 @@ pub struct TypeTesting {
#[serde_as(as = "serde_with::base64::Base64")]
#[serde(rename = "bytes")]
pub bytes: Vec<u8>,
#[serde(rename = "decimal")]
pub decimal: String,
}

impl TypeTesting {
/// Test handling of different field data types
pub fn new(int32: i32, int64: i64, float: f32, double: f64, string: String, boolean: bool, uuid: uuid::Uuid, bytes: Vec<u8>) -> TypeTesting {
pub fn new(int32: i32, int64: i64, float: f32, double: f64, string: String, boolean: bool, uuid: uuid::Uuid, bytes: Vec<u8>, decimal: String) -> TypeTesting {
TypeTesting {
int32,
int64,
Expand All @@ -48,6 +50,7 @@ impl TypeTesting {
boolean,
uuid,
bytes,
decimal,
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Name | Type | Description | Notes
**boolean** | **bool** | |
**uuid** | [**uuid::Uuid**](uuid::Uuid.md) | |
**bytes** | **String** | |
**decimal** | **String** | |

[[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 @@ -34,11 +34,13 @@ pub struct TypeTesting {
#[serde_as(as = "serde_with::base64::Base64")]
#[serde(rename = "bytes")]
pub bytes: Vec<u8>,
#[serde(rename = "decimal")]
pub decimal: String,
}

impl TypeTesting {
/// Test handling of different field data types
pub fn new(int32: i32, int64: i64, float: f32, double: f64, string: String, boolean: bool, uuid: uuid::Uuid, bytes: Vec<u8>) -> TypeTesting {
pub fn new(int32: i32, int64: i64, float: f32, double: f64, string: String, boolean: bool, uuid: uuid::Uuid, bytes: Vec<u8>, decimal: String) -> TypeTesting {
TypeTesting {
int32,
int64,
Expand All @@ -48,6 +50,7 @@ impl TypeTesting {
boolean,
uuid,
bytes,
decimal,
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Name | Type | Description | Notes
**boolean** | **bool** | |
**uuid** | [**uuid::Uuid**](uuid::Uuid.md) | |
**bytes** | **String** | |
**decimal** | **String** | |

[[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 @@ -34,11 +34,13 @@ pub struct TypeTesting {
#[serde_as(as = "serde_with::base64::Base64")]
#[serde(rename = "bytes")]
pub bytes: Vec<u8>,
#[serde(rename = "decimal")]
pub decimal: String,
}

impl TypeTesting {
/// Test handling of different field data types
pub fn new(int32: i32, int64: i64, float: f32, double: f64, string: String, boolean: bool, uuid: uuid::Uuid, bytes: Vec<u8>) -> TypeTesting {
pub fn new(int32: i32, int64: i64, float: f32, double: f64, string: String, boolean: bool, uuid: uuid::Uuid, bytes: Vec<u8>, decimal: String) -> TypeTesting {
TypeTesting {
int32,
int64,
Expand All @@ -48,6 +50,7 @@ impl TypeTesting {
boolean,
uuid,
bytes,
decimal,
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Name | Type | Description | Notes
**boolean** | **bool** | |
**uuid** | [**uuid::Uuid**](uuid::Uuid.md) | |
**bytes** | **String** | |
**decimal** | **String** | |

[[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 @@ -34,11 +34,13 @@ pub struct TypeTesting {
#[serde_as(as = "serde_with::base64::Base64")]
#[serde(rename = "bytes")]
pub bytes: Vec<u8>,
#[serde(rename = "decimal")]
pub decimal: String,
}

impl TypeTesting {
/// Test handling of different field data types
pub fn new(int32: i32, int64: i64, float: f32, double: f64, string: String, boolean: bool, uuid: uuid::Uuid, bytes: Vec<u8>) -> TypeTesting {
pub fn new(int32: i32, int64: i64, float: f32, double: f64, string: String, boolean: bool, uuid: uuid::Uuid, bytes: Vec<u8>, decimal: String) -> TypeTesting {
TypeTesting {
int32,
int64,
Expand All @@ -48,6 +50,7 @@ impl TypeTesting {
boolean,
uuid,
bytes,
decimal,
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Name | Type | Description | Notes
**boolean** | **bool** | |
**uuid** | [**uuid::Uuid**](uuid::Uuid.md) | |
**bytes** | **String** | |
**decimal** | **String** | |

[[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 @@ -34,11 +34,13 @@ pub struct FooTypeTesting {
#[serde_as(as = "serde_with::base64::Base64")]
#[serde(rename = "bytes")]
pub bytes: Vec<u8>,
#[serde(rename = "decimal")]
pub decimal: String,
}

impl FooTypeTesting {
/// Test handling of different field data types
pub fn new(int32: i32, int64: i64, float: f32, double: f64, string: String, boolean: bool, uuid: uuid::Uuid, bytes: Vec<u8>) -> FooTypeTesting {
pub fn new(int32: i32, int64: i64, float: f32, double: f64, string: String, boolean: bool, uuid: uuid::Uuid, bytes: Vec<u8>, decimal: String) -> FooTypeTesting {
FooTypeTesting {
int32,
int64,
Expand All @@ -48,6 +50,7 @@ impl FooTypeTesting {
boolean,
uuid,
bytes,
decimal,
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Name | Type | Description | Notes
**boolean** | **bool** | |
**uuid** | [**uuid::Uuid**](uuid::Uuid.md) | |
**bytes** | **String** | |
**decimal** | **String** | |

[[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 @@ -34,11 +34,13 @@ pub struct TypeTesting {
#[serde_as(as = "serde_with::base64::Base64")]
#[serde(rename = "bytes")]
pub bytes: Vec<u8>,
#[serde(rename = "decimal")]
pub decimal: String,
}

impl TypeTesting {
/// Test handling of different field data types
pub fn new(int32: i32, int64: i64, float: f32, double: f64, string: String, boolean: bool, uuid: uuid::Uuid, bytes: Vec<u8>) -> TypeTesting {
pub fn new(int32: i32, int64: i64, float: f32, double: f64, string: String, boolean: bool, uuid: uuid::Uuid, bytes: Vec<u8>, decimal: String) -> TypeTesting {
TypeTesting {
int32,
int64,
Expand All @@ -48,6 +50,7 @@ impl TypeTesting {
boolean,
uuid,
bytes,
decimal,
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ fn test_types() {
string: String::from("something"),
boolean: true,
uuid: Uuid::new_v4(),
bytes: vec![1,2,3,4]
bytes: vec![1, 2, 3, 4],
decimal: String::from("foo"),
};
assert_eq!(type_of(tt.int32), "i32");
assert_eq!(type_of(tt.int64), "i64");
Expand All @@ -22,6 +23,7 @@ fn test_types() {
assert_eq!(type_of(tt.string), "alloc::string::String");
assert_eq!(type_of(tt.boolean), "bool");
assert_eq!(type_of(tt.uuid), "uuid::Uuid");
assert_eq!(type_of(tt.decimal), "alloc::string::String");
}

fn type_of<T>(_: T) -> &'static str {
Expand Down
Loading