Skip to content

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

Open
@elmattic

Description

@elmattic

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status

      Frozen

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions