You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Java] Class name / file name casing mismatch for acronyms causes compilation failure #7654
What are you generating using Kiota, clients or plugins?
API Client/SDK
In what context or format are you using Kiota?
Nuget tool
Client library/SDK language
Java
Describe the bug
The Java code generator produces files where the file name doesn't match the public class name inside, causing compilation to fail with:
error: class X is public, should be declared in a file named X.java
Acronyms (e.g., DLP, BI, MS365D) are likely cased inconsistently between JavaPathSegmenter.NormalizeFileName (which generates the file name) and CodeClassDeclarationWriter (which writes the class declaration). This results in 19 broken files under com.microsoft.graph.beta.models.security.
Expected behavior
The generated file name and public class name always match exactly.
This turned out to be a GitHub issue where file name casing changes are not detected as modifications.
As a result, when metadata type names changed casing—for example:
the corresponding class names inside the files were updated accordingly. However, Git did not recognize the casing change at the file name level.
This leads to a mismatch during generation:
But after running git add . in the pipeline, the file still appears as /models/security/PowerBiDlpAuditRecord.java in the pull request, because that file was originally committed using the older casing.
The recommended fix is to:
Remove the affected files in a commit/PR
Regenerate and re-add them in a subsequent run so the correct casing is preserved
This issue is particularly problematic in Java, where the file name must match the class name exactly. In .NET and other languages, similar discrepancies between class names and file names can occur, but they do not cause build or compile failures.
Unfortunately, we cannot enforce casing standards for enums or types in the metadata. One potential alternative would be to normalize casing during generation, but this would introduce breaking changes across multiple v1 API descriptions.
Closing the pull request as the solution is to instead add a check to our sdk's that prevent case changes such as that from being passed, especially in v1.0 as they present a binary breaking change.
Activity
ramsessanchez commentedon Apr 29, 2026
This turned out to be a GitHub issue where file name casing changes are not detected as modifications.
As a result, when metadata type names changed casing—for example:
the corresponding class names inside the files were updated accordingly. However, Git did not recognize the casing change at the file name level.
This leads to a mismatch during generation:
The recommended fix is to:
This issue is particularly problematic in Java, where the file name must match the class name exactly. In .NET and other languages, similar discrepancies between class names and file names can occur, but they do not cause build or compile failures.
Unfortunately, we cannot enforce casing standards for enums or types in the metadata. One potential alternative would be to normalize casing during generation, but this would introduce breaking changes across multiple v1 API descriptions.
ramsessanchez commentedon Apr 30, 2026
Closing the pull request as the solution is to instead add a check to our sdk's that prevent case changes such as that from being passed, especially in v1.0 as they present a binary breaking change.
ramsessanchez commentedon Apr 30, 2026
Keeping issue open in the meantime until this is resolved for Java Beta, and a fix is addressed in either SDK build checks or metadata validation.
ramsessanchez commentedon May 4, 2026
Created PR targeting a metadata quality check to address casing issues at the source.
microsoftgraph/msgraph-metadata#1094
ramsessanchez commentedon May 8, 2026
Metadata validation added and closed here: microsoftgraph/msgraph-metadata#1094