-
Notifications
You must be signed in to change notification settings - Fork 7
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
FR: Add spec validators for the WRP messages #84
FR: Add spec validators for the WRP messages #84
Conversation
* Validates requirements described at https://xmidt.io/docs/wrp/basics/#overarching-guidelines * Validates requirements described at https://xmidt.io/docs/wrp/basics/#locators * validates message type values * Does not cover validators for a specific message type (future prs)
* Clean up errors * Remove multierr with some wrapping and regular errors * Wrap SpecValidators within a func
…xample * update testUTF8Validator success case to contain a correct source * removed unused error list * removed nil struct field inits * added missing test cases for testValidateLocator * improved test descriptions for testValidateLocator * added missing test cases for TestSpecValidators * improved example
Codecov Report
@@ Coverage Diff @@
## main #84 +/- ##
==========================================
+ Coverage 49.67% 50.49% +0.82%
==========================================
Files 20 21 +1
Lines 3259 3313 +54
==========================================
+ Hits 1619 1673 +54
Misses 1469 1469
Partials 171 171
Continue to review full report at Codecov.
|
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.
Great start! The code itself looks good, mostly some structure and error suggestions.
* add unexported errors for `validateLocator` func to allow better/easier testing * improve error message for `validateLocator` func when values to match locator pattern * move `locatorPattern` var to the top of the file * convert vars `DestinationValidator SourceValidator MessageTypeValidator UTF8Validator AlwaysInvalid AlwaysValid` to funcs that return their validator & update their tests and code position (if needed) * Improve error message for `DestinationValidator SourceValidator` funcs
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.
💯 Looks great!
Overview
related to #25, #78, xmidt-org/scytale#88, xmidt-org/talaria#153 and builds on top of #80.
tl;dr
This pr introduces our wrp
spec validators
built with our validation framework introduced in #80 which only validates the opinionated portions of the spec. Clients can leverage these prebuilt validators to validate their messages.Explanation
Clients can leverage our prebuilt validators to validate their messages. One set of these validators are our
spec validators
:Type of Change(s)