Repository navigation
Conversation
closes: keycloak#43294 Signed-off-by: Steve Hawkins <shawkins@redhat.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Content negotiation can select explicitly excluded JSON, and YAML patch handling silently accepts extra documents instead of rejecting them before updating the client.
2 open issues
What changed in this PR
Adds header-driven YAML support to the experimental Admin API v2 client endpoints, addressing #43294 while retaining JSON support.
Changes:
- Adds YAML request and response types, serialization, and merge-patch parsing.
- Updates response media-type selection and the OpenAPI specification.
- Adds YAML integration tests and release notes.
| File | Description |
|---|---|
rest/admin-v2/tests/src/test/java/org/keycloak/tests/admin/client/v2/ClientApiV2YamlTest.java |
Tests YAML reads, writes, patches, and invalid requests. |
rest/admin-v2/services/src/main/java/org/keycloak/services/PatchType.java |
Adds the YAML merge-patch type. |
rest/admin-v2/services/src/main/java/org/keycloak/rest/admin/api/YamlMapperResolver.java |
Configures YAML serialization, including streamed results. |
rest/admin-v2/services/src/main/java/org/keycloak/rest/admin/api/client/DefaultClientsApi.java |
Enables YAML for client listing and creation. |
rest/admin-v2/services/src/main/java/org/keycloak/rest/admin/api/client/DefaultClientApi.java |
Enables YAML for individual clients and parses YAML patches. |
rest/admin-v2/api/src/main/java/org/keycloak/admin/api/PatchTypeNames.java |
Defines YAML media-type constants. |
rest/admin-v2/api/src/main/java/org/keycloak/admin/api/client/ClientsApi.java |
Advertises YAML on collection operations. |
rest/admin-v2/api/src/main/java/org/keycloak/admin/api/client/ClientApi.java |
Advertises YAML on individual-client operations. |
quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/integration/resteasy/SetResponseContentTypeHandler.java |
Selects response types using the Accept header. |
js/libs/keycloak-admin-client/openapi.json |
Documents YAML request and response formats. |
docs/documentation/release_notes/topics/27_0_0.adoc |
Explains YAML support and required headers. |
Review effort: Balanced
Comment on lines
+57
to
+60
| for (MediaType accepted : acceptable) { | ||
| for (MediaType produced : producesMediaTypes) { | ||
| if (produced.isCompatible(accepted)) { | ||
| return produced; |
|
|
||
|
|
||
| // only used to parse the patch document into a tree, the update itself is applied via MAPPER | ||
| private static final YAMLMapper YAML_MAPPER = new YAMLMapper(); |
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.

closes: #43294