mirror of https://codeberg.org/CRXN/entitydb.git
add schema to validate json files
Signed-off-by: Marek Küthe <m.k@mk16.de>
This commit is contained in:
parent
c0ddeae11d
commit
75e573595d
|
@ -0,0 +1,122 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft-04/schema",
|
||||
"type": "object",
|
||||
"description": "You can check a entity with `check-jsonschema --schemafile schema.json entity.json`.",
|
||||
"properties": {
|
||||
"person": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"pattern": "^.{1,64}$",
|
||||
"description": "A name must be at least one character long and can be up to 64 characters long."
|
||||
},
|
||||
"email": {
|
||||
"type": "string",
|
||||
"format": "email"
|
||||
},
|
||||
"gpg": {
|
||||
"type": "string",
|
||||
"pattern": "^[\\dA-F]{40}$",
|
||||
"description": "GPG fingerprints are stored here without a spaces."
|
||||
}
|
||||
},
|
||||
"minProperties": 1
|
||||
},
|
||||
"route": {
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
"^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/((4[4-9])|(5[1-9])|(6[1-4]))$": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string",
|
||||
"pattern": "^.{1,2048}$"
|
||||
},
|
||||
"dns": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"nserver": {
|
||||
"type": "string",
|
||||
"format": "hostname"
|
||||
},
|
||||
"ds": {
|
||||
"type": "string",
|
||||
"pattern": "\\d{1,10} ([3-9]|1[0-6]) [1-4] [\\dA-F ]{40,384}"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"nserver"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"max-len": {
|
||||
"type": "string",
|
||||
"pattern": "((4[4-9])|(5[1-9])|(6[1-4]))"
|
||||
},
|
||||
"device": {
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
"^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"pattern": "^(router|generic|server)$"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"pattern": "^.{1,2048}$"
|
||||
},
|
||||
"service": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"pattern": "^.{1,64}$"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"pattern": "^.{1,2048}$"
|
||||
},
|
||||
"endpoint": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"minProperties": 1
|
||||
},
|
||||
"minItems": 1,
|
||||
"uniqueItems": true
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"minItems": 1,
|
||||
"uniqueItems": true
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"minProperties": 1,
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"device"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"minProperties": 1,
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"additionalProperties": true,
|
||||
"required": [
|
||||
"route"
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue