#![allow(dead_code)] use rschema::{ Schema, Schematic, }; use std::collections::{ HashMap, HashSet, }; #[derive(Debug, Schematic)] struct OtherProperties { #[rschema(title = "Option")] prop_option: Option, #[rschema(title = "Box")] prop_box: Box, #[rschema(title = "HashMap")] prop_hashmap: HashMap, #[rschema(title = "HashSet")] prop_hashset: HashSet, } #[test] fn it_tests_other_properties() -> rschema::Result<()> { let schema_str = Schema::new::("Other Properties") .to_string_pretty()?; let schema_str2 = r#"{ "title": "Other Properties", "type": "object", "properties": { "prop_option": { "title": "Option", "anyOf": [ { "type": "number" }, { "type": "null" } ] }, "prop_box": { "title": "Box", "type": "number" }, "prop_hashmap": { "title": "HashMap", "type": "object", "properties": {}, "additionalProperties": { "type": "number" } }, "prop_hashset": { "title": "HashSet", "type": "array", "items": { "type": "number" }, "uniqueItems": true } }, "additionalProperties": false }"#; assert_eq!(schema_str, schema_str2); Ok(()) }