| 1 | #![no_std] |
| 2 | |
| 3 | use schemars::{schema_for, JsonSchema}; |
| 4 | |
| 5 | #[derive(JsonSchema, Default)] |
| 6 | pub struct MyStruct { |
| 7 | /// A number |
| 8 | pub my_int: i32, |
| 9 | #[schemars(extend("x-test" = {"k": "v"}))] |
| 10 | pub my_bool: bool, |
| 11 | pub my_nullable_enum: Option<MyEnum>, |
| 12 | } |
| 13 | |
| 14 | #[derive(JsonSchema)] |
| 15 | pub enum MyEnum { |
| 16 | StringNewType(&'static str), |
| 17 | StructVariant { floats: &'static [f32] }, |
| 18 | } |
| 19 | |
| 20 | #[test] |
| 21 | fn test_no_std() { |
| 22 | let _schema = schema_for!(MyStruct); |
| 23 | } |