Skip to content

Commit b011fba

Browse files
refactor(schema): simplify prefix validation regex (#280)
Annoying yak shave: - I have an ecosystem cross-reference unit test for osv.dev in the works, which relies on using the regex in the schema definition, verbatim. - [Python 3.7 has a FutureWarning on set constructs](https://docs.python.org/dev/whatsnew/3.7.html#re), where as far as I can tell, `(:[[:digit:]]+)?` would need to be written as `(:\[[:digit:]]+)?`, which isn't valid in the JSON Schema (more in python/cpython#74534) - https://json-schema.org/draft/2020-12/json-schema-core#name-regular-expressions says JSON Schema regex is ECMA-262, so what gets used in the schema needs to be the subset that works with https://docs.python.org/3/library/re.html - https://xkcd.com/1171/ --------- Signed-off-by: Andrew Pollock <[email protected]> Signed-off-by: Andrew Pollock <[email protected]>
1 parent 2e1329f commit b011fba

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

validation/schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@
300300
"type": "string",
301301
"title": "Currently supported ecosystems",
302302
"description": "These ecosystems are also documented at https://ossf.github.io/osv-schema/#affectedpackage-field",
303-
"pattern": "^(AlmaLinux|Alpine|Android|Bioconductor|Bitnami|Chainguard|ConanCenter|CRAN|crates.io|Debian|GHC|GitHub Actions|GIT|Go|Hackage|Hex|Linux|Maven|npm|NuGet|openSUSE|OSS-Fuzz|Packagist|Photon OS|Pub|PyPI|Red Hat|Rocky Linux|RubyGems|SUSE|SwiftURL|Ubuntu|Wolfi)(:[[:digit:]]+)?"
303+
"pattern": "^(AlmaLinux|Alpine|Android|Bioconductor|Bitnami|Chainguard|ConanCenter|CRAN|crates.io|Debian|GHC|GitHub Actions|GIT|Go|Hackage|Hex|Linux|Maven|npm|NuGet|openSUSE|OSS-Fuzz|Packagist|Photon OS|Pub|PyPI|Red Hat|Rocky Linux|RubyGems|SUSE|SwiftURL|Ubuntu|wolfi)(:[0-9]+)?"
304304
},
305305
"prefix": {
306306
"type": "string",

0 commit comments

Comments
 (0)