Skip to content

improve the readability of generated gRPC client files #1021

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

Merged
merged 5 commits into from
Jun 24, 2025

Conversation

devoncarew
Copy link
Collaborator

Improve the readability of generated gRPC client files:

  • emit the method descriptors at the end of the client class definition (after the service methods)
  • emit the foo_Pre() and foo() methods together, instead of in separate parts of the service base class

@devoncarew
Copy link
Collaborator Author

It looks like pub publish --dry-run is having trouble w/ the goldens in test/ (which we don't expect to be analyzed):

Validating package...
  Package validation found the following potential issue:
  * line 16, column 1 of test/goldens/grpc_service.pbgrpc.dart: This package does not have grpc in the `dependencies` or `dev_dependencies` section of `pubspec.yaml`.
       ╷
    16 │ import 'package:grpc/service_api.dart' as $grpc;
       │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       ╵

We may need to move them into a directory which pub publish doesn't try to analyze, ignore the goldens somehow from the POV of pub, or make the files analyze correctly.

@mosuem
Copy link
Collaborator

mosuem commented Jun 24, 2025

We may need to move them into a directory which pub publish doesn't try to analyze, ignore the goldens somehow from the POV of pub, or make the files analyze correctly.

I think I normally do a test_data folder outside of test to avoid these kinds of issues. Not sure if it helps here.

@devoncarew
Copy link
Collaborator Author

I think I normally do a test_data folder outside of test to avoid these kinds of issues. Not sure if it helps here.

I think in this case it will not; we're running into issues w/ the validations for 'pub publish' not being configurable. Using test_goldens may be more hygenic however; perhaps a future refactoring.

@devoncarew devoncarew merged commit 269e004 into google:master Jun 24, 2025
16 checks passed
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Jun 26, 2025
Revisions updated by `dart tools/rev_sdk_deps.dart`.

ai (https://github.com/dart-lang/ai/compare/706d224..d0b89cf):
  d0b89cf  2025-06-25  Greg Spencer  Add enum support to `Schema` (dart-lang/ai#190)
  f219861  2025-06-26  Brett Morgan  Update `simple_server.dart` (dart-lang/ai#187)
  8e3365f  2025-06-24  Greg Spencer  Add error checks for accessing Request members (dart-lang/ai#184)

protobuf (https://github.com/dart-lang/protobuf/compare/0bfff0c..bce362d):
  bce362d  2025-06-24  Devon Carew  prep to publish 22.4.0 (google/protobuf.dart#1023)
  269e004  2025-06-24  Devon Carew  improve the readability of generated gRPC client files (google/protobuf.dart#1021)
  48ba649  2025-06-24  Devon Carew  update the header for generated files (google/protobuf.dart#1022)

webdev (https://github.com/dart-lang/webdev/compare/6dc3dde..7f376d2):
  7f376d24  2025-06-25  Derek Xu  Set package versions to WIP versions (dart-lang/webdev#2637)

Change-Id: Ib720f5127f3fddeb82b62cf13f24c3ddb4038e33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/437260
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
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.

2 participants