Skip to content

Conversation

@vadyvas
Copy link
Contributor

@vadyvas vadyvas commented Nov 6, 2025

What/Why/How?

Align example validation with the allowAdditionalProperties option across example-related rules.

Previously:

  • validateExample for a single example always passed allowAdditionalProperties: true.
  • no-invalid-parameter-examples used allowAdditionalProperties: true for multi examples, but respected opts.allowAdditionalProperties only for single examples.

Reference

Testing

  • Updated/added unit tests for example-related rules.
  • Updated e2e tests for

Check yourself

  • Code changed? - Tested with Redoc/Realm/Reunite (internal)
  • All new/updated code is covered by tests
  • New package installed? - Tested in different environments (browser/node)
  • Documentation update considered

Security

  • The security impact of the change has been considered
  • Code follows company security practices and guidelines

@changeset-bot
Copy link

changeset-bot bot commented Nov 6, 2025

🦋 Changeset detected

Latest commit: d6b6ae1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@redocly/openapi-core Patch
@redocly/cli Patch
@redocly/respect-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

Command Mean [s] Min [s] Max [s] Relative
redocly lint resources/rebilly.yaml 1.467 ± 0.020 1.433 1.501 1.02 ± 0.02
redocly-next lint resources/rebilly.yaml 1.445 ± 0.028 1.400 1.490 1.00

@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 78.85% (🎯 78%) 5854 / 7424
🟢 Statements 78.28% (🎯 78%) 6049 / 7727
🟢 Functions 81.88% (🎯 81%) 1202 / 1468
🟢 Branches 71.12% (🎯 70%) 4054 / 5700
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/core/src/rules/common/no-invalid-parameter-examples.ts 100% 83.33% 100% 100%
packages/core/src/rules/common/no-invalid-schema-examples.ts 100% 100% 100% 100%
Generated in workflow #7978 for commit d6b6ae1 by the Vitest Coverage Report Action

@vadyvas vadyvas marked this pull request as ready for review November 7, 2025 10:53
@vadyvas vadyvas requested review from a team as code owners November 7, 2025 10:53
schema,
ctx.location.child('example'),
ctx,
!!opts.allowAdditionalProperties
Copy link
Collaborator

Choose a reason for hiding this comment

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

This fixes the issue only partially. If the configuration of the rules is different, there will be a mismatch since the first rule that runs instantiates the AJV instance with its config and ignores the others.

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.

no-invalid-media-type-examples not triggering warning for unevaluated properties

5 participants