Conversation
- generateAvroSchema: drop the no-references fast path. SchemaCache.Parse with an empty cache is equivalent to avro.Parse, so one path covers both cases. - parseAvroReferences: track in-progress references on a stack (added on entry, deleted on exit) and return an explicit "circular avro schema reference detected" error on cycle hits. The old code used a monotonically-growing "seen" set with `continue`, which avoided infinite loops but silently dropped cyclic branches and then failed further down with a cryptic parse error. Also track a separate "parsed" set to avoid redundant registry fetches on shared subgraphs (e.g. A->B->D and A->C->D). - Wrap errors with %w instead of %v so errors.Is/As can walk the chain.
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.
Summary
Routine maintenance bump from v1.3.4 to v1.4.1 for rpk's Avro serde.
v1.4.1 release notes: https://github.com/twmb/avro/releases/tag/v1.4.1
v1.4.1 fixes an edge case where records with zero fields emitted as
{"type":"record","name":"x"}(missing the requiredfieldsattribute), which strict Avro readers reject. rpk is highly unlikely to hit this in practice —pkg/serde/avro.goparses schemas from schema registry and produces/consumes records, and empty-record schemas are rare in normal data. Primarily a "stay current" bump.v1.4.0 (also included) added atype subpackage, SchemaNode struct-literal construction, case-insensitive JSON parsing for janky encoders, duplicate-JSON-key tolerance, and named-type dedup. None of these change behavior for rpk's existing usage.
Test plan
go mod tidycleango build ./...cleango test ./pkg/serde/...passes