Skip to content

enhance: add yaml support to v2 - #55061

Draft
shawkins wants to merge 1 commit into
keycloak:mainfrom
shawkins:iss43294
Draft

shawkins wants to merge 1 commit into
keycloak:mainfrom
shawkins:iss43294

Conversation

@shawkins

Copy link
Copy Markdown
Contributor

closes: #43294

closes: keycloak#43294

Signed-off-by: Steve Hawkins <shawkins@redhat.com>

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.

🟡 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();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team/admin-api-wg Admin API v2 Working Group team/cloud-native

Projects

None yet

Development

Successfully merging this pull request may close these issues.

YAML support for Client v2

2 participants