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

Simplify check for Google::Protobuf::Map type #1538

Merged
merged 3 commits into from
Jun 20, 2023
Merged

Simplify check for Google::Protobuf::Map type #1538

merged 3 commits into from
Jun 20, 2023

Conversation

paracycle
Copy link
Member

Motivation

Fix #1533

Implementation

The key change is to use duck typing and treat any repeated field descriptor that has a lookup method, and looks up non-null fields named key and value as Map types.

Tests

Added a failing test that passed after the change.

@paracycle paracycle requested a review from a team as a code owner June 20, 2023 19:28
Copy link
Contributor

@bitwise-aiden bitwise-aiden left a comment

Choose a reason for hiding this comment

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

Small nit, but thanks for solving!

lib/tapioca/dsl/compilers/protobuf.rb Show resolved Hide resolved
spec/tapioca/dsl/compilers/protobuf_spec.rb Show resolved Hide resolved
…sage types

This makes sure that the failing test added in the previous commit does not fail due to typechecking, but fails due to actually generating a repeated field type and not a map type.
@paracycle paracycle enabled auto-merge June 20, 2023 21:30
@paracycle paracycle merged commit e0dfed3 into main Jun 20, 2023
13 of 29 checks passed
@paracycle paracycle deleted the uk-protobuf branch June 20, 2023 21:40
@shopify-shipit shopify-shipit bot temporarily deployed to production June 23, 2023 18:32 Inactive
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.

Google::Protobuf DSL generation broken again
2 participants