openrpc-stub-gen

!WIP!

OpenRPC spec

JSON-RPC spec

StarkNet OpenRPC spec

NOTE: The fix is necessary to make existing spec a valid OpenRPC spec.

Usage

```

git restore examples/gen.rs

manually remove mod gen from the examples/gen.rs (generated code is commited now)

cargo run -- CODE ./api/starknetapiopenrpc.json ./api/starknetwriteapi.json ./api/starknettraceapi_openrpc.json >> examples/gen.rs && cargo fmt cargo run --example gen ```

cargo run -- CODE ./api/eth.json >> examples/eth.rs && cargo fmt

cargo run -- TREE ./api/starknet_api_openrpc.json ./api/starknet_write_api.json > tree.txt

cargo run -- JSON ./api/test/input.openrpc 2>/dev/null | jq . > debug.json diff <(jq --sort-keys . ./api/test/input.openrpc) <(jq --sort-keys . debug.json)

TODO

  1. [ ] validation of schema.{minimum, maximum}
  2. [ ] async version of trait & handlers
  3. [ ] Seamless inclusion into a build process

DONE

Misc

Total lines of code: find . -type f -name "*.rs" | xargs grep . | wc -l