OpenAPITools / OpenAPITools/openapi-generator
[REQ] [kotlin-spring] Add clientRegistrationId for spring-declarative-http-interface (parity with Java spring)
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
When generating a Kotlin HTTP Interface client with kotlin-spring + library=spring-declarative-http-interface (Spring Boot 4 / Security 7), the generated API interfaces do not include @ClientRegistrationId. Without that annotation, Spring Security’s OAuth2 HTTP Service Client integration does not attach tokens for client_credentials (or other registrations).
The Java spring generator already supports this via clientRegistrationId (library=spring-http-interface, useSpringBoot4=true) — see PR #22726 and the spring generator docs. kotlin-spring has no equivalent option, so Kotlin users must post-process generated *Api.kt files.
Describe the solution you'd like
Add a clientRegistrationId config option to kotlin-spring with the same semantics as the Java spring generator:
- When set, and
library=spring-declarative-http-interface(with Boot 4 / Security 7 as required), emit@ClientRegistrationId("<id>")on the generated interface. - Document the option in
kotlin-springdocs.
Example:
generatorName: kotlin-spring
library: spring-declarative-http-interface
additionalProperties:
useSpringBoot4: "true"
interfaceOnly: "true"
clientRegistrationId: assistant
Expected:
@ClientRegistrationId("assistant")
interface DocumentsApi {
// ...
}
Describe alternatives you've considered
- Gradle
doLastworkaround: inject@ClientRegistrationIdinto generated*Api.ktafter generation (what we do today). - Switch the client generator to Java
spring+spring-http-interface(works, but mixes Java clients into a Kotlin service and splits server/client generators). - Manual/non-generated HTTP interfaces.
Additional context
- Spring Security docs: HTTP Service Clients Integration (
@ClientRegistrationIdon the interface or methods). - Java support: spring generator
clientRegistrationId, PR #22726. - Kotlin declarative HTTP interfaces: PR #22302 /
spring-declarative-http-interface; noclientRegistrationIdin kotlin-spring docs. - openapi-generator version:
7.25.0.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the Java spring generator's clientRegistrationId implementation with the kotlin-spring generator and its spring-declarative-http-interface templates. Update the Kotlin generator documentation and verify that the option emits @ClientRegistrationId on generated interfaces when the stated library and Spring Boot settings are used.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin, openapi, spring
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 74/100