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.
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
base: main
Are you sure you want to change the base?
Support of References for AVRO Schemas #926
Changes from 8 commits
5ab6ba0
2e69844
47e903f
cba3c0d
445519e
a1f659f
ba4d640
22432f7
3b92077
b85cc49
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
regex
does not seem to be usedThere 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
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.
resolve()
andbuild()
can be merged in a single method, sincebuilder()
is only called byresolve()
.Maybe the whole
AvroResolver
class can be just a static method?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
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.
@davide-armand After this change, we have a pylint issue but all tests are passed. Please check.
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