From ae15fa45ed8502719fe382b33f1d886bd712cf9a Mon Sep 17 00:00:00 2001 From: Joab <89288499+Joabutt@users.noreply.github.com> Date: Sat, 30 Dec 2023 01:29:13 +0800 Subject: [PATCH] Update domain-schema.json --- .github/workflows/domain-schema.json | 33 ++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/.github/workflows/domain-schema.json b/.github/workflows/domain-schema.json index caab21b..532d95b 100644 --- a/.github/workflows/domain-schema.json +++ b/.github/workflows/domain-schema.json @@ -8,8 +8,7 @@ "type": "string" }, "url": { - "type": "string", - "pattern": "^(https?://)?(?:[a-zA-Z0-9-]+\\.){1,}(?:[a-zA-Z0-9-]{2,})\\/?$" + "type": "string" }, "email": { "type": "string", @@ -20,7 +19,33 @@ "enum": ["A", "CNAME", "TXT", "MX"] } }, - "required": ["subdomain", "url", "email"], - "additionalProperties": false + "required": ["subdomain", "email"], + "additionalProperties": false, + "if": { + "anyOf": [ + { + "properties": { + "type": { + "const": "CNAME" + } + } + }, + { + "not": { + "required": ["type"] + } + } + ] + }, + "then": { + "properties": { + "url": { + "type": "string", + "pattern": "^(https?://)?(?:[a-zA-Z0-9-]+\\.){1,}(?:[a-zA-Z0-9-]{2,})\\/?$" + } + }, + "required": ["url"] + }, + "else": {} } }