8000 Fix generated admin API v2 OpenAPI document locale dependency (#54852) by sanidhya02 · Pull Request #55002 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Fix generated admin API v2 OpenAPI document locale dependency (#54852) - #55002

Open
sanidhya02 wants to merge 2 commits into
keycloak:mainfrom
sanidhya02:issue-54852-openapi-locale
Open

sanidhya02 wants to merge 2 commits into
keycloak:mainfrom
sanidhya02:issue-54852-openapi-locale

Conversation

@sanidhya02
Copy link
Copy Markdown

Fixes #54852

Rationale

Validation hints in the generated OpenAPI document of admin API v2 were previously loaded without an explicit locale, causing the JVM default locale of the build machine to be used.

On machines with non-English locales (e.g. German), this resulted in localized validation strings being written to openapi.json and caused unit test failures.

Solution

  • Updated ValidationAnnotationScanner to load Hibernate Validator's ValidationMessages bundle explicitly with Locale.ROOT.
  • Added a unit test in ValidationAnnotationScannerTest verifying locale-independent English description generation when the JVM default locale is changed.

…ak#54852)

Signed-off-by: Sanidhya Gupta <sanidhyagupta@Sanidhyas-MacBook-Air.local>
@sanidhya02
sanidhya02 requested review from a team as code owners November 10, 2026 16:20
Copilot AI balanced review requested due to automatic review settings November 10, 2026 16:20
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain for the change making OpenAPI validation descriptions independent of the build machine’s locale.

No open issues 🎉

What changed in this PR

Fixes #54852 by making admin API v2 OpenAPI validation descriptions consistently English, regardless of the build machine’s default locale.

Changes:

  • Loads Hibernate Validator’s message bundle explicitly with Locale.ROOT.
  • Adds a regression test that verifies English descriptions under a German default locale and restores the original locale afterward.
File Description
rest/​admin-v2/​services/​src/​test/​java/​org/​keycloak/​admin/​internal/​openapi/​ValidationAnnotationScannerTest.java Tests locale-independent validation descriptions.
rest/​admin-v2/​services/​src/​main/​java/​org/​keycloak/​admin/​internal/​openapi/​ValidationAnnotationScanner.java Uses the root locale when loading validation messages.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 11, 2026 03:39
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the change to make validation descriptions consistently English across build locales.

No open issues 🎉

Review effort: Balanced

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.

Generated admin API v2 OpenAPI document depends on the locale of the build machine

2 participants

0