File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,12 @@ readme = "README.md"
1010keywords = [" serde" , " wasm" ]
1111license = " MIT"
1212
13+ [features ]
14+ json_schema = []
15+
1316[dependencies ]
1417serde = " ^1.0.0"
18+ schemars = { version = " 0.8.11" , default-features = false , cfg = " feature = \" json_schema\" " }
1519
1620[dev-dependencies ]
1721serde_derive = " ^1.0.0"
Original file line number Diff line number Diff line change @@ -113,6 +113,17 @@ impl Ord for Value {
113113 }
114114}
115115
116+ #[ cfg( feature = "json_schema" ) ]
117+ impl schemars:: JsonSchema for Value {
118+ fn schema_name ( ) -> String {
119+ "JSON" . to_string ( )
120+ }
121+
122+ fn json_schema ( gen : & mut schemars:: gen:: SchemaGenerator ) -> schemars:: schema:: Schema {
123+ schemars:: schema:: Schema :: from ( true )
124+ }
125+ }
126+
116127impl Value {
117128 fn discriminant ( & self ) -> usize {
118129 match * self {
You can’t perform that action at this time.
0 commit comments