-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add springboot's http interface generator #383
base: master
Are you sure you want to change the base?
Conversation
generatedAnnotationFile() | ||
) | ||
|
||
private fun generatedAnnotationFile(): SimpleFile { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The @GeneratedClient
annotation is not required for the feature itself, but SpringBoot often has use cases where classes are searched for using annotations, and this is what it is for
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this annotation defined? I cannot see any class imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is generated in the same location as the client's interface.
Since they are in the same package, there should be no need for an import statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not so sure about this, it feels wrong to be generating a random annotation just in case it is useful. Could developers instead define their own annotation and add it to the implementation classes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, like creating an option like --http-client-annotations <annotation FQCN>
and annotating the generated clients?
It seems useful not only for this client type, so I'll do it in another PR and revert it in this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened #386 and revert @GeneratedClient
in this PR
src/main/kotlin/com/cjbooms/fabrikt/generators/client/ClientGeneratorUtils.kt
Show resolved
Hide resolved
Thanks for the contribution, happy to accept this. Few minor questions |
c9b8bda
to
3b1c712
Compare
3b1c712
to
3daa162
Compare
SpringBoot's HTTP Interface is a declarative http client like Retrofit or OpenFeign.
https://docs.spring.io/spring-framework/reference/integration/rest-clients.html#rest-http-interface
Since SpringBoot has now removed OpenFeign from the official project and seems to be focusing on this HTTP Interface, we thought it reasonable to add support for it and implemented it.
This client supports ResponseEntity and suspend methods, so we move the relevant code to ClientGeneratorUtils and so on.