feat: adds support for list of types #66

Merged
HideyoshiNakazone merged 3 commits from feature/support-type-list into main 2025-11-26 13:55:32 +00:00
2 changed files with 11 additions and 3 deletions
Showing only changes of commit 40106e4765 - Show all commits

View File

@@ -138,9 +138,8 @@ class SchemaConverter:
type_value = schema.get("type")
if isinstance(type_value, list):
raise InternalAssertionException(
"SchemaConverter._get_schema_type: 'type' field should not be a list here."
" This should have been normalized earlier."
raise InvalidSchemaException(
"Invalid schema: 'type' cannot be a list at the top level", invalid_field=str(schema)
)
return type_value

View File

@@ -1045,5 +1045,14 @@ class TestSchemaConverter(TestCase):
},
}
with self.assertRaises(InvalidSchemaException):
self.converter.build_with_cache(schema)
def test_parse_list_type_root_level_throws(self):
schema = {
"title": "TestListType",
"type": ["string", "number"]
}
with self.assertRaises(InvalidSchemaException):
self.converter.build_with_cache(schema)