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

Add schema validations in forest-tool shed openrpc (including pattern, range, length, and array constraints). #53

Open
Tracked by #23
elmattic opened this issue Oct 29, 2024 · 1 comment

Comments

@elmattic
Copy link
Contributor

elmattic commented Oct 29, 2024

Our Forest node leverages RPC types for building a JSON-RPC API. To improve the robustness and clarity of these types, we propose adding decorators that enforce additional constraints on their format.

For instance, an EthHash type should be represented as a string containing 40 hexadecimal characters, prefixed with "0x", matching a given regex pattern (e.g., ^0x[a-fA-F0-9]{40}$). This would ensure consistency and help prevent incorrect data.

Acceptance Criteria

Following Forest types are making use of constraints and forest-tool shed openrpc can generate them:

  • EthInt64
  • EthHash
  • BlockHash
  • EthBytes
  • Bloom
  • EthAddress

Resources

https://json-schema.org/draft/2020-12/draft-bhutton-json-schema-validation-00#rfc.section.6.3
https://json-schema.org/draft/2020-12/draft-bhutton-json-schema-validation-00#numeric

@LesnyRumcajs
Copy link
Member

@elmattic Please elaborate on the issue, its requirements and acceptance criteria so it can be picked by anyone and estimated by the team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: New
Development

No branches or pull requests

2 participants