implement openrpc & openapi examples support

This commit is contained in:
timurgordon
2025-01-21 02:29:23 +00:00
parent 9a7a66192b
commit 8b9717bb74
11 changed files with 137 additions and 39 deletions

View File

@@ -1,11 +1,10 @@
module jsonschema
import json
import x.json2 { Any }
pub fn decode(data string) !Schema {
schema_map := json2.raw_decode(data)!.as_map()
mut schema := json.decode(Schema, data)!
mut schema := json2.decode[Schema](data)!
for key, value in schema_map {
if key == 'properties' {
schema.properties = decode_schemaref_map(value.as_map())!
@@ -48,4 +47,4 @@ pub fn decode_schemaref(data_map map[string]Any) !SchemaRef {
}
}
return decode(data_map.str())!
}
}