Update pcm schema

1. Allow dots in package id for namespacing requirements
2. Add regex anchoring to force matching whole string
3. sha hex digest can only have [a-f0-9] chars
This commit is contained in:
qu1ck 2021-11-05 14:52:49 -07:00 committed by Jon Evans
parent 38d8e00d10
commit d84cea58a4
1 changed files with 11 additions and 11 deletions

View File

@ -26,7 +26,7 @@
"identifier": { "identifier": {
"type": "string", "type": "string",
"description": "Package identifier", "description": "Package identifier",
"pattern": "[a-zA-Z][-a-zA-Z0-9]{0,48}[a-zA-Z0-9]" "pattern": "^[a-zA-Z][-a-zA-Z0-9.]{0,48}[a-zA-Z0-9]$"
}, },
"type": { "type": {
"type": "string", "type": "string",
@ -53,7 +53,7 @@
"type": "object", "type": "object",
"description": "Additional resource links for the package", "description": "Additional resource links for the package",
"patternProperties": { "patternProperties": {
"[a-zA-Z][-a-zA-Z0-9 ]{0,48}[a-zA-Z0-9]": { "^[a-zA-Z][-a-zA-Z0-9 ]{0,48}[a-zA-Z0-9]$": {
"type": "string", "type": "string",
"maxLength": 500 "maxLength": 500
} }
@ -65,7 +65,7 @@
"description": "Tags for the package", "description": "Tags for the package",
"items": { "items": {
"type": "string", "type": "string",
"pattern": "[a-z][-a-z0-9]{0,48}[a-z0-9]" "pattern": "^[a-z][-a-z0-9]{0,48}[a-z0-9]$"
}, },
"minItems": 1, "minItems": 1,
"uniqueItems": true "uniqueItems": true
@ -104,7 +104,7 @@
"type": "object", "type": "object",
"description": "Contact information details", "description": "Contact information details",
"patternProperties": { "patternProperties": {
"[a-z][-a-z0-9 ]{0,48}[a-z0-9]": { "^[a-z][-a-z0-9 ]{0,48}[a-z0-9]$": {
"type": "string", "type": "string",
"maxLength": 500 "maxLength": 500
} }
@ -124,7 +124,7 @@
"version": { "version": {
"type": "string", "type": "string",
"description": "Package version number major[.minor[.patch]]", "description": "Package version number major[.minor[.patch]]",
"pattern": "\\d{1,4}(\\.\\d{1,4}(\\.\\d{1,6})?)?" "pattern": "^\\d{1,4}(\\.\\d{1,4}(\\.\\d{1,6})?)?$"
}, },
"version_epoch": { "version_epoch": {
"type": "integer", "type": "integer",
@ -138,7 +138,7 @@
"download_sha256": { "download_sha256": {
"type": "string", "type": "string",
"description": "SHA-256 hash of the package archive as lower case hex string", "description": "SHA-256 hash of the package archive as lower case hex string",
"pattern": "[a-z0-9]{64}" "pattern": "^[a-f0-9]{64}$"
}, },
"download_size": { "download_size": {
"description": "Download size in bytes", "description": "Download size in bytes",
@ -177,12 +177,12 @@
"kicad_version": { "kicad_version": {
"type": "string", "type": "string",
"description": "Minimum supported KiCad version", "description": "Minimum supported KiCad version",
"pattern": "\\d{1,2}(\\.\\d{1,2}(\\.\\d{1,2})?)?" "pattern": "^\\d{1,2}(\\.\\d{1,2}(\\.\\d{1,2})?)?$"
}, },
"kicad_version_max": { "kicad_version_max": {
"type": "string", "type": "string",
"description": "Maximum supported KiCad version", "description": "Maximum supported KiCad version",
"pattern": "\\d{1,2}(\\.\\d{1,2}(\\.\\d{1,2})?)?" "pattern": "^\\d{1,2}(\\.\\d{1,2}(\\.\\d{1,2})?)?$"
} }
}, },
"required": [ "required": [
@ -249,7 +249,7 @@
"sha256": { "sha256": {
"type": "string", "type": "string",
"description": "SHA-256 hash of the resource file as lower case hex string", "description": "SHA-256 hash of the resource file as lower case hex string",
"pattern": "[a-z0-9]{64}" "pattern": "^[a-f0-9]{64}$"
}, },
"update_timestamp": { "update_timestamp": {
"type": "integer", "type": "integer",
@ -258,7 +258,7 @@
"update_time_utc": { "update_time_utc": {
"type": "string", "type": "string",
"description": "Human readabla update time in UTC YYYY-MM-DD HH:MM:SS format", "description": "Human readabla update time in UTC YYYY-MM-DD HH:MM:SS format",
"pattern": "2\\d\\d\\d-\\d\\d-\\d\\d \\d\\d:\\d\\d:\\d\\d" "pattern": "^2\\d\\d\\d-\\d\\d-\\d\\d \\d\\d:\\d\\d:\\d\\d$"
} }
}, },
"required": [ "required": [
@ -268,7 +268,7 @@
}, },
"URL": { "URL": {
"type": "string", "type": "string",
"pattern": "(https?:\\/\\/[^\\s\\/$.?#].[^\\s]*)|(file:\\/\\/([a-zA-Z]:|\\/)[^\\x00]+)" "pattern": "^(https?:\\/\\/[^\\s\\/$.?#].[^\\s]*)|(file:\\/\\/([a-zA-Z]:|\\/)[^\\x00]+)$"
}, },
"License": { "License": {
"type": "string", "type": "string",