Skip to content

refactor(openrpc): replace legacy reflection stack - #13717

Open
rvagg wants to merge 2 commits into
masterfrom
rvagg/lotus-openrpc-generator
Open

rvagg wants to merge 2 commits into
masterfrom
rvagg/lotus-openrpc-generator

Conversation

@rvagg

@rvagg rvagg commented Jul 17, 2026

Copy link
Copy Markdown
Member

github.com/etclabscore/go-openrpc-reflect is a dead project and brings in
legacy dependency weight and risk. It's also using older OpenRPC forms and
responsible for some of our OpenRPC inaccuracies / violations.

This replaces that package with a minimal, local version that nearly gets
the same OpenRPC output but addresses a few issues:

  • Singleton type arrays become scalar strings, the canonical equivalent JSON
    Schema form.
  • Slice items become a single schema rather than a tuple
  • Byte slices become base64 strings, matching encoding/json;
    contentEncoding replaces the legacy media.binaryEncoding.
  • Structs gain explicit properties and closed-object rules, matching their
    fixed Go field sets.
  • Maps use additionalProperties for values, with numeric patterns for integer
    keys; redundant wildcard schemas are removed.
  • json.RawMessage and interface{} lose incorrect type constraints because they
    may contain arbitrary JSON.
  • Recursive schemas are inlined and bounded with a permissive schema, avoiding
    local references that break legacy consumers.

Schema keyword ordering changes with the new reflector, but it's deterministic
so it's not going to churn beyond this one. I'm not attempting to match all
the quirks of the old one.


Caveat: this code almost all written by Sol and I haven't done as thorough review as I'd like. I've just been watching the output it generates to assess correctness. Flagging because it doesn't have my explicit sign-off yet but I don't want this lost on my computer.

rvagg added 2 commits July 17, 2026 13:20
github.com/etclabscore/go-openrpc-reflect is a dead project and brings in
legacy dependency weight and risk. It's also using older OpenRPC forms and
responsible for some of our OpenRPC inaccuracies / violations.

This replaces that package with a minimal, local version that _nearly_ gets
the same OpenRPC output but addresses a few issues:

- Singleton type arrays become scalar strings, the canonical equivalent JSON
  Schema form.
- Slice items become a single schema rather than a tuple
- Byte slices become base64 strings, matching encoding/json;
  contentEncoding replaces the legacy media.binaryEncoding.
- Structs gain explicit properties and closed-object rules, matching their
  fixed Go field sets.
- Maps use additionalProperties for values, with numeric patterns for integer
  keys; redundant wildcard schemas are removed.
- json.RawMessage and interface{} lose incorrect type constraints because they
  may contain arbitrary JSON.
- Recursive schemas are inlined and bounded with a permissive schema, avoiding
  local references that break legacy consumers.

Schema keyword ordering changes with the new reflector, but it's deterministic
so it's not going to churn beyond this one. I'm not attempting to match all
the quirks of the old one.
@github-project-automation github-project-automation Bot moved this to 📌 Triage in FilOz Jul 17, 2026
Base automatically changed from rvagg/jsonyamldeps to master July 17, 2026 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 📌 Triage

Development

Successfully merging this pull request may close these issues.

1 participant