@@ -2,7 +2,6 @@ use schemars::JsonSchema;
2
2
3
3
use serde:: { Deserialize , Serialize } ;
4
4
5
- use std:: collections:: HashMap ;
6
5
use std:: string:: String ;
7
6
8
7
use toml:: Value as TomlValue ;
@@ -16,39 +15,7 @@ impl JsonSchema for TomlValueWrapper {
16
15
}
17
16
18
17
fn json_schema ( gen : & mut schemars:: gen:: SchemaGenerator ) -> schemars:: schema:: Schema {
19
- use schemars:: schema:: * ;
20
-
21
- SchemaObject {
22
- instance_type : Some ( InstanceType :: Object . into ( ) ) ,
23
- object : Some ( Box :: new ( ObjectValidation {
24
- properties : [
25
- (
26
- "string" . to_string ( ) ,
27
- gen. subschema_for :: < std:: string:: String > ( ) ,
28
- ) ,
29
- ( "integer" . to_string ( ) , gen. subschema_for :: < i64 > ( ) ) ,
30
- ( "float" . to_string ( ) , gen. subschema_for :: < f64 > ( ) ) ,
31
- ( "boolean" . to_string ( ) , gen. subschema_for :: < bool > ( ) ) ,
32
- (
33
- "datetime" . to_string ( ) ,
34
- gen. subschema_for :: < std:: string:: String > ( ) ,
35
- ) , // Assuming datetime is represented as a string
36
- (
37
- "array" . to_string ( ) ,
38
- gen. subschema_for :: < Vec < TomlValueWrapper > > ( ) ,
39
- ) ,
40
- (
41
- "table" . to_string ( ) ,
42
- gen. subschema_for :: < HashMap < std:: string:: String , TomlValueWrapper > > ( ) ,
43
- ) ,
44
- ]
45
- . iter ( )
46
- . cloned ( )
47
- . collect ( ) ,
48
- ..Default :: default ( )
49
- } ) ) ,
50
- ..Default :: default ( )
51
- }
52
- . into ( )
18
+ // HACK: this is both more and less permissive than `TomlValue` but its close
19
+ gen. subschema_for :: < serde_json:: Value > ( ) . into ( )
53
20
}
54
21
}
0 commit comments