-
Notifications
You must be signed in to change notification settings - Fork 153
feat(validation): implement validate function and SchemaValidationErr… #3662
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
feat(validation): implement validate function and SchemaValidationErr… #3662
Conversation
…or and add comprehensive unit tests for validate function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for the PR @VatsalGoel3, I left a few comments but nothing major.
--
Regarding your question about tests, I think you might've been mistakenly running both unit and end to end tests and because of this, it was trying to deploy resources to an AWS account.
If you want to run the tests for this package, use this command: npm run test:unit:coverage -w packages/validation
from the root of the project.
I have updated the code with the required changes. Please let me know if any other changes are needed. Thank you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for addressing the comments, a couple more things that were not addressed in the previous iteration - I made them clear.
Sorry for missing some changes; I updated them; also for the first line in index.ts, I had it because of the corresponding indes.test.ts; I have updated that test suite as well to match the updated index.ts |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@am29d need a second approval, because I made a commit to fix an import. |
Summary
Changes
This PR improves the validate function by:
Ensuring correct handling of JMESPath expressions in the envelope parameter.
Adding type safety for formats to comply with Ajv's expectations.
Adding necessary type assertions for payload validation.
Fixing potential issues related to schema compilation failures.
Additionally, it adds comprehensive unit tests to cover:
Basic validation with valid and invalid payloads.
Validation with an envelope extracting nested objects.
Handling of custom formats and external schemas.
Proper error handling when schema compilation or validation fails.
Issue number: closes #3607
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.