diff --git a/meta/schemas.json b/meta/schemas.json index b4b6605c..b23fa2d6 100644 --- a/meta/schemas.json +++ b/meta/schemas.json @@ -5,35 +5,13 @@ "properties": { "$id": false, "$comment": { - "$ref": "#/$defs/clean-prose" + "$ref": "../schemas/misc/single-line-text.json" }, "title": { - "$ref": "#/$defs/clean-prose" + "$ref": "../schemas/misc/single-line-text.json" }, "description": { - "$ref": "#/$defs/clean-prose" - } - }, - "$defs": { - "clean-prose": { - "type": "string", - "not": { - "anyOf": [ - { - "pattern": "\\.$" - }, - { - "pattern": " \\s" - }, - { - "pattern": "[\\n\\r\\t]" - }, - { - "pattern": "[\\x00-\\x1F\\x7F]" - } - ] - }, - "pattern": "^[^\\s].*[^\\s]$|^[^\\s]$" + "$ref": "../schemas/misc/single-line-text.json" } } } diff --git a/schemas/misc/single-line-text.json b/schemas/misc/single-line-text.json new file mode 100644 index 00000000..99267427 --- /dev/null +++ b/schemas/misc/single-line-text.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "Single-line Text", + "description": "A string representing a single line of clean text without leading or trailing whitespace, excessive internal spacing, non-printable characters, newlines, tabs, trailing periods, or other punctuation issues", + "examples": [ + "This is a simple text", + "Multiple sentences work fine", + "Numbers and symbols: 123 $%&", + "Unicode characters are allowed: café, 日本語" + ], + "x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE", + "x-links": [ "https://en.wikipedia.org/wiki/String_(computer_science)" ], + "type": "string", + "pattern": "^(?!.*\\.$)(?!.*(?