-
Notifications
You must be signed in to change notification settings - Fork 284
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
node rpc: validateresource #429
Conversation
Looks pretty good, playing with the branch locally and might add a test. Do you think some of these error message could be even more specific? |
How about |
06a704f
to
7bbfaa4
Compare
New commits pushed up, I followed similar error messaging to @boymanjor's suggestion here: |
9d4d64e
to
39df65f
Compare
This is ready for another round of review. I wrote tests for both success and failure cases. |
39df65f
to
0b147e1
Compare
Codecov Report
@@ Coverage Diff @@
## master #429 +/- ##
==========================================
+ Coverage 61.97% 61.98% +0.01%
==========================================
Files 129 129
Lines 34831 34843 +12
Branches 5918 5920 +2
==========================================
+ Hits 21587 21598 +11
- Misses 13244 13245 +1
Continue to review full report at Codecov.
|
Great work on this dude, thanks for the thorough test. Only thing left for me is the help message. |
This new node RPC will verify Resource json. It will be useful for users who are having trouble building the correct Resource.
These new error messages will help users more easily craft Resources. The error messages will be returned via the `validateresource` RPC.
Test the success cases and the failure cases.
c20ac1a
to
d5d9821
Compare
ACK @ d5d9821 |
This PR adds a new Node RPC method called
validateresource
. It is useful for users who are in the process of creating their resource JSON to use withsendupdate
. This PR adds error messages in thefromJSON
methods of each of the records found inlib/dns/resource.js
.The RPC accepts a single object with the
records
property, which must be an array of objects.Eventually, it could also accept a
version
property if another Resource version is implemented.The error messages note the invalid JSON property name and the record type. This is so that good error messages can be returned to users. The error messages could be made generic (not including the record type in the error message) but that would mean that the RPC method handler itself would have to hold logic similar to
Resource.fromJSON
and keep track of whichrecord
failed itsfromJSON
. I don't like this approach as much since any new resource type will require itsfromJSON
logic to be added to the RPC method handler but am willing to update this PR if people are strongly opinionated in that way.Closes #139