Skip to content

Generate the admin API v2 OpenAPI validation hints in English regardl… - #54853

Merged
vmuzikar merged 1 commit into
keycloak:mainfrom
QuellcodeWanderer:openapi-validation-messages-locale
Nov 13, 2026
Merged

vmuzikar merged 1 commit into
keycloak:mainfrom
QuellcodeWanderer:openapi-validation-messages-locale

Conversation

@QuellcodeWanderer

Copy link
Copy Markdown
Contributor

I load the bundle with Locale.ROOT, which selects Hibernate Validator's base bundle. That bundle is English, which matches the committed openapi.json.

I fixed the locale in the scanner rather than in the Maven build (e.g. -Duser.language=en for the plugin), because the scanner is also used by the unit tests and from the IDE, and the existing tests already assume English texts.

The new test sets the default locale to German, builds descriptions and checks that they are in English. It fails without the fix. I also regenerated openapi.json with -Duser.language=de: without the fix 12 lines change, with the fix the file stays the same.

Closes #54852

…ess of the build locale

Closes keycloak#54852

Signed-off-by: Maximilian Brodda <QuellcodeWanderer@users.noreply.github.com>
@QuellcodeWanderer
QuellcodeWanderer requested review from a team as code owners November 8, 2026 20:28
Copilot AI balanced review requested due to automatic review settings November 8, 2026 20:28

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 block the change to make admin API v2 validation hints consistently English across build environments.

No open issues 🎉

What changed in this PR

Makes admin API v2 OpenAPI validation hints consistently English across build environments, addressing #54852 without relying on Maven locale settings.

Changes:

  • Loads Hibernate Validator’s English base bundle using Locale.ROOT.
  • Adds a regression test that checks English validation hints 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 English hints for blank and size constraints.
rest/​admin-v2/​services/​src/​main/​java/​org/​keycloak/​admin/​internal/​openapi/​ValidationAnnotationScanner.java Explicitly selects the base validation-message bundle with Locale.ROOT.

Review effort: Balanced

@vmuzikar vmuzikar 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.

LGTM, thank you for the contribution @QuellcodeWanderer!

@vmuzikar
vmuzikar merged commit a29205c into keycloak:main Nov 13, 2026
96 checks passed
ItsRoy69 pushed a commit to ItsRoy69/keycloak that referenced this pull request Nov 14, 2026
…ess of the build locale (keycloak#54853)

Closes keycloak#54852

Signed-off-by: Maximilian Brodda <QuellcodeWanderer@users.noreply.github.com>
Co-authored-by: Maximilian Brodda <QuellcodeWanderer@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

3 participants