| 1 | #![no_std] |
| 2 | |
| 3 | use schemarsrust-analyzer cargo schemars 1.2.2 crate/::{schema_forrust-analyzer cargo schemars 1.2.2 macros/schema_for!, JsonSchemarust-analyzer cargo schemars 1.2.2 JsonSchema#}; |
| 4 | |
| 5 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(JsonSchemarust-analyzer cargo schemars_derive 1.2.2 JsonSchema:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 6 | pub struct MyStructrust-analyzer cargo schemars 1.2.2 MyStruct# { |
| 7 | /// A number |
| 8 | pub my_intrust-analyzer cargo schemars 1.2.2 MyStruct#my_int.: i32, |
| 9 | #[schemarsrust-analyzer cargo schemars_derive 1.2.2 schemars:(extend("x-test" = {"k": "v"}))] |
| 10 | pub my_boolrust-analyzer cargo schemars 1.2.2 MyStruct#my_bool.: bool, |
| 11 | pub my_nullable_enumrust-analyzer cargo schemars 1.2.2 MyStruct#my_nullable_enum.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<MyEnumrust-analyzer cargo schemars 1.2.2 MyEnum#>, |
| 12 | } |
| 13 | |
| 14 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(JsonSchemarust-analyzer cargo schemars_derive 1.2.2 JsonSchema:)] |
| 15 | pub enum MyEnumrust-analyzer cargo schemars 1.2.2 MyEnum# { |
| 16 | StringNewTyperust-analyzer cargo schemars 1.2.2 MyEnum#StringNewType#(&'static str), |
| 17 | StructVariantrust-analyzer cargo schemars 1.2.2 MyEnum#StructVariant# { floatsrust-analyzer cargo schemars 1.2.2 MyEnum#StructVariant#floats.: &'static [f32] }, |
| 18 | } |
| 19 | |
| 20 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 21 | fn test_no_stdrust-analyzer cargo schemars 1.2.2 test_no_std().() { |
| 22 | let _schema = schema_forrust-analyzer cargo schemars 1.2.2 macros/schema_for!!(MyStructrust-analyzer cargo schemars 1.2.2 MyStruct#); |
| 23 | } |