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: Map field edge-case #254

Merged
merged 2 commits into from
Apr 22, 2022
Merged

Conversation

Luminaar
Copy link
Contributor

@Luminaar Luminaar commented Jul 7, 2021

Hello! I've hit upon this weird edge-case when using betterproto in our project.
It took me a while to find the cause (especially realizing that the field name caused the problem)
but the solution is quite simple. I've tried to find a better way to check for the map field type
but was unable to find one (I'm not very familiar with the protobuf internals).

@Luminaar Luminaar mentioned this pull request Mar 29, 2022
3 tasks
Gobot1234
Gobot1234 previously approved these changes Mar 29, 2022
During the check wheter a field is a "map", the string "entry" is added to
the field name, checked against the type name and then further checks are
made against the nested type of a parent message. In this edge-case, the
first check would pass even though it shouldn't and that would cause an
error because the parent type does not have a "nested_type" attribute.
@Luminaar
Copy link
Contributor Author

Thank you for approving the PR. The tests are failing and I'm looking into it. Seems to be a problem with test data generation.

@Luminaar
Copy link
Contributor Author

Found the issue. The package directive was missing in my test proto file.

@Luminaar Luminaar requested a review from Gobot1234 March 29, 2022 11:21
@abn abn merged commit e7133ad into danielgtaylor:master Apr 22, 2022
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.

3 participants