#[doc(hidden)]
#[macro_export]
macro_rules! parameters_json_schema {
($($name:ident: $type:ty),* $(,)?) => {{
let mut properties = serde_json::Map::new();
$(
let property = match stringify!($type) {
"String" => json!({
"type": "string"
}),
"i32" | "i64" | "u64" | "u32" => json!({
"type": "number"
}),
"bool" => json!({
"type": "boolean"
}),
s if s.starts_with("Vec<") && s.ends_with(">") => {
let inner_type_str = &s[4..s.len() - 1];
let inner_type = match inner_type_str {
"String" => json!({
"type": "string"
}),
"i32" | "i64" | "u64" | "u32" => json!({
"type": "number"
}),
"bool" => json!({
"type": "boolean"
}),
_ => json!({
"type": "object"
}),
};
json!({
"type": "array",
"items": inner_type
})
}
_ => {
json!({
"type": "object"
})
}
};
properties.insert(stringify!($name).to_string(), property);
)*
json!({
"type": "object",
"properties": properties,
})
}};
}