-
Notifications
You must be signed in to change notification settings - Fork 3
Add JSON Schemas for Bitcoin Kernel Bindings Test Handler Protocol #10
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
base: main
Are you sure you want to change the base?
Conversation
cada2d7 to
83c9b5b
Compare
|
Concept ACK. Thank you for working on this! I took a brief look to compare pure JSON Schema versus OpenRPC for our use case (per #7 (comment)). It looks like using pure JSON Schema provides mature tooling for type generation across different languages for our handler implementations, as well as good documentation generation capabilities. OpenRPC seems to facilitate more than just type generation - like server-side code generation (in our case, servers being handlers) that generates more boilerplate for request handling. However, existing tooling and generation support appears to be less mature and to be limited to a few languages. Perhaps @stickies-v can correct me if I'm overlooking any clear benefit OpenRPC would provide over a pure JSON Schema approach in this context. |
No strong opinion. I'm not really familiar with the json schema or openrpc ecosystems, it just looked like we're pretty close to json schema compatibility already so i thought it'd be worthwhile keeping an eye out for that so users can more easily use existing tooling. Also I think if any support for json schema or openrpc (or anything else) is added, internal adherence should be enforced through tests. If that's too much work / not feasible right now, we shouldn't commit to the schema either - at most just a mention that we're aiming for it. (edit: royal "we", i'm just sharing thoughts, not really doing the work) |
I'm also willing to look into openRPC, haven't done that before but it can be more suitable for this new situation (the dynamic json-rpc ). Will look into it.
Agree on the enforcement by tests. Let me tinker a bit more to see if what is possible. |
|
As a prerequisite to adding tests to validate the json files against schema definitions and following the discussion here, I think it makes sense I refactor the existing json files such that each test case has the following format: {
"request": {
"id": "",
"method": "",
"params": {}
},
"expected_response": {
"result": ""
}
}Instead of the current format (where request and response are composed by the go runner): {
"id": "",
"method": "",
"params": {},
"expected": {
"result": ""
}
} |
Addressed in #12. |
Added 2 schemas that represent the request and responses json following the test handler spec 0.0.3.
These json schema's can be used to validation and test the downstream solutions.