Skip to content

Disabled renaming to camelcase for generateInterfaces/DataClasses functions - #1922

Merged
Jolanrensen merged 5 commits into
masterfrom
name-normalizer
Jul 9, 2026
Merged

Disabled renaming to camelcase for generateInterfaces/DataClasses functions#1922
Jolanrensen merged 5 commits into
masterfrom
name-normalizer

Conversation

@Jolanrensen

@Jolanrensen Jolanrensen commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1921

Changed NameNormalizer.default to id() instead of renameToCamelCase by delimiter.

I also tried to change this behavior in openapi-generator, since it also automatically renames accessors to camel case. This uncovered a bug with nullability, but that was also fixable.

@Jolanrensen Jolanrensen added this to the 1.0.0-Beta6 milestone Jul 7, 2026
@Jolanrensen Jolanrensen self-assigned this Jul 7, 2026
@Jolanrensen
Jolanrensen requested review from koperagen and zaleslaw July 8, 2026 10:50
@Jolanrensen Jolanrensen assigned Allex-Nik and unassigned Allex-Nik Jul 8, 2026
@Jolanrensen
Jolanrensen requested a review from Allex-Nik July 8, 2026 11:05
/**
* Performs no name normalization.
*
* (Inside the actual code generation, [ValidFieldName] is still used to prevent incompilable code from being generated)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think "actual" is a bit confusing, please try to reformulate without it

* (such as a nullable enum, whose nullability is defined by the type and cannot be removed by
* making a property required). Returns `false` for primitives and non-nullable markers.
*/
internal fun FieldType.refersToNullableMarker(getRefMarker: GetRefMarker, topInterfaceName: ValidFieldName): Boolean {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What caused tests to start failing? Is it because of changes in name normalization?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

No, because I removed snakeToLowerCamelCase() inside openapi-generator. I'm not exactly sure why, but it suddenly generated override val eye_color: EyeColor in Cat when I removed @ColumnName, which is incorrect because in the supertype eye_color is nullable. Adding this fix avoids that issue. Cat and Pet now have the same nullability for eye_color and since Cat : Pet, the property is omitted once again in the generation.

@Jolanrensen
Jolanrensen merged commit 4ccdcb0 into master Jul 9, 2026
5 checks passed
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.

NameNormalizer in generateDataClasses/generateInterfaces should not call renameToCamelCase

3 participants