Skip to content

Commit

Permalink
fix: validate configurable rules severity overrides correctly in conf…
Browse files Browse the repository at this point in the history
…ig (#1872)
  • Loading branch information
tatomyr authored Jan 31, 2025
1 parent 4681d7c commit fa280a3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/dry-candles-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@redocly/openapi-core": patch
---

Resolved an issue where overrides for the severity of configurable rules raised warnings when validating the config.
12 changes: 10 additions & 2 deletions packages/core/src/types/redocly-yaml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,18 @@ const Rules: NodeType = {
properties: {},
additionalProperties: (value: unknown, key: string) => {
if (key.startsWith('rule/')) {
return 'Assert';
if (typeof value === 'string') {
return { enum: ['error', 'warn', 'off'] };
} else {
return 'Assert';
}
} else if (key.startsWith('assert/')) {
// keep the old assert/ prefix as an alias
return 'Assert';
if (typeof value === 'string') {
return { enum: ['error', 'warn', 'off'] };
} else {
return 'Assert';
}
} else if (builtInRules.includes(key as BuiltInRuleId) || isCustomRuleId(key)) {
if (typeof value === 'string') {
return { enum: ['error', 'warn', 'off'] };
Expand Down

1 comment on commit fa280a3

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 78.6% 5053/6429
🟡 Branches 67.18% 2059/3065
🟡 Functions 73.16% 834/1140
🟡 Lines 78.88% 4767/6043

Test suite run success

835 tests passing in 120 suites.

Report generated by 🧪jest coverage report action from fa280a3

Please sign in to comment.