Skip to content

Comments

feat: add [ServiceName] attribute#1031

Merged
mayuki merged 1 commit intoCysharp:mainfrom
trimble-oss:issue-1029/service-naming
Feb 13, 2026
Merged

feat: add [ServiceName] attribute#1031
mayuki merged 1 commit intoCysharp:mainfrom
trimble-oss:issue-1029/service-naming

Conversation

@jeff-at-trimble
Copy link
Contributor

Closes #1029

Allow service interfaces with the same short name in different namespaces to coexist on the same server by specifying a custom gRPC service name.

  • Add ServiceNameAttribute to MagicOnion.Abstractions for overriding the default interface-name-based gRPC routing path
  • Add ServiceNameHelper to resolve the service name from the attribute at runtime (dynamic client and server)
  • Update MethodCollector to resolve the service name from the attribute at source-generation time (static client)
  • Add ServiceName property to IMagicOnionServiceInfo interface
  • Validate against null/whitespace in ServiceNameAttribute constructor
  • Add unit, server, and integration tests for both unary and hub scenarios

@mayuki
Copy link
Member

mayuki commented Feb 12, 2026

Thank you for your contribution! Can I add tests for the Source Generator and commit them?

@jeff-at-trimble
Copy link
Contributor Author

jeff-at-trimble commented Feb 12, 2026 via email

Closes Cysharp#1029

Allow service interfaces with the same short name in different namespaces
to coexist on the same server by specifying a custom gRPC service name.

- Add ServiceNameAttribute to MagicOnion.Abstractions for overriding
  the default interface-name-based gRPC routing path
- Add ServiceNameHelper to resolve the service name from the attribute
  at runtime (dynamic client and server)
- Update MethodCollector to resolve the service name from the attribute
  at source-generation time (static client)
- Add ServiceName property to IMagicOnionServiceInfo interface
- Validate against null/whitespace in ServiceNameAttribute constructor
- Add unit, server, and integration tests for both unary and hub scenarios
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configure/Override Service Naming

2 participants