Skip to content

Commit

Permalink
Map 'any' JSON Schema type to json::Value instead of String
Browse files Browse the repository at this point in the history
  • Loading branch information
xDarksome authored and Byron committed Dec 31, 2022
1 parent 0548e4d commit 11dc2ef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/generator/lib/__tests__/util_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def test_to_rust_type(self):
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():
Expand Down
2 changes: 1 addition & 1 deletion src/generator/lib/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def chrono_date(y=None, m=None, d=None):
'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),
Expand Down

0 comments on commit 11dc2ef

Please sign in to comment.