-
Notifications
You must be signed in to change notification settings - Fork 106
Convert Spring Fox's ApiInfoBuilder into Swagger's Info
#805
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
Conversation
src/main/java/org/openrewrite/java/spring/swagger/TransformApiInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/swagger/TransformApiInfo.java
Outdated
Show resolved
Hide resolved
|
Let me know when you're ready for a round of feedback! |
src/main/java/org/openrewrite/java/spring/swagger/TransformApiInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/swagger/TransformApiInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/swagger/TransformApiInfo.java
Outdated
Show resolved
Hide resolved
src/test/java/org/openrewrite/java/spring/swagger/SpringfoxToSpringdocTransformationTest.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/swagger/TransformApiInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/swagger/TransformApiInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/swagger/TransformApiInfo.java
Outdated
Show resolved
Hide resolved
src/test/java/org/openrewrite/java/spring/swagger/SpringfoxToSpringdocTransformationTest.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/swagger/TransformApiInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/swagger/TransformApiInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/swagger/TransformApiInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/swagger/TransformApiInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/swagger/TransformApiInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/swagger/TransformApiInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/swagger/TransformApiInfo.java
Outdated
Show resolved
Hide resolved
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
Looks like you're on the way to something that will work. I note that currently the build() method isn't being chopped off the end of the builder.
https://ge.openrewrite.org/s/2xgdkmv5v5uuu/tests/task/:test/details/org.openrewrite.java.spring.swagger.SpringfoxToSpringdocTransformationTest/transformApiInfo()?focused-exception-line=0-64&top-execution=1
src/main/java/org/openrewrite/java/spring/swagger/TransformApiInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/swagger/TransformApiInfo.java
Outdated
Show resolved
Hide resolved
| import static org.openrewrite.java.Assertions.java; | ||
| import static org.openrewrite.java.Assertions.mavenProject; | ||
|
|
||
| class SpringfoxToSpringdocTransformationTest implements RewriteTest { |
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.
Let's also have a test case where a method returns an incomplete builder which is finalized in another method.
src/main/java/org/openrewrite/java/spring/swagger/RemoveBuild.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/swagger/ReplaceContact.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/swagger/ReplaceContact.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/swagger/ReplaceLicenseUrl.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/swagger/TransformApiInfo.java
Outdated
Show resolved
Hide resolved
ApiInfoBuilder into Swagger's Info
src/main/java/org/openrewrite/java/spring/swagger/ReplaceLicenseUrl.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/swagger/ReplaceLicenseUrl.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/spring/swagger/ReplaceLicenseUrl.java
Outdated
Show resolved
Hide resolved
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.
Great to see this come together; thanks for all the help and feedback!
What's changed?
Adding recipes to handle transformation of programmatic use of Springfox API to equivalent swagger v3 API.
What's your motivation?
It is a common pattern in Springfox to do programmatic configuration as opposed to using annotations, or some combination of the two. The existing recipes handle the annotations, e.g. @apiinfo to @Info, but none for the direct use of the API.
Anything in particular you'd like reviewers to focus on?
The focus is on the most likely use case, which is that of doing programmatic configuration in lieu of using annotations.
Anyone you would like to review specifically?
Have you considered any alternatives or workarounds?
Any additional context
Springfox API for reference: https://github.com/springfox/springfox/blob/master/springfox-core/src/main/java/springfox/documentation
Swagger v3 API for reference: https://github.com/swagger-api/swagger-core/blob/master/modules/swagger-models/src/main/java/io/swagger/v3/oas/models
Checklist