Map 'any' JSON Schema type to json::Value instead of String

This commit is contained in:
Darksome
2022-12-30 11:13:50 +04:00
committed by Sebastian Thiel
parent 0548e4dc21
commit 11dc2ef170
2 changed files with 2 additions and 2 deletions

View File

@@ -104,7 +104,7 @@ class UtilsTest(unittest.TestCase):
property_name = 'details'
property_value = schemas[class_name]['properties'][property_name]
rust_type = to_rust_type(schemas, class_name, property_name, property_value, allow_optionals=True)
self.assertEqual(rust_type, 'Option<Vec<HashMap<String, String>>>')
self.assertEqual(rust_type, 'Option<Vec<HashMap<String, json::Value>>>')
def main():

View File

@@ -30,7 +30,7 @@ RUST_TYPE_MAP = {
'double': Base("f64"),
'float': Base("f32"),
'int32': Base("i32"),
'any': Base("String"), # TODO: Figure out how to handle it. It's 'interface' in Go ...
'any': Base("json::Value"),
'int64': Base("i64"),
'uint64': Base("u64"),
'array': Vec(None),