fix(jambo): Add binary string support (#6)
This commit is contained in:
@@ -27,6 +27,7 @@ class StringTypeParser(GenericTypeParser):
|
|||||||
"date": date,
|
"date": date,
|
||||||
"time": time,
|
"time": time,
|
||||||
"date-time": datetime,
|
"date-time": datetime,
|
||||||
|
"binary": bytes,
|
||||||
}
|
}
|
||||||
|
|
||||||
format_pattern_mapping = {
|
format_pattern_mapping = {
|
||||||
|
|||||||
@@ -197,3 +197,18 @@ class TestStringTypeParser(TestCase):
|
|||||||
type_parsing, type_validator = parser.from_properties("placeholder", properties)
|
type_parsing, type_validator = parser.from_properties("placeholder", properties)
|
||||||
|
|
||||||
self.assertEqual(type_parsing, datetime)
|
self.assertEqual(type_parsing, datetime)
|
||||||
|
|
||||||
|
def test_string_parser_with_byte_format(self):
|
||||||
|
parser = StringTypeParser()
|
||||||
|
|
||||||
|
properties = {
|
||||||
|
"type": "string",
|
||||||
|
"format": "binary",
|
||||||
|
}
|
||||||
|
|
||||||
|
type_parsing, type_validator = parser.from_properties("placeholder", properties)
|
||||||
|
|
||||||
|
self.assertEqual(type_parsing, bytes)
|
||||||
|
|
||||||
|
self.assertIn("json_schema_extra", type_validator)
|
||||||
|
self.assertEqual(type_validator["json_schema_extra"]["format"], "binary")
|
||||||
|
|||||||
Reference in New Issue
Block a user