Skip to content

Commit

Permalink
either "key" or "keys" must be present on all⁽¹⁾ fields (#78)
Browse files Browse the repository at this point in the history
exceptions to the rule:
- field types `wikipedia`, `wikidata` and `address` have both `key` and `keys`
- field type `restrictions` has neither
  • Loading branch information
tyrasd authored Dec 9, 2022
1 parent 6aca4c0 commit d2c7b8b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion schemas/field.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,5 +245,16 @@
"enum": ["preset", "changeset", "manual", "group"]
}
},
"additionalProperties": false
"additionalProperties": false,
"anyOf": [
{ "$id": "field-type-without-key", "properties": { "type": { "enum": ["restrictions"] } } },
{ "$id": "field-type-with-key-and-keys", "properties": { "type": { "enum": ["address", "wikipedia", "wikidata"] } }, "required": ["key", "keys"] },
{ "$id": "field-type-with-key-or-keys", "allOf": [
{ "not": { "properties": { "type": { "enum": ["address", "wikipedia","wikipedia", "wikidata", "restrictions"] } } } },
{ "oneOf": [
{ "required": ["key"] },
{ "required": ["keys"] }
]}
]}
]
}

0 comments on commit d2c7b8b

Please sign in to comment.