Skip to content

Conversation

SentryMan
Copy link
Collaborator

@SentryMan SentryMan commented Mar 26, 2025

mostly resolves #584 with a few caveats

  • won't generate client methods for controllers with a Context parameter
  • won't generate for controllers that use inherited API

There are some bugs to work out using this approach. It seems that during test compilation it causes the classes to get recompiled so inject complains with errors like No dependency provided for org.example.web.myapp.WebController on org.example.web.myapp.WebController$Route

@SentryMan
Copy link
Collaborator Author

It turns out that even trying the traditional way with an annotation doesn't work either. Might have to get creative

@SentryMan
Copy link
Collaborator Author

Figured it out by writing the source into a text file in target during compilation then loading and writing directly during test compilation.

@SentryMan SentryMan requested a review from rbygrave March 26, 2025 19:04
@SentryMan SentryMan marked this pull request as ready for review March 26, 2025 19:04
@SentryMan
Copy link
Collaborator Author

let me actually write a test first

@rbygrave
Copy link
Contributor

writing the source into a text file in target during compilation then loading ...

That was cunning!! Well done!!

@SentryMan SentryMan requested a review from rbygrave March 26, 2025 21:18
@SentryMan SentryMan merged commit 6571d95 into avaje:master Mar 26, 2025
6 checks passed
@SentryMan SentryMan deleted the test-client branch March 26, 2025 22:04
@rbygrave rbygrave added this to the 3.2 milestone Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New annotation to generate a test http client interface for a Controller

2 participants