Skip to content

fix(rulesets): exclude non-schema enum properties from duplicated-entry-in-enum rule#2934

Open
slegarraga wants to merge 1 commit intostoplightio:developfrom
slegarraga:fix/issue-2199
Open

fix(rulesets): exclude non-schema enum properties from duplicated-entry-in-enum rule#2934
slegarraga wants to merge 1 commit intostoplightio:developfrom
slegarraga:fix/issue-2199

Conversation

@slegarraga
Copy link
Copy Markdown

The duplicated-entry-in-enum rule was incorrectly triggering when enum is used as a property name in contexts like discriminator mappings or example values, rather than as a JSON Schema keyword. For example, a discriminator mapping like mapping: { enum: ... } or example data with an enum field would wrongly trigger the rule.

The fix narrows the JSONPath filter to only match when the enum value is actually an array, since a JSON Schema enum keyword must have an array value. This avoids false positives while still correctly catching duplicate entries in actual schema enums.

Checklist

  • Tests added / updated
  • Docs added / updated

Does this PR introduce a breaking change?

  • Yes
  • No

@slegarraga slegarraga requested a review from a team as a code owner April 6, 2026 16:56
…ry-in-enum rule

The duplicated-entry-in-enum rule was incorrectly firing on properties named 'enum' in contexts like discriminator mappings and example values, where 'enum' is a data field rather than a JSON Schema keyword.

Narrow the JSONPath filter to only match when the 'enum' value is actually an array, which is the only valid form for a schema enum keyword.

Fixes stoplightio#2199
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant