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

Refactored AJV usages with an AJV wrapper that provides better error JSON validation messages. #378

Merged
merged 1 commit into from
Jul 11, 2024

Conversation

nhtruong
Copy link
Collaborator

@nhtruong nhtruong commented Jul 5, 2024

JsonSchemaValidator

  • Wrapper for AJV to streamline Json validation logic.
  • Collapse multiple required errors into one
  • Collapse multiple additionalProperties and unevaluatedProperties errors into one, and print out which properties are prohibited.
  • Make enum errors print out the supported enum values.

Issues Resolved

closes #364

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link
Contributor

github-actions bot commented Jul 5, 2024

Changes Analysis

Commit SHA: b1ba40c
Comparing To SHA: 32673b2

API Changes

Summary

NO CHANGES

Report

The full API changes report is available at: https://github.com/opensearch-project/opensearch-api-specification/actions/runs/9895698061/artifacts/1692047754

API Coverage

Before After Δ
Covered (%) 483 (47.31 %) 483 (47.31 %) 0 (0 %)
Uncovered (%) 538 (52.69 %) 538 (52.69 %) 0 (0 %)
Unknown 24 24 0

Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

I like it. The new Logger is the only must have.

tools/src/_utils/AjvErrorsParser.ts Outdated Show resolved Hide resolved
tools/src/linter/SchemasValidator.ts Show resolved Hide resolved
tools/src/tester/SchemaValidator.ts Outdated Show resolved Hide resolved
@nhtruong nhtruong marked this pull request as draft July 9, 2024 16:56
@nhtruong nhtruong force-pushed the ajv_errors_parser branch from 14e38fd to 2f28575 Compare July 10, 2024 16:32
@nhtruong nhtruong changed the title More informative JSON schema validation error messages Refactored AJV usages with an AJV wrapper that provides better error JSON validation messages. Jul 10, 2024
@nhtruong nhtruong force-pushed the ajv_errors_parser branch from 2f28575 to 623cf5a Compare July 10, 2024 19:10
@nhtruong nhtruong marked this pull request as ready for review July 10, 2024 19:12
@nhtruong
Copy link
Collaborator Author

@dblock This is now ready for review

dblock
dblock previously approved these changes Jul 10, 2024
Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

I made some nitty comments, address them before merging?

tools/src/_utils/AjvErrorsParser.ts Show resolved Hide resolved
tools/src/_utils/AjvErrorsParser.ts Outdated Show resolved Hide resolved
tools/src/linter/SchemasValidator.ts Outdated Show resolved Hide resolved
- Wrapper for AJV to streamline Json validation logic.
- Collapse multiple `required` errors into one
- Collapse multiple `additionalProperties` and `unevaluatedProperties` errors into one, and print out which properties are prohibited.
- Make `enum` errors print out the supported enum values.

Signed-off-by: Theo Truong <[email protected]>
@dblock dblock merged commit ece6d96 into opensearch-project:main Jul 11, 2024
9 of 10 checks passed
@nhtruong nhtruong deleted the ajv_errors_parser branch July 11, 2024 19:42
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.

[FEATURE] Failing story validation does not tell which property is unevaluated
2 participants