-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Breaking change introduced by “Handle leading underscores in property names” #2163
Description
I believe the recent change to handle leading underscores in property names has introduced a breaking change in how the oapi-codegen generates structs. #1822
This renaming alters the generated code and breaks existing code that relies on the previous field names. While I understand the goal of avoiding duplicate names, this change modifies the generated code and therefore should be considered a breaking change.
Additionally, it exposes implementation details of the OpenAPI spec (like the underscore prefix) into the generated Go code, which can be undesirable when consumers expect normalized field names.
What I expected
The generated field names to stay consistent with previous behavior, or at least a clear note that this change breaks compatibility (e.g. via a major version bump or release note).
What happened
The generated code now prefixes fields with Underscore, breaking compatibility with previously generated code.
Suggestions
Maybe this behavior could be:
- Behind a flag, or
- Only enforced when duplicate fields are present, or
- Called out clearly in the changelog or release notes if it’s meant to be permanent