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: rendering mock values for recursive messages no longer crashes #587

Merged
merged 3 commits into from
Sep 3, 2020

Conversation

software-dov
Copy link
Contributor

@software-dov software-dov commented Sep 3, 2020

Protobuf allows recursive message types, i.e. messages whose fields
are of the same type as the message itself.

message Foo {
    Foo foo = 1; // Degenerate case
}

A real world example is bigquery.v2.data:RowFilter

These recursive types cause a problem when trying to render
mock values for unit tests because there's no inherent limit on
when to stop rendering nested values.
The solution in this commit is an artifical cap on the depth of
recursion in rendering mock values.

Protobuf allows recursive message types, i.e. messages whose fields
are of the same type as the message itself.

message Foo {
    Foo foo = 1; // Degenerate case
}

A real world example is bigquery.v2.data:RowFilter

The solution in this commit is an artifical cap on the depth of
recursion in rendering mock values.
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Sep 3, 2020
@codecov
Copy link

codecov bot commented Sep 3, 2020

Codecov Report

Merging #587 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #587   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           26        26           
  Lines         1508      1519   +11     
  Branches       308       309    +1     
=========================================
+ Hits          1508      1519   +11     
Impacted Files Coverage Δ
gapic/schema/wrappers.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 299393b...ec84f8c. Read the comment docs.

@busunkim96
Copy link
Contributor

Does it make sense to add a message like this to https://github.com/googleapis/gapic-showcase?

@software-dov
Copy link
Contributor Author

It definitely sounds like a good idea to add a recursive showcase message type. I'll file an issue there.

@software-dov
Copy link
Contributor Author

Showcase issue tracked by googleapis/gapic-showcase#449

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants