-
Notifications
You must be signed in to change notification settings - Fork 74
Open
Labels
Description
What do you think about supporting constant values in schema, indicated by the Tuple type, e.g., as follows?
>>> from genson import SchemaBuilder
>>> builder = SchemaBuilder()
>>> builder.add_schema({"type": "object", "properties": {}})
>>> builder.add_object(
{
"attr": ("value",)
}
)
Expected result is:
{'$schema': 'http://json-schema.org/schema#',
'type': 'object',
'properties': {
'attr': {"const": "value"}},
'required': ['attr']}
By the way, the code above raises the following error:
genson.schema.node.SchemaGenerationError: Could not find matching schema type for object: ("value",)
Reactions are currently unavailable