support u64

This commit is contained in:
Joshua M. Clulow 2021-07-01 08:41:27 +00:00
parent c4c1bc02bc
commit 445b96056e
1 changed files with 13 additions and 6 deletions

View File

@ -188,13 +188,20 @@ impl ParameterDataExt for openapiv3::ParameterData {
}
SchemaKind::Type(Type::Integer(it)) => {
let mut uint;
let width;
use openapiv3::VariantOrUnknownOrEmpty::Unknown;
if let Unknown(f) = &it.format {
if f == "uint" {
uint = true;
} else {
bail!("XXX unknown integer format {}", f);
match f.as_str() {
"uint" | "uint32" => {
uint = true;
width = 32;
}
"uint64" => {
uint = true;
width = 32;
}
f => bail!("XXX unknown integer format {}", f),
}
} else {
bail!("XXX format {:?}", it.format);
@ -222,9 +229,9 @@ impl ParameterDataExt for openapiv3::ParameterData {
bail!("XXX enumeration");
}
if uint {
"u64".to_string()
format!("u{}", width)
} else {
"i64".to_string()
format!("i{}", width)
}
}
x => bail!("unexpected type {:#?}", x),