diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index 806a50a..577704e 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -36,3 +36,9 @@ jobs: pattern: "\\.json$" env: BASE: "domains/" + # NOTE: wait for wildcard support + # - name: Validate JSON Schema + # uses: docker://orrosenblatt/validate-json-action:latest + # env: + # INPUT_SCHEMA: "schema.json" + # INPUT_JSONS: "domains/*" diff --git a/schema.json b/schema.json new file mode 100644 index 0000000..e553c41 --- /dev/null +++ b/schema.json @@ -0,0 +1,84 @@ +{ + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "owner": { + "type": "object", + "properties": { + "username": { + "type": "string" + } + }, + "required": ["username"] + }, + "record": { + "type": "object", + "properties": { + "A": { + "type": "array", + "items": { + "type": "string", + "format": "ipv4" + } + }, + "AAAA": { + "type": "array", + "items": { + "type": "string", + "format": "ipv6" + } + }, + "CNAME": { + "type": "string" + }, + "MX": { + "type": "array", + "items": { + "type": "string" + } + }, + "TXT": { + "type": "array", + "items": { + "type": "string" + } + }, + "SRV": { + "type": "array", + "items": { + "type": "object", + "properties": { + "priority": { + "type": "integer" + }, + "weight": { + "type": "integer" + }, + "port": { + "type": "integer" + }, + "target": { + "type": "string" + } + }, + "required": ["priority", "weight", "port", "target"] + } + } + }, + "anyOf": [ + { "required": ["A"] }, + { "required": ["AAAA"] }, + { "required": ["CNAME"] }, + { "required": ["MX"] }, + { "required": ["TXT"] }, + { "required": ["SRV"] } + ] + }, + "proxied": { + "type": "boolean" + } + }, + "required": ["owner", "record", "proxied"] +}