Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: false positive errors when validating examples with refs #1377

Merged
merged 5 commits into from
Jan 19, 2024

Conversation

tatomyr
Copy link
Contributor

@tatomyr tatomyr commented Jan 2, 2024

What/Why/How?

This solves an edge case validation error when there are multiple references in media type examples and the corresponding schemas.

Reference

Fixes #1245

Testing

Screenshots (optional)

Check yourself

  • Code is linted
  • Tested with redoc/reference-docs/workflows (internal)
  • All new/updated code is covered with tests

Security

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

@tatomyr tatomyr self-assigned this Jan 2, 2024
@tatomyr tatomyr requested a review from a team as a code owner January 2, 2024 16:04
Copy link

changeset-bot bot commented Jan 2, 2024

🦋 Changeset detected

Latest commit: d764eb9

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

This PR includes changesets to release 2 packages
Name Type
@redocly/openapi-core Patch
@redocly/cli 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

Copy link
Contributor

github-actions bot commented Jan 2, 2024

Command Mean [s] Min [s] Max [s] Relative
redocly lint packages/core/src/benchmark/benches/rebilly.yaml 1.074 ± 0.027 1.045 1.122 1.02 ± 0.03
redocly-next lint packages/core/src/benchmark/benches/rebilly.yaml 1.055 ± 0.023 1.016 1.106 1.00

Copy link
Contributor

github-actions bot commented Jan 2, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 75.8% 4100/5409
🟡 Branches 66.07% 2183/3304
🟡 Functions 68.14% 663/973
🟡 Lines 76% 3847/5062

Test suite run success

671 tests passing in 94 suites.

Report generated by 🧪jest coverage report action from d764eb9

@tatomyr tatomyr force-pushed the fix/false-positive-media-type-examples-validation branch from e34407e to 7ccb641 Compare January 2, 2024 17:03
@tatomyr tatomyr requested a review from RomanHotsiy January 2, 2024 19:37
@tatomyr tatomyr force-pushed the fix/false-positive-media-type-examples-validation branch from aca85c2 to cefc041 Compare January 16, 2024 10:56
@tatomyr tatomyr requested a review from a team as a code owner January 16, 2024 10:56
@tatomyr tatomyr force-pushed the fix/false-positive-media-type-examples-validation branch from cefc041 to dbd2f99 Compare January 16, 2024 12:28
"@redocly/cli": patch
---

Fixed false positive errors when validating media type examples that contain references.
Copy link
Contributor

Choose a reason for hiding this comment

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

So that I understand this properly: we fixed a problem where no errors were reported - but the examples were wrong? So users might see errors without changing their API description, is that correct? Was it specifically when the changes went across files?

Copy link
Contributor Author

@tatomyr tatomyr Jan 16, 2024

Choose a reason for hiding this comment

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

So users might see errors without changing their API description, is that correct?

Actually vice versa. We show an error when there's no error (due to wrong references caching). After the update, false errors should be gone.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK let's update the changelog entry to describe what the user might experience.

@tatomyr tatomyr requested a review from lornajane January 16, 2024 14:48
@tatomyr tatomyr force-pushed the fix/false-positive-media-type-examples-validation branch from 08e9ad8 to b7b58f6 Compare January 16, 2024 15:20
@tatomyr tatomyr force-pushed the fix/false-positive-media-type-examples-validation branch from b7b58f6 to 5532e55 Compare January 19, 2024 07:49
Copy link
Member

@RomanHotsiy RomanHotsiy left a comment

Choose a reason for hiding this comment

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

I checked the ajv code and our code again.

This looks like it should not break anything! 🎉

Let's merge.

Copy link
Contributor

@lornajane lornajane left a comment

Choose a reason for hiding this comment

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

Really happy to get this sorted out. Thanks!

Co-authored-by: Lorna Jane Mitchell <[email protected]>
@tatomyr tatomyr merged commit 5573a61 into main Jan 19, 2024
29 checks passed
@tatomyr tatomyr deleted the fix/false-positive-media-type-examples-validation branch January 19, 2024 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect validation error "Example validation errored: schema with key or id ... already exists"
4 participants