Skip to content

Commit 6546b24

Browse files
committed
Apply base name schema to aliases fields of label configuration file
A JSON schema is used to validate the shared repository label configuration files hosted in this repository in order to ensure they are: - Compliant with the restrictions of the GitHub labels API - Compliant with the data format of the "GitHub Label Sync" tool used to manage the labels - Consistent with the standardized labels format used in Arduino tooling projects The "GitHub Label Sync" tool supports an "aliases" array in the label configuration, which defines the labels which should be renamed according to the configuration. This array is a list of label names, so the same fundamental restrictions (both from GitHub and "GitHub Label Sync", but not Arduino's style guidelines) apply to it as to the `name` field.
1 parent 0b33608 commit 6546b24

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

workflow-templates/assets/sync-labels/arduino-tooling-gh-label-configuration-schema.json

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,21 @@
99
"type": "object",
1010
"properties": {
1111
"name": {
12-
"type": "string",
13-
"maxLength": 50,
14-
"anyOf": [
12+
"allOf": [
1513
{
16-
"$comment": "Standardized label format",
17-
"pattern": "^.+: .+$"
14+
"$ref": "#/$defs/name_base"
1815
},
1916
{
20-
"$comment": "Allowed exceptions to the standardized format",
21-
"enum": ["help wanted"]
17+
"anyOf": [
18+
{
19+
"$comment": "Standardized label format",
20+
"pattern": "^.+: .+$"
21+
},
22+
{
23+
"$comment": "Allowed exceptions to the standardized format",
24+
"enum": ["help wanted"]
25+
}
26+
]
2227
}
2328
]
2429
},
@@ -45,10 +50,20 @@
4550
"maxLength": 100
4651
},
4752
"aliases": {
48-
"type": "array"
53+
"type": "array",
54+
"items": {
55+
"$ref": "#/$defs/name_base"
56+
}
4957
}
5058
},
5159
"additionalProperties": false,
5260
"required": ["name", "color", "description"]
61+
},
62+
"$defs": {
63+
"name_base": {
64+
"$comment": "Fundamental requirements",
65+
"type": "string",
66+
"maxLength": 50
67+
}
5368
}
5469
}

0 commit comments

Comments
 (0)