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: improve error messages #1536

Merged
merged 2 commits into from
Apr 25, 2024
Merged

fix: improve error messages #1536

merged 2 commits into from
Apr 25, 2024

Conversation

tatomyr
Copy link
Contributor

@tatomyr tatomyr commented Apr 23, 2024

What/Why/How?

When an assertion is supposed to run only on object keys and the assertion subject contains the property key, the error is - <the assertion name> can't be used on a single property. Please use 'property'.. which should be the other way around (thanks @adamaltman for pointing on that).
This PR fixes that, and also cleans up the error messages by removing needless periods and using better formatting.

Reference

Testing

Screenshots (optional)

Check yourself

  • Code changed? - Tested with redoc/reference-docs/workflows (internal)
  • All new/updated code is covered with tests
  • New package installed? - Tested in different environments (browser/node)

Security

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

Copy link

changeset-bot bot commented Apr 23, 2024

⚠️ No Changeset found

Latest commit: ed380df

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link
Contributor

github-actions bot commented Apr 23, 2024

Command Mean [ms] Min [ms] Max [ms] Relative
redocly lint packages/core/src/benchmark/benches/rebilly.yaml 995.4 ± 15.8 971.6 1019.0 1.00
redocly-next lint packages/core/src/benchmark/benches/rebilly.yaml 999.3 ± 25.6 979.2 1049.5 1.00 ± 0.03

validating /openapi.yaml...
Something went wrong when processing /Users/andrewtatomyr/Tests/redocly-cli-backup/__tests__/lint/assertions-property-key-not-allowed/openapi.yaml:

- The 'disallowed' assertion can't be used on properties. Please remove the 'property' key.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently the error is:

- disallowed can't be used on a single property. Please use 'property'..

validating /openapi.yaml...
Something went wrong when processing /Users/andrewtatomyr/Tests/redocly-cli-backup/__tests__/lint/assertions-property-key-required/openapi.yaml:

- The 'nonEmpty' assertion can't be used on all keys. Please provide a single property.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The current error is:
- nonEmpty can't be used on all keys. Please provide a single property.

Copy link
Contributor

github-actions bot commented Apr 23, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 77.05% 4451/5777
🟡 Branches 67.48% 2447/3626
🟡 Functions 70.73% 742/1049
🟡 Lines 77.24% 4185/5418

Test suite run success

734 tests passing in 102 suites.

Report generated by 🧪jest coverage report action from ed380df

@tatomyr tatomyr self-assigned this Apr 23, 2024
@tatomyr tatomyr marked this pull request as ready for review April 23, 2024 14:18
@tatomyr tatomyr requested a review from a team as a code owner April 23, 2024 14:18
@tatomyr tatomyr requested a review from adamaltman April 23, 2024 14:18
@tatomyr tatomyr force-pushed the fix/assertion-error-messages branch from 16f1e46 to ed380df Compare April 25, 2024 11:43
@tatomyr tatomyr merged commit 27ec10a into main Apr 25, 2024
30 checks passed
@tatomyr tatomyr deleted the fix/assertion-error-messages branch April 25, 2024 12:00
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.

None yet

3 participants