Skip to content

feat(generator/dart): handle encoding and decoding the 'bytes' data type#1630

Merged
devoncarew merged 4 commits intogoogleapis:mainfrom
devoncarew:bytes_data_type
Mar 31, 2025
Merged

feat(generator/dart): handle encoding and decoding the 'bytes' data type#1630
devoncarew merged 4 commits intogoogleapis:mainfrom
devoncarew:bytes_data_type

Conversation

@devoncarew
Copy link
Copy Markdown
Contributor

@devoncarew devoncarew commented Mar 27, 2025

Opening this as a draft PR aince after implementing this I'm second guessing introducing a new Bytes class. We could just as easily always JSON encode / decode to the existing Dart Uint8List type.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.70%. Comparing base (afbc2bb) to head (e7bdcfa).
Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1630      +/-   ##
==========================================
- Coverage   95.72%   92.70%   -3.02%     
==========================================
  Files          43       48       +5     
  Lines        1825     2016     +191     
==========================================
+ Hits         1747     1869     +122     
- Misses         78      147      +69     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@devoncarew
Copy link
Copy Markdown
Contributor Author

I'm likely going to switch this to just encoding and decoding directly from Uint8List.

@devoncarew devoncarew marked this pull request as ready for review March 29, 2025 06:57
Comment on lines +577 to +578
} else if isBytes {
return "encodeBytes(" + name + bang + ")"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is more a comment about line 571... map<... , bytes> is legal proto, and they do appear in Google Cloud APIs:

https://github.com/googleapis/googleapis/blob/2b63b9276dca4d5046470fe5e1022bd982629f62/google/cloud/confidentialcomputing/v1/service.proto#L291

I am not sure if we are handling this correctly, if not, fixing that is not urgent.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think we would handle it correctly; I'll open an issue to track it.

@devoncarew devoncarew merged commit 215f5cd into googleapis:main Mar 31, 2025
20 checks passed
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.

handle BYTES_TYPE (BytesValue?) in codegen

2 participants