From c8cc55221550c8f2786517fbb5055821c1550c7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20J=C3=A4genstedt?= Date: Mon, 24 Apr 2023 16:16:49 +0200 Subject: [PATCH 1/3] Allow multiple specification URLs --- schemas/defs.schema.json | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/schemas/defs.schema.json b/schemas/defs.schema.json index 9fe230dada8..bc8b172ccbb 100644 --- a/schemas/defs.schema.json +++ b/schemas/defs.schema.json @@ -19,9 +19,23 @@ "type": "array" }, "spec": { - "description": "Specification URL", - "format": "uri", - "type": "string" + "anyOf": [ + { + "description": "Specification URL", + "format": "uri", + "type": "string" + }, + { + "items": { + "description": "Specification URL", + "format": "uri", + "type": "string" + }, + "minItems": 2, + "type": "array" + } + ], + "description": "Specification" }, "status": { "additionalProperties": false, @@ -86,4 +100,4 @@ "type": "object" } } -} \ No newline at end of file +} From 164f3e58d5fd456c2b5d34f4e2a2f59b0a1199b2 Mon Sep 17 00:00:00 2001 From: "Daniel D. Beck" Date: Thu, 4 May 2023 16:50:18 +0200 Subject: [PATCH 2/3] Update schema in TypeScript --- index.ts | 11 +++++++---- schemas/defs.schema.json | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/index.ts b/index.ts index edec2389533..4ab2959e7ae 100644 --- a/index.ts +++ b/index.ts @@ -6,10 +6,8 @@ import YAML from 'yaml'; /** Web platform feature */ export interface FeatureData { - /** Specification URL - * @format uri - */ - spec: string; + /** Specification */ + spec: specification_url | [specification_url, specification_url, ...specification_url[]]; /** caniuse.com identifier */ caniuse?: string; /** Whether a feature is considered a "baseline" web platform feature and when it achieved that status */ @@ -31,6 +29,11 @@ interface SupportStatus { support?: {[K in browserIdentifier]?: string}; } +/** Specification URL + * @format uri +*/ +type specification_url = string; + /** Usage stats URL * @format uri */ diff --git a/schemas/defs.schema.json b/schemas/defs.schema.json index bc8b172ccbb..89a49cf3303 100644 --- a/schemas/defs.schema.json +++ b/schemas/defs.schema.json @@ -35,7 +35,7 @@ "type": "array" } ], - "description": "Specification" + "description": "Specifications" }, "status": { "additionalProperties": false, @@ -100,4 +100,4 @@ "type": "object" } } -} +} \ No newline at end of file From 2c13709f5220829a3da2acc776cf600a9594a0fd Mon Sep 17 00:00:00 2001 From: "Daniel D. Beck" Date: Thu, 4 May 2023 16:50:40 +0200 Subject: [PATCH 3/3] Check all spec URLs --- scripts/specs.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/specs.ts b/scripts/specs.ts index 2a429d0b4fa..65559a5af39 100644 --- a/scripts/specs.ts +++ b/scripts/specs.ts @@ -51,12 +51,15 @@ let checked = 0; let errors = 0; for (const [id, data] of Object.entries(features)) { - const url = new URL(data.spec); - if (!isOK(url)) { - console.error(`URL for ${id} not in web-specs: ${url.toString()}`); - errors++; + const specs = Array.isArray(data.spec) ? data.spec : [data.spec]; + for (const spec of specs) { + const url = new URL(spec); + if (!isOK(url)) { + console.error(`URL for ${id} not in web-specs: ${url.toString()}`); + errors++; + } + checked++; } - checked++; } if (errors) {