Prevent JsonSchema for type enumerated to become anyOf

Hello, when I have type.enumerated('foo', 'bar').or(type.enumerated('foo', 'bar').array()).toJsonSchema(), the returned schema is:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"anyOf": [
{
"type": "array",
"items": {
"enum": [
"bar",
"foo"
]
}
},
{
"const": "bar"
},
{
"const": "foo"
}
]
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"anyOf": [
{
"type": "array",
"items": {
"enum": [
"bar",
"foo"
]
}
},
{
"const": "bar"
},
{
"const": "foo"
}
]
}
How can I get the following schema instead:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"anyOf": [
{
"type": "array",
"items": {
"enum": [
"bar",
"foo"
]
}
},
{
"enum": ["bar", "foo"]
}
]
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"anyOf": [
{
"type": "array",
"items": {
"enum": [
"bar",
"foo"
]
}
},
{
"enum": ["bar", "foo"]
}
]
}
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?