feat(generator/rust)!: use integers for enums#1448
Merged
coryan merged 4 commits intogoogleapis:mainfrom Mar 10, 2025
Merged
Conversation
Change the enums to be integer-based as opposed to string-based. This changes the API, so it is a breaking change. We need to make this change to support client libraries based on gRPC. Unknown enums are received as integers in that case. We need to make the change for all client libraries, as any of them may need to switch the underlying transport if they gain streaming RPCs.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main googleapis/google-cloud-rust#1448 +/- ##
=======================================
Coverage 66.74% 66.74%
=======================================
Files 39 39
Lines 2195 2195
=======================================
Hits 1465 1465
Misses 730 730 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dbolduc
approved these changes
Mar 10, 2025
Member
dbolduc
left a comment
There was a problem hiding this comment.
It seems correct that openapi/.../model.rs is not changing, but I did not find exactly why.
enums must not be included as enum here for openapi?
| var sysParams []systemParameter | ||
| if protobufSource { | ||
| sysParams = append(sysParams, systemParameter{ | ||
| Name: "$alt", Value: "json;enum-encoding=int", |
Collaborator
Author
That is because we do not convert anything in OpenAPI to enums. At least, not yet: googleapis/librarian#1597 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Change the enums to be integer-based as opposed to string-based. This
changes the API, so it is a breaking change. We need to make this change
to support client libraries based on gRPC. Unknown enums are received
as integers in that case. We need to make the change for all client
libraries, as any of them may need to switch the underlying transport if
they gain streaming RPCs.
Fixes #1379