start to JSON schemas for validating JSON files before blowing up GT with invalid stuff

JSON-Schemas
Matthew Chambers 2021-08-29 20:17:07 -05:00
rodzic 5c84509b26
commit 628e5d598e
4 zmienionych plików z 218 dodań i 0 usunięć

Wyświetl plik

@ -1,4 +1,5 @@
{
"$schema": "./acknowledgements.schema.json",
"2M0SYH": {
"badge": "img/emojis/money-bag.png",
"message": "GridTracker Donor"

Wyświetl plik

@ -0,0 +1,26 @@
{
"$id": "acknowledgements.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "acknowledgements",
"description": "List of everyone that's contributed to GridTracker",
"type": "object",
"patternProperties": {
"[0-9A-Z]{3,10}": {
"type": "object",
"required": [
"badge",
"message"
],
"properties": {
"badge": {
"type": "string",
"description": "path and filename of the 'badge' to display by a contributors callsign"
},
"message": {
"type": "string",
"description": "the message displayed to say how a person contributed"
}
}
}
}
}

Wyświetl plik

@ -1,4 +1,5 @@
{
"$schema": "./awards.schema.json",
"ARRL": {
"awards": {
"DXCC": {

Wyświetl plik

@ -0,0 +1,190 @@
{
"$id": "awards.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"description": "List of awards by sponsor and programmatic definitions of each",
"patternProperties": {
"[0-9A-Z]{3,10}": {
"title": "Awards Tracker Definitions",
"type": "object",
"required": [
"awards",
"compiledBy",
"mixed",
"qsl_req",
"sponsor",
"website"
],
"awards": {
"description": "A list of awards from this sponsor with a programmatic description of each",
"type": "object",
"patternProperties": {
"[0-9A-Z]{3,10}": {
"title": "Awards",
"type": "object",
"required": [
"name",
"rule",
"sponsor",
"tooltip"
],
"name": {
"type": "string",
"description": "Full name of the award"
},
"rule": {
"type": "object",
"description": "Award rules",
"properties": {
"band": {
"type": "array",
"description": "Array of bands this award is valid for, or single array value mixed",
"items": {
"type": "string",
"enum": [
"Mixed",
"160m",
"80m",
"60m",
"40m",
"30m",
"20m",
"17m",
"15m",
"12m",
"11m",
"10m",
"6m",
"4m",
"2m",
"1.25m",
"70cm",
"33cm",
"23cm"
]
}
},
"call": {
"type": "array",
"description": "Array of valid callsigns needed to work for award",
"items": {
"type": "string"
}
},
"count": {
"type": "array",
"description": "Array of the count of type that is needed for this award",
"items": {
"type": "integer"
}
},
"dxcc": {
"type": "array",
"description": "DXCC entity by ARRL DXCC entity number that are valid for award",
"items": {
"type": "integer"
}
},
"endorse": {
"type": "array",
"description": "Array of bands to that count as single band endorsements (if any)",
"items": {
"type": "string",
"enum": [
"Mixed",
"160m",
"80m",
"60m",
"40m",
"30m",
"20m",
"17m",
"15m",
"12m",
"11m",
"10m",
"6m",
"4m",
"2m",
"1.25m",
"70cm",
"33cm",
"23cm"
]
}
},
"mode": {
"type": "array",
"description": "Array of modes valid for award",
"items": {
"type": "string",
"enum": [
"Mixed",
"CW",
"Digital",
"Phone"
]
}
},
"type": {
"type": "string",
"description": "The type of award",
"enum": [
"call",
"callarea",
"calls2band",
"calls2dxcc",
"cnty",
"cont",
"cont2band",
"cont5",
"cont52band",
"count",
"dxcc",
"dxcc2band",
"grids",
"mode",
"state",
"states2band"
]
},
"unique": {
"type": "integer",
"description": "Number of uniques that is required"
}
}
},
"sponsor": {
"type": "string",
"description": "Short name of award sponsor"
},
"tooltip": {
"type": "string",
"description": "Text for award tracker tooltip"
}
}
}
},
"compiledBy": {
"description": "The name/callsign of the custodian of this award sponsor data",
"type": "string"
},
"mixed": {
"description": "List of bands considered for 'mixed band' of each award",
"items": {},
"type": "array"
},
"qsl_req": {
"description": "Do contacts have to be QSL'd and if so how to qualify for this award sponsor",
"type": "string"
},
"sponsor": {
"description": "Full proper name of awards sponsor",
"type": "string"
},
"website": {
"description": "The URI of the awards sponsor's official website",
"type": "uri"
}
}
}
}