-
-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
a second flattened enum in a structure is omitted from the schema #165
Comments
Fixed in v1.0.0-alpha.7 🙂 |
not really? the above example now produces an unsatisfiable schema, somewhat like #164 {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "MyStruct",
"type": "object",
"allOf": [
{
"oneOf": [
{
"type": "object",
"properties": {
"enum1variant": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"enum1variant"
]
}
]
},
{
"oneOf": [
{
"type": "object",
"properties": {
"enum2variant": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"enum2variant"
]
}
]
}
]
} the first entry requires that the only allowed property is |
Ah you're right, it still needs to remove the additionalProperties |
OK, it should be fixed for real this time in 1.0.0-alpha.10 - the example above now produces: {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "MyStruct",
"type": "object",
"allOf": [
{
"oneOf": [
{
"type": "object",
"properties": {
"enum1variant": {
"type": "string"
}
},
"required": [
"enum1variant"
]
}
]
},
{
"oneOf": [
{
"type": "object",
"properties": {
"enum2variant": {
"type": "string"
}
},
"required": [
"enum2variant"
]
}
]
}
]
} |
Somewhat related to #164. I considered just adding this as a comment there but decided that it was different enough to get its own issue. If you think they're basically the same thing then of course just close one out as a duplicate.
Start with a structure that contains two flattened enums:
Then the resulting schema makes no mention of
MyEnum2
/enum2variant
at all:If the enums had more variants then a correct schema would seem to need to be some sort of product of possibilities, which certainly sounds awkward.
The text was updated successfully, but these errors were encountered: