Skip to content

Client API v2 Service Layer #44154

Closed
31 of 31 issues completed
Closed

Description

@vmuzikar

Description

The implementation of Client v2 created in #43167 leverages the original v1 API logic. This drastically limits the capabilities of v2 in terms of defaulting, validations, pagination, querying etc.

For v2 we need a dedicated service layer that will be built directly on top of the model layer, without the dependency on v1.

Goals

  • Remove the dependency on v1 from v2.
  • Create a dedicated service layer for v2 with corresponding behaviour to when v1 was used as the backend (i.e validations, eventing, auth, etc.).

Non-Goals

  • Add new features (pagination, querying, etc.) to v2.

Notes

No response

Sub-issues

Sub-issues

31 of 31 Issues completed
Loading 31 sub-issues

Activity

  1. added this to the 26.6.0 milestone on Nov 12, 2025
  2. stianst commented on Nov 19, 2025

    @stianst
    Contributor

    We could potentially revamp everything in Keycloak around using only interfaces together with some custom FasterXML serializer/deserializer and some Java proxies to get rid of all boilerplate code around model-to-representation and visa versa.

    We could also allow code to operate on the actual interfaces rather than using attributes. For example it could look something like this:

    MyCustomProtocolMapper
    
    ProtocolMapperModel model;
    MyCustomProtocolMapperRepresentation config = model.as(MyCustomProtocolMapperRepresentation.class);
    config.getMyCustomProperty();
    

    Main point here is that MyCustomProtocolMapperRepresentation is just an interface, it's not an implementation. That's handled through proxies.

    We have quite a lot of hacky boilerplate code not just in model-to-representation, but take identity providers for instance, and other places, where we can implementations that manually call getAttributes, etc.

    Let's figure out a proper way of defining contracts both for APIs and internally that uses interfaces only with some annotations. I know this is a big ask, but we can figure out a way to do this in stages.

    Another aspect here is we currently have custom components etc. that uses PropertyConfig or whatever; it would be nice if we get rid of this as well, and rather than creating a list of PropertyConfig you just define the config as a representation interface with some annotations. That means we can use the same interface in OpenAPI specs, and validation without having to check values manually in the code.

  3. 28 remaining items

  4. added this to the 26.7.0 milestone on Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Fields

No fields configured for milestone.

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions