summaryrefslogtreecommitdiffstats
path: root/generator
diff options
context:
space:
mode:
Diffstat (limited to 'generator')
-rw-r--r--generator/src/main.rs6
-rw-r--r--generator/src/methods.rs6
-rw-r--r--generator/src/structs.rs16
3 files changed, 20 insertions, 8 deletions
diff --git a/generator/src/main.rs b/generator/src/main.rs
index 5d9d2c7..f69df2d 100644
--- a/generator/src/main.rs
+++ b/generator/src/main.rs
@@ -94,8 +94,10 @@ fn schema_type_name(
}
.to_string(),
Primitive::Integer => match schema.format.as_deref() {
- Some("int32") => "u32",
- Some("int64") => "u64",
+ Some("uint32") => "u32",
+ Some("uint64") => "u64",
+ Some("int32") => "i32",
+ Some("int64") => "i64",
_ => "u32",
}
.to_string(),
diff --git a/generator/src/methods.rs b/generator/src/methods.rs
index 6877437..75bb7db 100644
--- a/generator/src/methods.rs
+++ b/generator/src/methods.rs
@@ -222,8 +222,10 @@ pub fn param_type_inner(
}
.into(),
ParameterType::Integer => match format.as_deref() {
- Some("int32") => "u32",
- Some("int64") => "u64",
+ Some("uint32") => "u32",
+ Some("uint64") => "u64",
+ Some("int32") => "i32",
+ Some("int64") => "i64",
_ => "u32",
}
.into(),
diff --git a/generator/src/structs.rs b/generator/src/structs.rs
index 6a74dc1..4bd4418 100644
--- a/generator/src/structs.rs
+++ b/generator/src/structs.rs
@@ -547,12 +547,18 @@ fn create_header_struct(
}
},
ParameterType::Integer => match header.format.as_deref() {
- Some("int64") => {
+ Some("uint64") => {
imp.push_str("s.parse::<u64>().map_err(|_| StructureError::HeaderParseFailed)")
}
- Some("int32") | _ => {
+ Some("uint32") => {
imp.push_str("s.parse::<u32>().map_err(|_| StructureError::HeaderParseFailed)")
}
+ Some("int64") => {
+ imp.push_str("s.parse::<i64>().map_err(|_| StructureError::HeaderParseFailed)")
+ }
+ Some("int32") | _ => {
+ imp.push_str("s.parse::<i32>().map_err(|_| StructureError::HeaderParseFailed)")
+ }
},
ParameterType::Boolean => {
imp.push_str("s.parse::<bool>().map_err(|_| StructureError::HeaderParseFailed)")
@@ -584,8 +590,10 @@ fn create_header_struct(
Some("double") | _ => "s.parse::<f64>()).collect::<Result<Vec<_>, _>>().map_err(|_| StructureError::HeaderParseFailed)",
},
ParameterType::Integer => match items.format.as_deref() {
- Some("int64") => "s.parse::<u64>()).collect::<Result<Vec<_>, _>>().map_err(|_| StructureError::HeaderParseFailed)",
- Some("int32") | _ => "s.parse::<u32>()).collect::<Result<Vec<_>, _>>().map_err(|_| StructureError::HeaderParseFailed)",
+ Some("uint64") => "s.parse::<u64>()).collect::<Result<Vec<_>, _>>().map_err(|_| StructureError::HeaderParseFailed)",
+ Some("uint32") => "s.parse::<u32>()).collect::<Result<Vec<_>, _>>().map_err(|_| StructureError::HeaderParseFailed)",
+ Some("int64") => "s.parse::<i64>()).collect::<Result<Vec<_>, _>>().map_err(|_| StructureError::HeaderParseFailed)",
+ Some("int32") | _ => "s.parse::<i32>()).collect::<Result<Vec<_>, _>>().map_err(|_| StructureError::HeaderParseFailed)",
},
ParameterType::Boolean => "s.parse::<bool>()).collect::<Result<Vec<_>, _>>().map_err(|_| StructureError::HeaderParseFailed)",
ParameterType::Array => eyre::bail!("nested arrays not supported in headers"),