Skip to content

support @HttpExchange based interfaces #439

Closed

Description

@hauner

https://docs.spring.io/spring-framework/reference/integration/rest-clients.html

generate interfaces with @HttpExchange and friends so it can be used on the client side.

Activity

  1. tedberg commented on Mar 18, 2026

    @tedberg

    I was just coming to request this. :)

    Requires Spring 6.1+, and became easier in Spring 7.
    https://www.danvega.dev/blog/http-interfaces-spring-boot-4

    The interface is very similar to the API one for controllers. The only gotcha I thought of was that you'd probably want it to have its own mapping file, not reusing the one for controllers.

    Since you are using reactive, I suppose this covers RestClient and WebClient.

  2. hauner commented on Mar 19, 2026

    @hauner
    MemberAuthor

    Just started on this a little bit... I haven't used it yet, so no idea where the issues will be. Still thinking it is just a matter of writing different annotations. ;-) What makes you think it will need its own mapping?

  3. tedberg commented on Mar 20, 2026

    @tedberg

    I've used this in a project with this generator. Mostly a copy/paste of the generated API and yes, replacing the interfaces, plus removing bean validator annotations.

    On the mapping, just because the overrides where you ignore the generated DTO in favor of an internal domain object. You'd likely not want to distribute those domain objects with your SDK, instead having clients use the generated objects. You might want a different base package also, but otherwise it looks like the settings would align.

  4. adzubla commented on Mar 20, 2026

    @adzubla
  5. hauner commented on Mar 20, 2026

    @hauner
    MemberAuthor

    I see, I didn't think that far yet. It is then probably unlikely that one would use the same interface for server- and client-side code. But use server/client specific mappings to best match the need of server/client.

    valuable feedback :-)

  6. tedberg commented on Mar 24, 2026

    @tedberg

    The openapi spec file will probably be different for server and client
    generation.

    That should not be the case. The point of Contract First development is to design a single contract that all parties will honor. Whether OpenAPI or gRPC, all clients and servers use the same contract document. We already use
    openapi-ts to generate TS clients and openapi-processor to generate the server. No adjustments are needed.

    The mapping.yaml is not part of the contract, its an implementation detail.

  7. adzubla commented on Mar 24, 2026

    @adzubla
  8. added this to the 2026.3 milestone on Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions