feat: move all json and validate to new utils

This commit is contained in:
Zomatree
2025-08-15 02:07:25 +01:00
parent 3d6f39a0eb
commit cf4fe859bf
83 changed files with 371 additions and 451 deletions
+27
View File
@@ -0,0 +1,27 @@
pub mod json;
pub mod validator;
pub use json::Json;
pub use validator::Validate;
#[macro_export]
macro_rules! fn_request_body {
($gen:ident, $ty:path, $mime_type:expr) => {{
let schema = $gen.json_schema::<$ty>();
Ok(revolt_rocket_okapi::revolt_okapi::openapi3::RequestBody {
content: {
let mut map = revolt_rocket_okapi::revolt_okapi::Map::new();
map.insert(
$mime_type.to_owned(),
revolt_rocket_okapi::revolt_okapi::openapi3::MediaType {
schema: Some(schema),
..Default::default()
},
);
map
},
required: true,
..Default::default()
})
}};
}