Skip to content
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

Fix typing in protobuf enum and message elements #761

Merged
merged 1 commit into from
Nov 20, 2023

Conversation

tvainika
Copy link
Contributor

About this change - What it does

Fix typing in protobuf enum and message elements

@tvainika tvainika marked this pull request as ready for review November 20, 2023 13:39
@tvainika tvainika requested review from a team as code owners November 20, 2023 13:39
from karapace.protobuf.compare_type_lists import compare_type_lists

if not isinstance(other, MessageElement):
result.add_modification(Modification.TYPE_ALTER)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question, which is the semantics of the compare?

In case of multiple changes, like for e.g. changing type and adding a field to the message do we just return the TYPE_ALTER?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line of code should be mostly unreachable as this is invoked from compare_type_lists and there is basically already if statement which checks both self and other of compare call are same type. But for safety it is better to repeat that here instead of adding assert IMHO because this would be right thing to do.

Copy link
Contributor

@eliax1996 eliax1996 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall seems fine, just want to make sure that the return its always fine and trying to understand which is the hierarcy between the diff elements

@eliax1996 eliax1996 merged commit ae1cb56 into main Nov 20, 2023
8 checks passed
@eliax1996 eliax1996 deleted the improve-typing-protobuf-message branch November 20, 2023 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants