Skip to content

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

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

feat(openrpc): curated description overrides for params, types, and results#145
akobrin1 wants to merge 2 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

akobrin1 and others added 2 commits May 15, 2026 16: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>
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 on lines +518 to +523
if ovr.Description != "" {
fieldSchema["description"] = ovr.Description
}
if ovr.Schema != nil {
fieldSchema = ovr.Schema
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Apply schema override before writing field description

When a type_overrides.json entry specifies both description and schema, the current order sets fieldSchema["description"] and then immediately replaces fieldSchema with ovr.Schema, which drops the curated description unless it is duplicated inside schema. This makes combined overrides behave incorrectly and can silently remove intended documentation for nested fields whenever authors provide both keys in one override entry.

Useful? React with 👍 / 👎.

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.

1 participant