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

Automated JSON-RPC schema validation on default responses #1863

Open
kdeme opened this issue Oct 26, 2023 · 0 comments
Open

Automated JSON-RPC schema validation on default responses #1863

kdeme opened this issue Oct 26, 2023 · 0 comments

Comments

@kdeme
Copy link
Contributor

kdeme commented Oct 26, 2023

It would be possible to create automated tests that verify if JSON-RPC APIs are compliant to the JSON-RPC specs.

Most (all?) specs are written in / using open-rpc and one way to do this could be:

  • Pick a call
  • grab the schema from the open-rpc.json for the specific call
  • validate this schema against the resulting json of the call with for example https://ajv.js.org

There is much more tooling around so perhaps there is something more obvious / commonly used available here.

Of course, the result of calls will depend on the state of the node. But I don't think the goal here is testing all possible outcomes of results but rather quick check if the defaults at least match the specification.

For Fluffy/Portal, it should be noted that there are already quite a bit of tests testing the most often used JSON-RPC calls. However, not in some autogenerated way.

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

No branches or pull requests

1 participant