Skip to content

[BUG] [KOTLIN-SPRING] @HttpExchange in declarative interface does not support property placeholders#22882

Merged
wing328 merged 4 commits intoOpenAPITools:masterfrom
Picazsoo:bugfix/22879-httpExchange-does-not-support-placeholders
Feb 4, 2026
Merged

[BUG] [KOTLIN-SPRING] @HttpExchange in declarative interface does not support property placeholders#22882
wing328 merged 4 commits intoOpenAPITools:masterfrom
Picazsoo:bugfix/22879-httpExchange-does-not-support-placeholders

Conversation

@Picazsoo
Copy link
Contributor

@Picazsoo Picazsoo commented Feb 2, 2026

See #22879 for description of the issue. Basically the gist is:

  • get rid of placeholders in the class-level @HttpExchange annotation and replace it with the generated BASE_PATH property.
  • allow skipping of this class-level @HttpExchange annotation via requestMappingMode property. Hence allowing entirely custom base path if so desired
  • still make the original BASE_PATH available as a const val in companion object as it can be also set programatically as the base path into the webclient/restclient and this client can be reused in more places.

To make it clearer - as of now, generating with requestMappingMode = api_interface basically produces non-working code unless extra steps are taken when instantiating the interface by adding StringValueResolver via HttpServiceProxyFactory.builder()

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • File the PR against the correct branch: master (upcoming 7.x.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR solves a reported issue, reference it using GitHub's linking syntax (e.g., having "fixes #123" present in the PR description)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Summary by cubic

Fixes placeholder usage in Kotlin Spring @HttpExchange by switching to a generated BASE_PATH constant and optional interface-level mapping. This makes generated clients work with HttpServiceProxyFactory and avoids unresolved placeholders. Fixes #22879.

  • Bug Fixes
    • Generate BASE_PATH in each API interface and use it in @HttpExchange when requestMappingMode=api_interface.
    • Remove "${...}" placeholders from the template; import Companion.BASE_PATH where used.
    • Set requestMappingMode: "api_interface" for the wrapped sample; other samples keep only BASE_PATH with no interface annotation.
    • Update tests to assert the new import/annotation and to verify no annotation when requestMappingMode="none"; refresh samples accordingly.

Written for commit 121956c. Summary will update on new commits.

@Picazsoo Picazsoo marked this pull request as ready for review February 2, 2026 12:22
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 15 files

@Picazsoo Picazsoo changed the title [BUG] [KOTLIN-SPRING] @HttpExchange does not support property placeholders [BUG] [KOTLIN-SPRING] @HttpExchange in declarative interface does not support property placeholders Feb 2, 2026
@wing328 wing328 added this to the 7.20.0 milestone Feb 4, 2026
@wing328 wing328 merged commit a973d91 into OpenAPITools:master Feb 4, 2026
58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants