Repository navigation
Fix generated admin API v2 OpenAPI document locale dependency (#54852) - #55002
Open
sanidhya02 wants to merge 2 commits into
Open
sanidhya02 wants to merge 2 commits into
sanidhya02 wants to merge 2 commits into
Conversation
…ak#54852) Signed-off-by: Sanidhya Gupta <sanidhyagupta@Sanidhyas-MacBook-Air.local>
Contributor
There was a problem hiding this comment.
🟢 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.jsonand caused unit test failures.Solution
ValidationAnnotationScannerto load Hibernate Validator'sValidationMessagesbundle explicitly withLocale.ROOT.ValidationAnnotationScannerTestverifying locale-independent English description generation when the JVM default locale is changed.