fix(jambo): Fix allOf, anyOf, null and array type parsing #33
@@ -74,10 +74,10 @@ class AllOfTypeParser(GenericTypeParser):
|
|||||||
return old_value + new_value
|
return old_value + new_value
|
||||||
|
|
||||||
if prop_name in ("maxLength", "maximum", "exclusiveMaximum"):
|
if prop_name in ("maxLength", "maximum", "exclusiveMaximum"):
|
||||||
return old_value if old_value > new_value else new_value
|
return old_value if old_value < new_value else new_value
|
||||||
|
|
||||||
if prop_name in ("minLength", "minimum", "exclusiveMinimum"):
|
if prop_name in ("minLength", "minimum", "exclusiveMinimum"):
|
||||||
return old_value if old_value < new_value else new_value
|
return old_value if old_value > new_value else new_value
|
||||||
|
|
||||||
if prop_name == "properties":
|
if prop_name == "properties":
|
||||||
for key, value in new_value.items():
|
for key, value in new_value.items():
|
||||||
|
|||||||
@@ -117,8 +117,8 @@ class TestAllOfTypeParser(TestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(type_parsing, str)
|
self.assertEqual(type_parsing, str)
|
||||||
self.assertEqual(type_validator["max_length"], 11)
|
self.assertEqual(type_validator["max_length"], 4)
|
||||||
self.assertEqual(type_validator["min_length"], 1)
|
self.assertEqual(type_validator["min_length"], 2)
|
||||||
|
|
||||||
def test_all_of_type_parser_in_fields(self):
|
def test_all_of_type_parser_in_fields(self):
|
||||||
"""
|
"""
|
||||||
@@ -138,8 +138,8 @@ class TestAllOfTypeParser(TestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(type_parsing, str)
|
self.assertEqual(type_parsing, str)
|
||||||
self.assertEqual(type_validator["max_length"], 11)
|
self.assertEqual(type_validator["max_length"], 4)
|
||||||
self.assertEqual(type_validator["min_length"], 1)
|
self.assertEqual(type_validator["min_length"], 2)
|
||||||
|
|
||||||
def test_invalid_all_of(self):
|
def test_invalid_all_of(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -358,10 +358,13 @@ class TestSchemaConverter(TestCase):
|
|||||||
Model = SchemaConverter.build(schema)
|
Model = SchemaConverter.build(schema)
|
||||||
|
|
||||||
obj = Model(
|
obj = Model(
|
||||||
name="J",
|
name="John",
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(obj.name, "J")
|
self.assertEqual(obj.name, "John")
|
||||||
|
|
||||||
|
with self.assertRaises(ValueError):
|
||||||
|
Model(name="J")
|
||||||
|
|
||||||
with self.assertRaises(ValueError):
|
with self.assertRaises(ValueError):
|
||||||
Model(name="John Invalid")
|
Model(name="John Invalid")
|
||||||
|
|||||||
Reference in New Issue
Block a user