Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix(schema): auto-fix JSON schema linting issues
  • Loading branch information
actions-user committed Sep 1, 2025
commit 52afad700e0ed13d1043fca9601e65596ba59b9f
38 changes: 18 additions & 20 deletions rulesets/schemas/rule.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"type": {
"enum": [ "style", "validation" ],
"errorMessage": "allowed types are \"style\" and \"validation\""
"x-errorMessage": "allowed types are \"style\" and \"validation\""
},
"then": {
"anyOf": [
Expand Down Expand Up @@ -51,7 +51,7 @@
"documentationUrl": {
"type": "string",
"format": "url",
"errorMessage": "must be a valid URL"
"x-errorMessage": "must be a valid URL"
},
"formats": {
"$ref": "#/definitions/Formats"
Expand Down Expand Up @@ -97,20 +97,20 @@
"enum": [ -1, 0, 1, 2, 3 ]
},
"Format": {
"$anchor": "format",
"errorMessage": "must be a valid format",
"spectral-runtime": "spectral-format"
"x-$anchor": "format",
"x-errorMessage": "must be a valid format",
"x-spectral-runtime": "spectral-format"
},
"Formats": {
"$anchor": "formats",
"x-$anchor": "formats",
"type": "array",
"items": {
"$ref": "#/definitions/Format"
},
"errorMessage": "must be an array of formats"
"x-errorMessage": "must be an array of formats"
},
"Functions": {
"$anchor": "functions",
"x-$anchor": "functions",
"type": "array",
"items": {
"type": "string"
Expand All @@ -120,7 +120,7 @@
"enum": [ "error", "warn", "info", "hint", "off" ]
},
"Severity": {
"$anchor": "severity",
"x-$anchor": "severity",
"oneOf": [
{
"$ref": "#/definitions/DiagnosticSeverity"
Expand All @@ -129,22 +129,20 @@
"$ref": "#/definitions/HumanReadableSeverity"
}
],
"errorMessage": "the value has to be one of: 0, 1, 2, 3 or \"error\", \"warn\", \"info\", \"hint\", \"off\""
"x-errorMessage": "the value has to be one of: 0, 1, 2, 3 or \"error\", \"warn\", \"info\", \"hint\", \"off\""
},
"Then": {
"type": "object",
"properties": {
"field": {
"type": "string"
}
},
"required": [ "function" ],
"x-spectral-runtime": "ruleset-function",
"allOf": [
{
"properties": {
"field": {
"type": "string"
}
}
},
{
"type": "object",
"required": [ "function" ],
"spectral-runtime": "ruleset-function"
"type": "object"
}
]
}
Expand Down
124 changes: 60 additions & 64 deletions rulesets/schemas/ruleset.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"type": "object",
"propertyNames": {
"pattern": "^[A-Za-z][A-Za-z\\d_-]*$",
"errorMessage": {
"x-errorMessage": {
"pattern": "to avoid confusion the name must match /^[A-Za-z][A-Za-z\\d_-]*$/ regular expression",
"minLength": "the name of an alias must not be empty"
}
Expand Down Expand Up @@ -43,14 +43,14 @@
"$ref": "#/definitions/Given"
}
},
"errorMessage": "a valid target must contain given and non-empty formats"
"x-errorMessage": "a valid target must contain given and non-empty formats"
},
"errorMessage": {
"x-errorMessage": {
"minItems": "targets must have at least a single alias definition"
}
}
},
"errorMessage": {
"x-errorMessage": {
"required": "targets must be present and have at least a single alias definition"
}
},
Expand All @@ -62,7 +62,7 @@
"documentationUrl": {
"type": "string",
"format": "url",
"errorMessage": "must be a valid URL"
"x-errorMessage": "must be a valid URL"
},
"formats": {
"$ref": "#/definitions/Formats"
Expand All @@ -89,7 +89,7 @@
"pattern": "^[^#]+#",
"minLength": 1
},
"errorMessage": "must be a non-empty array of glob patterns"
"x-errorMessage": "must be a non-empty array of glob patterns"
}
}
},
Expand All @@ -103,48 +103,46 @@
"additionalProperties": {
"$ref": "#/definitions/Severity"
},
"errorMessage": {
"x-errorMessage": {
"enum": "must be a valid severity level"
}
}
},
"additionalProperties": false,
"errorMessage": {
"x-errorMessage": {
"required": "must contain rules when JSON Pointers are defined",
"additionalProperties": "must not override any other property than rules when JSON Pointers are defined"
}
},
"else": {
"allOf": [
{
"type": "object",
"required": [ "files" ],
"properties": {
"files": {
"type": "array",
"minItems": 1,
"items": {
"type": "string",
"pattern": "[^#]",
"minLength": 1
},
"errorMessage": "must be a non-empty array of glob patterns"
}
"type": "object",
"required": [ "files" ],
"properties": {
"files": {
"type": "array",
"minItems": 1,
"items": {
"type": "string",
"pattern": "[^#]",
"minLength": 1
},
"errorMessage": {
"type": "must be an override, i.e. { \"files\": [\"v2/**/*.json\"], \"rules\": {} }"
}
"x-errorMessage": "must be a non-empty array of glob patterns"
}
},
"x-errorMessage": {
"type": "must be an override, i.e. { \"files\": [\"v2/**/*.json\"], \"rules\": {} }"
},
"anyOf": [
{
"required": [ "extends" ]
},
{
"required": [ "rules" ]
}
],
"allOf": [
{
"type": "object",
"anyOf": [
{
"required": [ "extends" ]
},
{
"required": [ "rules" ]
}
],
"properties": {
"extends": {
"$ref": "#/properties/extends"
Expand All @@ -166,7 +164,7 @@
]
}
},
"errorMessage": {
"x-errorMessage": {
"minItems": "must not be empty"
}
},
Expand Down Expand Up @@ -198,7 +196,7 @@
},
"type": {
"enum": [ "style", "validation" ],
"errorMessage": "allowed types are \"style\" and \"validation\""
"x-errorMessage": "allowed types are \"style\" and \"validation\""
},
"then": {
"anyOf": [
Expand Down Expand Up @@ -237,7 +235,7 @@
"documentationUrl": {
"type": "string",
"format": "url",
"errorMessage": "must be a valid URL"
"x-errorMessage": "must be a valid URL"
},
"formats": {
"$ref": "#/definitions/Formats"
Expand Down Expand Up @@ -278,7 +276,7 @@
}
},
"additionalProperties": false,
"errorMessage": {
"x-errorMessage": {
"required": "the rule must have at least \"given\" and \"then\" properties"
}
},
Expand All @@ -298,7 +296,7 @@
"enum": [ -1, 0, 1, 2, 3 ]
},
"Extends": {
"$anchor": "extends",
"x-$anchor": "extends",
"oneOf": [
{
"type": "string"
Expand All @@ -319,7 +317,7 @@
},
{
"enum": [ "all", "recommended", "off" ],
"errorMessage": "allowed types are \"off\", \"recommended\" and \"all\""
"x-errorMessage": "allowed types are \"off\", \"recommended\" and \"all\""
}
],
"additionalItems": false
Expand All @@ -330,20 +328,20 @@
]
},
"Format": {
"$anchor": "format",
"errorMessage": "must be a valid format",
"spectral-runtime": "spectral-format"
"x-$anchor": "format",
"x-errorMessage": "must be a valid format",
"x-spectral-runtime": "spectral-format"
},
"Formats": {
"$anchor": "formats",
"x-$anchor": "formats",
"type": "array",
"items": {
"$ref": "#/definitions/Format"
},
"errorMessage": "must be an array of formats"
"x-errorMessage": "must be an array of formats"
},
"Function": {
"$anchor": "function",
"x-$anchor": "function",
"type": "object",
"required": [ "function" ],
"properties": {
Expand All @@ -353,29 +351,29 @@
}
},
"Functions": {
"$anchor": "functions",
"x-$anchor": "functions",
"type": "array",
"items": {
"type": "string"
}
},
"FunctionsDir": {
"$anchor": "functionsDir",
"x-$anchor": "functionsDir",
"type": "string"
},
"Given": {
"$anchor": "given",
"x-$anchor": "given",
"if": {
"type": "array"
},
"then": {
"$anchor": "arrayish-given",
"x-$anchor": "arrayish-given",
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/definitions/PathExpression"
},
"errorMessage": {
"x-errorMessage": {
"minItems": "must be a non-empty array of expressions"
}
},
Expand All @@ -390,10 +388,10 @@
"$id": "path-expression",
"type": "string",
"pattern": "^[$#]",
"errorMessage": "must be a valid JSON Path expression or a reference to the existing Alias optionally paired with a JSON Path expression subset"
"x-errorMessage": "must be a valid JSON Path expression or a reference to the existing Alias optionally paired with a JSON Path expression subset"
},
"Severity": {
"$anchor": "severity",
"x-$anchor": "severity",
"oneOf": [
{
"$ref": "#/definitions/DiagnosticSeverity"
Expand All @@ -402,22 +400,20 @@
"$ref": "#/definitions/HumanReadableSeverity"
}
],
"errorMessage": "the value has to be one of: 0, 1, 2, 3 or \"error\", \"warn\", \"info\", \"hint\", \"off\""
"x-errorMessage": "the value has to be one of: 0, 1, 2, 3 or \"error\", \"warn\", \"info\", \"hint\", \"off\""
},
"Then": {
"type": "object",
"properties": {
"field": {
"type": "string"
}
},
"required": [ "function" ],
"x-spectral-runtime": "ruleset-function",
"allOf": [
{
"properties": {
"field": {
"type": "string"
}
}
},
{
"type": "object",
"required": [ "function" ],
"spectral-runtime": "ruleset-function"
"type": "object"
}
]
}
Expand Down