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 private package name #276

Merged
merged 2 commits into from
Mar 3, 2025
Merged

Fix private package name #276

merged 2 commits into from
Mar 3, 2025

Conversation

goccy
Copy link
Member

@goccy goccy commented Mar 3, 2025

If multiple proto files are specified as arguments to protoc at the same time, there is a possibility of processing the same message defined in different packages. In this case, using only the grpc.federation.private package name would cause a name collision, so we generate the package name using the original package name. Additionally, since having the same file name in the Resolver results would cause an error, we ensure uniqueness by using the file name.

@goccy goccy requested review from Copilot and utahta March 3, 2025 00:49

Choose a reason for hiding this comment

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

PR Overview

This PR fixes package name collisions caused by using a common private package name by generating package names that include the original package name and by ensuring unique file names.

  • Renames keys from "grpc.federation.private." to "grpc.federation.private.org.federation." (or with similar namespace adjustments) across multiple generated files.
  • Updates mappings for various federation examples (validation, alias, async, oneof, literal, condition, map, autobind, multi‑user, error handler, code gen plugin, load, CEL plugin, custom resolver, multi‑service, timeout, simple, retry, and minimum) consistently to support the PR’s purpose.

Reviewed Changes

File Description
_examples/12_validation/federation/federation_grpc_federation.pb.go Updated package keys for custom handler and message arguments.
_examples/06_alias/federation/federation_grpc_federation.pb.go Renamed keys to include the original package name.
_examples/05_async/federation/federation_grpc_federation.pb.go Updated argument keys for various message types.
_examples/10_oneof/federation/federation_grpc_federation.pb.go Adjusted key names for oneof-related arguments.
_examples/08_literal/federation/federation_grpc_federation.pb.go Renamed literal argument keys.
_examples/14_condition/federation/federation_grpc_federation.pb.go Updated condition-related argument mapping keys.
_examples/13_map/federation/federation_grpc_federation.pb.go Updated mapping keys for list and post item arguments.
_examples/07_autobind/federation/federation_grpc_federation.pb.go Renamed keys in the autobind example.
_examples/09_multi_user/federation/federation_grpc_federation.pb.go Updated keys for multi‑user arguments.
_examples/17_error_handler/federation/federation_grpc_federation.pb.go Renamed error handler-related argument keys.
_examples/16_code_gen_plugin/federation/federation_grpc_federation.pb.go Renamed key in the code gen plugin mapping.
_examples/18_load/federation/federation_grpc_federation.pb.go Updated key names in the load example.
_examples/15_cel_plugin/federation/federation_grpc_federation.pb.go Renamed keys in the CEL plugin example.
_examples/03_custom_resolver/federation/federation_grpc_federation.pb.go Updated custom resolver key names (including federation.v2dev variants).
_examples/11_multi_service/federation/federation_grpc_federation.pb.go Updated keys for multi‑service federation.
_examples/11_multi_service/federation/other_grpc_federation.pb.go Consistently renamed keys in the other service file.
_examples/04_timeout/federation/federation_grpc_federation.pb.go Updated timeout example key names.
_examples/02_simple/federation/federation_grpc_federation.pb.go Updated simple federation keys for core messages.
_examples/19_retry/federation/federation_grpc_federation.pb.go Updated retry example mapping keys.
_examples/01_minimum/federation/federation_grpc_federation.pb.go Renamed key in the minimum example.

Copilot reviewed 38 out of 38 changed files in this pull request and generated no comments.

Copy link

github-actions bot commented Mar 3, 2025

Code Metrics Report

main (e841d01) #276 (23922de) +/-
Coverage 65.3% 65.3% +0.0%
Code to Test Ratio 1:0.3 1:0.3 -0.1
Test Execution Time 6m50s 6m52s +2s
Details
  |                     | main (e841d01) | #276 (23922de) |  +/-  |
  |---------------------|----------------|----------------|-------|
+ | Coverage            |          65.3% |          65.3% | +0.0% |
  |   Files             |             77 |             77 |     0 |
  |   Lines             |          13800 |          13803 |    +3 |
+ |   Covered           |           9017 |           9019 |    +2 |
- | Code to Test Ratio  |          1:0.3 |          1:0.3 |  -0.1 |
  |   Code              |          42407 |          42413 |    +6 |
  |   Test              |          15913 |          15913 |     0 |
- | Test Execution Time |          6m50s |          6m52s |   +2s |

Code coverage of files in pull request scope (82.1% → 82.1%)

Files Coverage +/-
resolver/file.go 86.4% +0.2%
resolver/message.go 70.9% 0.0%
resolver/resolver.go 83.4% -0.1%

Reported by octocov

@goccy goccy merged commit b4e8f00 into main Mar 3, 2025
3 checks passed
@goccy goccy deleted the fix-private-package-name branch March 3, 2025 03:01
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