Skip to content

Commit

Permalink
fix: validate configurable rules severity overrides correctly in config
Browse files Browse the repository at this point in the history
  • Loading branch information
tatomyr committed Jan 30, 2025
1 parent 4681d7c commit f52ec01
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

0 comments on commit f52ec01

Please sign in to comment.