Skip to content

feat(openrpc): curated description overrides for params, types, and results#145

Open
akobrin1 wants to merge 4 commits into
masterfrom
feat/openrpc-curated-descriptions
Open

feat(openrpc): curated description overrides for params, types, and results#145
akobrin1 wants to merge 4 commits into
masterfrom
feat/openrpc-curated-descriptions

Conversation

@akobrin1
Copy link
Copy Markdown
Contributor

Summary

Replaces auto-generated "Go type: bool"-style descriptions in docs/openrpc.json with curated, Lumera-specific descriptions sourced from human-written JSON override files.

Three new override layers, all under docs/openrpc/:

File Keyed by Entries What it covers
param_overrides.json (method, param-name) 115 Every previously-ugly top-level param across debug_*, eth_*, miner_*, personal_*, txpool_*, web3_*.
type_overrides.json (Go type, field-name) types.TraceConfig (11) + types.ChainConfig (24) = 35 Nested struct fields. One entry deduplicates across every method that consumes the same struct (e.g. TraceConfig.debug is reused by all 5 debug_trace* methods).
result_overrides.json method 83 All previously-ugly result descriptions, with Lumera-specific notes (chain_id = 0x494c1a9, no-uncles post-merge, miner_* are no-ops on CometBFT, etc.).

Also moves the pre-existing docs/openrpc_examples_overrides.json into docs/openrpc/ for co-location and drops the redundant openrpc_ filename prefix.

Mechanism

Each override file is loaded once at generation time by tools/openrpcgen and applied as the highest-precedence layer, after AST source comments and the existing in-Go paramDescriptorOverride function. Missing entries fall through to the prior behavior — adoption is incremental.

Generator flags:

  • -params docs/openrpc/param_overrides.json
  • -types docs/openrpc/type_overrides.json
  • -results docs/openrpc/result_overrides.json

Updated Makefile passes all three by default; the Makefile inputs list also tracks the JSONs so docs/openrpc.json rebuilds when overrides change.

Effect

Metric Before After
Top-level params with "Parameter \...`. Go type: ..."` 115 0
Results with "Go type: ..." 83 0
Nested struct fields with "Go type: ..." 325 181 (remaining are seeds for future work: TransactionArgs, FilterCriteria, TypedData)

Test plan

  • make openrpc regenerates docs/openrpc.json and app/openrpc/openrpc.json.gz
  • jq confirms 0 top-level params and 0 results retain the "Go type: ..." default
  • Spot-check across reuse points (e.g. TraceConfig.debug reads identically in debug_traceCall, debug_traceBlockByHash, debug_traceTransaction)
  • go test ./tools/openrpcgen/... ./app/openrpc/... passes
  • make lint → 0 issues
  • OpenRPC playground (/openrpc.json endpoint) renders the new descriptions

Future work

Top remaining types with auto-generated nested-field descriptions, ranked by impact:

  • types.TransactionArgs (18 fields, appears in 7+ methods)
  • filters.FilterCriteria (5 fields, appears in eth_getLogs and eth_newFilter)
  • apitypes.TypedData (4 fields, appears in eth_signTypedData)

Each is one JSON entry away — no further code changes required.

🤖 Generated with Claude Code

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0cdd51328a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/openrpcgen/schema.go Outdated
akobrin1 and others added 2 commits May 18, 2026 11:58
…esults

Adds three JSON override files under docs/openrpc/ that let humans curate
JSON-RPC descriptions on top of the auto-generated `"Go type: ..."`
fallbacks the openrpcgen tool produces:

- param_overrides.json: per (method, param-name) descriptions; 115 entries
  covering every previously-ugly top-level param across debug_*, eth_*,
  miner_*, personal_*, txpool_*, web3_* namespaces.
- type_overrides.json: per (Go type, field) descriptions applied at every
  struct expansion site; seeded with types.TraceConfig (11 fields) and
  types.ChainConfig (24 fields). Type-keying deduplicates across all
  methods that consume the same struct.
- result_overrides.json: per-method result descriptions; 83 entries with
  Lumera-specific context (chain ID, no-uncles post-merge, miner_* are
  no-ops on CometBFT, etc.).

Mechanism: each override file is loaded once at generation time and
applied as the highest-precedence layer, after AST source comments and
existing type-based Go overrides. Missing entries fall through to the
prior behavior, so adoption is incremental.

Also moves the existing examples_overrides.json into docs/openrpc/ for
co-location and drops the redundant `openrpc_` filename prefix now that
the directory conveys it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Markdown sources under docs/evm-integration/ are now the canonical
reference; the standalone PDF was a stale snapshot.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@akobrin1 akobrin1 force-pushed the feat/openrpc-curated-descriptions branch from 0cdd513 to d610294 Compare May 18, 2026 16:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new “curated overrides” layer to the OpenRPC generator so human-authored JSON files can replace the auto-generated Go type: ... descriptions for method params, nested struct fields, and results, and regenerates docs/openrpc.json accordingly.

Changes:

  • Extend tools/openrpcgen to load/apply external JSON overrides for params, struct fields (type-keyed), and results (method-keyed).
  • Add curated override JSON files under docs/openrpc/ and relocate the examples overrides file into the same directory.
  • Update the Makefile OpenRPC generation rule/inputs and refresh docs/openrpc.json plus related documentation references.

Reviewed changes

Copilot reviewed 11 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tools/openrpcgen/type_overrides.go Adds loader/lookup for type+field keyed overrides and a global handle used during schema recursion.
tools/openrpcgen/schema.go Applies type-field overrides when expanding struct properties in JSON Schema.
tools/openrpcgen/param_overrides.go Adds loader/lookup for method+param overrides and method-keyed result overrides.
tools/openrpcgen/main.go Adds flags, loads override files at startup, and applies param/result overrides during descriptor building.
tools/openrpcgen/main_test.go Updates tests to the new collectMethods signature.
Makefile Wires new override files into the OpenRPC generation command and dependency inputs.
docs/openrpc/param_overrides.json Adds curated parameter descriptions (and optional schema/required knobs) by method+param.
docs/openrpc/type_overrides.json Adds curated nested-field descriptions keyed by Go type name + JSON field name.
docs/openrpc/result_overrides.json Adds curated result descriptions keyed by method name.
docs/openrpc/examples_overrides.json Relocates curated examples overrides under docs/openrpc/.
docs/openrpc.json Regenerated OpenRPC document reflecting curated descriptions and updated externalDocs URL.
docs/evm-integration/testing/tests/unit-openrpc.md Updates doc reference to the new examples overrides path.
docs/evm-integration/architecture/app-changes.md Updates the documented OpenRPC inputs list (but currently incomplete).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tools/openrpcgen/schema.go Outdated
Comment thread Makefile Outdated
Comment thread docs/evm-integration/architecture/app-changes.md
Comment thread tools/openrpcgen/main.go
a-ok123
a-ok123 previously approved these changes May 20, 2026
- Makefile: include all tools/openrpcgen/*.go (minus _test.go) in
  OPENRPC_GENERATOR_INPUTS so edits to schema.go / param_overrides.go /
  type_overrides.go invalidate the generated spec target.
- docs/evm-integration/architecture/app-changes.md: add the
  result_overrides.json input to the OpenRPC files list.
- tools/openrpcgen: add precedence tests covering param and result
  external JSON overrides (description / schema / required).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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

Successfully merging this pull request may close these issues.

3 participants