architect_api/utils/
json_schema.rs

1#[macro_export]
2macro_rules! json_schema_is_string {
3    ($type:ident) => {
4        impl schemars::JsonSchema for $type {
5            fn schema_name() -> String {
6                stringify!($type).to_owned()
7            }
8
9            fn json_schema(
10                _gen: &mut schemars::gen::SchemaGenerator,
11            ) -> schemars::schema::Schema {
12                schemars::schema::SchemaObject {
13                    instance_type: Some(schemars::schema::InstanceType::String.into()),
14                    ..Default::default()
15                }
16                .into()
17            }
18
19            fn is_referenceable() -> bool {
20                true
21            }
22        }
23    };
24}