forked from loafle/openapi-generator-original
[rust] fixed compiler errors for decimal types (#20708)
This commit is contained in:
parent
0ff8c46595
commit
28c7b9b956
@ -206,6 +206,8 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon
|
||||
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".
|
||||
|
@ -871,6 +871,7 @@ components:
|
||||
- boolean
|
||||
- uuid
|
||||
- bytes
|
||||
- decimal
|
||||
properties:
|
||||
int32:
|
||||
type: integer
|
||||
@ -894,6 +895,9 @@ components:
|
||||
bytes:
|
||||
type: string
|
||||
format: byte
|
||||
decimal:
|
||||
type: string
|
||||
format: number
|
||||
Return:
|
||||
description: Test using keywords
|
||||
type: object
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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,
|
||||
@ -48,6 +50,7 @@ impl TypeTesting {
|
||||
boolean,
|
||||
uuid,
|
||||
bytes,
|
||||
decimal,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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,
|
||||
@ -48,6 +50,7 @@ impl TypeTesting {
|
||||
boolean,
|
||||
uuid,
|
||||
bytes,
|
||||
decimal,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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,
|
||||
@ -48,6 +50,7 @@ impl TypeTesting {
|
||||
boolean,
|
||||
uuid,
|
||||
bytes,
|
||||
decimal,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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,
|
||||
@ -48,6 +50,7 @@ impl TypeTesting {
|
||||
boolean,
|
||||
uuid,
|
||||
bytes,
|
||||
decimal,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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,
|
||||
@ -48,6 +50,7 @@ impl TypeTesting {
|
||||
boolean,
|
||||
uuid,
|
||||
bytes,
|
||||
decimal,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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,
|
||||
@ -48,6 +50,7 @@ impl TypeTesting {
|
||||
boolean,
|
||||
uuid,
|
||||
bytes,
|
||||
decimal,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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,
|
||||
@ -48,6 +50,7 @@ impl TypeTesting {
|
||||
boolean,
|
||||
uuid,
|
||||
bytes,
|
||||
decimal,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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,
|
||||
@ -48,6 +50,7 @@ impl TypeTesting {
|
||||
boolean,
|
||||
uuid,
|
||||
bytes,
|
||||
decimal,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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,
|
||||
@ -48,6 +50,7 @@ impl FooTypeTesting {
|
||||
boolean,
|
||||
uuid,
|
||||
bytes,
|
||||
decimal,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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,
|
||||
@ -48,6 +50,7 @@ impl TypeTesting {
|
||||
boolean,
|
||||
uuid,
|
||||
bytes,
|
||||
decimal,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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");
|
||||
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user