From 67554d914d4afa67daa20d1f73246f813b8c299f Mon Sep 17 00:00:00 2001 From: Kevin Broch Date: Fri, 22 Nov 2024 19:22:27 -0800 Subject: [PATCH] restrict date regex to only valid months; fixes #310 --- schemas/ext_schema.json | 3 ++- schemas/schema_defs.json | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/schemas/ext_schema.json b/schemas/ext_schema.json index 8c281c4e6..724e93128 100644 --- a/schemas/ext_schema.json +++ b/schemas/ext_schema.json @@ -147,7 +147,8 @@ }, "ratification_date": { "oneOf": [ - {"type": "string", "pattern": "^20[0-9][0-9]-[0-9][0-9]$", "$comment": "When ratification date is known" }, + {"type": "string", "pattern": "^20[0-9][0-9]-(0[1-9]|1[0-2])$", "$comment": "When ratification date is known", + "description": "A specific year and month in YYYY-MM format", "examples": ["2019-01", "2024-12"] }, {"type": "string", "pattern": "^unknown$", "$comment": "When ratification date is unknown" }, {"type": "null", "$comment": "When version isn't ratified" } ] diff --git a/schemas/schema_defs.json b/schemas/schema_defs.json index 57c886132..1b954ba32 100644 --- a/schemas/schema_defs.json +++ b/schemas/schema_defs.json @@ -80,7 +80,8 @@ "date": { "type": "string", "format": "date", - "description": "A specific day in YYYY-MM-DD format, for example 2018-11-13" + "description": "A specific day in YYYY-MM-DD format", + "examples": ["2018-11-13", "2024-12-31"] }, "extension_name": { "type": "string", @@ -91,7 +92,7 @@ }, "requirement_string": { "type": "string", - "pattern": "^((>=)|(>)|(~>)|(<)|(<=)|(=))\\s*[0-9]+(\\.[0-9]+(\\.[0-9]+(-[a-fA-F0-9]+)?)?)?$" + "pattern": "^((>=)|(>)|(~>)|(<)|(<=)|(=))?\\s*[0-9]+(\\.[0-9]+(\\.[0-9]+(-[a-fA-F0-9]+)?)?)?$" }, "version_requirements": { "description": "A (set of) version requirements",