Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@raphael
Copy link
Member

@raphael raphael commented Aug 30, 2025

Summary

  • Prevents naming collisions when multiple OneOf variants share the same label/name across services or payload/result contexts.
  • Ensures generator produces unique, stable names for types, fields, and constructor helpers derived from OneOf variants.

Details

  • Adjusts codegen to disambiguate variant-derived identifiers while preserving backwards compatibility where no collision exists.
  • Adds/updates tests to cover overlapping variant names and cross-service reuse.
  • No runtime behavior changes; affects only generated identifier names where previously ambiguous.

Why

  • Prior behavior could produce conflicting identifiers leading to compile failures in generated code when distinct OneOf definitions included identically named variants.

Notes

  • No breaking changes expected for existing projects without collisions.

- Updated OneOf name generation to avoid collisions with member field names by appending "_oneof" if necessary.
- Enhanced protoBufNativeGoTypeName and protoNativeType functions to treat Goa Any as bytes for stability in protobuf and Go type generation.
- Utilized slices.Contains for checking field name collisions.

Tests: All unit tests pass.
@raphael raphael enabled auto-merge (squash) August 30, 2025 17:15
@raphael raphael merged commit b623476 into v3 Aug 30, 2025
7 checks passed
@raphael raphael deleted the fix/oneof_collision branch August 30, 2025 17:17
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.

1 participant