Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Schema form.
contentEncoding replaces the legacy media.binaryEncoding.
fixed Go field sets.
keys; redundant wildcard schemas are removed.
may contain arbitrary JSON.
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.