Skip to content

Commit fbd591d

Browse files
committed
Implement v2 Spec JSON Schema
Based on pgxn/rfcs#3. As with the v1 schemas, use JSON Schema v2020 for the v2 schemas. Fix a few minor issues with the v1 schema, as well. Add full test suite in Rust; move code shared between the v1 and v2 tests to `tests/common/mod.rs`. This includes custom format functions not required for v1, including spdx version expression validation with the `spdx` crate, and path validation to ensure no `..` is included in paths.
1 parent e32058b commit fbd591d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+5037
-324
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ repos:
1919
- id: fmt
2020
- id: check
2121
- id: clippy
22-
- id: test
22+
# - id: test
2323

2424
- repo: https://github.com/pre-commit/mirrors-prettier
2525
rev: v3.1.0

Cargo.lock

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ serde_json = "1.0"
1818

1919
[dependencies]
2020
serde = { version = "1", features = ["derive"] }
21+
spdx = "0.10.6"

schema/v1/bugtracker.schema.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@
1717
}
1818
},
1919
"anyOf": [{ "required": ["web"] }, { "required": ["mailto"] }],
20-
"patternProperties": {
21-
"^[xX]_.": {
22-
"description": "Custom key"
23-
}
24-
},
20+
"patternProperties": { "^[xX]_.": { "description": "Custom key" } },
2521
"additionalProperties": false,
2622
"examples": [
2723
{

schema/v1/distribution.schema.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,7 @@
5050
},
5151
"resources": { "$ref": "resources.schema.json" }
5252
},
53-
"patternProperties": {
54-
"^[xX]_.": {
55-
"description": "Custom key"
56-
}
57-
},
53+
"patternProperties": { "^[xX]_.": { "description": "Custom key" } },
5854
"additionalProperties": false,
5955
"required": [
6056
"name",

schema/v1/extension.schema.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@
2626
}
2727
},
2828
"required": ["file", "version"],
29-
"patternProperties": {
30-
"^[xX]_.": {
31-
"description": "Custom key"
32-
}
33-
},
29+
"patternProperties": { "^[xX]_.": { "description": "Custom key" } },
3430
"additionalProperties": false,
3531
"examples": [
3632
{

schema/v1/license.schema.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"items": { "$ref": "#/$defs/validLicense" },
1515
"description": "A list of shortcuts to identify well-known licenses for the distribution.",
1616
"minItems": 1,
17+
"uniqueItems": true,
1718
"examples": [["apache_2_0", "postgresql"], ["mit"]]
1819
},
1920
{

schema/v1/maintainer.schema.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"type": "string",
1515
"minLength": 1
1616
},
17+
"uniqueItems": true,
1718
"minItems": 1
1819
}
1920
],

schema/v1/meta-spec.schema.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@
1717
}
1818
},
1919
"required": ["version"],
20-
"patternProperties": {
21-
"^[xX]_.": {
22-
"description": "Custom key"
23-
}
24-
},
20+
"patternProperties": { "^[xX]_.": { "description": "Custom key" } },
2521
"additionalProperties": false,
2622
"examples": [
2723
{ "version": "1.0.0" },

schema/v1/no_index.schema.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@
1515
}
1616
},
1717
"anyOf": [{ "required": ["file"] }, { "required": ["directory"] }],
18-
"patternProperties": {
19-
"^[xX]_.": {
20-
"description": "Custom key"
21-
}
22-
},
18+
"patternProperties": { "^[xX]_.": { "description": "Custom key" } },
2319
"additionalProperties": false,
2420
"examples": [
2521
{
@@ -33,6 +29,7 @@
3329
{
3430
"type": "array",
3531
"minItems": 1,
32+
"uniqueItems": true,
3633
"items": {
3734
"type": "string",
3835
"description": "Relative path in unix convention to a file to ignore.",

0 commit comments

Comments
 (0)