-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support of References for AVRO Schemas #926
Open
libretto
wants to merge
10
commits into
Aiven-Open:main
Choose a base branch
from
instaclustr:avro_references2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5ab6ba0
Implementation of AVRO References support
libretto 2e69844
Merge branch 'main' into avro_references2
libretto 47e903f
Merge branch 'main' into avro_references2
libretto cba3c0d
merge with main
libretto 445519e
fixup after merge
libretto a1f659f
replace unions way with avro library
libretto ba4d640
Merge branch 'main' into avro_references2
libretto 22432f7
Merge branch 'main' into avro_references2
libretto 3b92077
Merge branch 'main' into avro_references2
libretto b85cc49
improve code
libretto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have realized now that it is possible to pass a list of schema strings to
avro.schema.parse()
:https://github.com/aiven/avro/blob/5a82d57f2a650fd87c819a30e433f1abb2c76ca2/lang/py/avro/schema.py#L1192
We currently use
parse()
to parse a single schema (seeparse_avro_schema_definition()
).When called with a list of schemas it returns a
UnionSchema
(throughmake_avsc_object()
), which itself contains a list of parsed schemas (UnionSchema.schemas
).The constructor of
UnionSchema
seems to be doing what we want (loop on the schemas, callmake_avsc_object()
and remembernames
).I think passing to
parse()
the reference schemas + the main schema (the main schema should be passed as last in the list) and then getting the last schema fromUnionSchema.schemas
should be equivalent to what's the PR now.If it works then we can delegate that logic to the Avro library
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed