Skip to content

Conversation

@dsgrieve
Copy link
Contributor

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

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Oct 21, 2025
@timtebeek
Copy link
Member

Let me know when you're ready for a round of feedback!

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copy link
Member

@sambsnyd sambsnyd left a 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

import static org.openrewrite.java.Assertions.java;
import static org.openrewrite.java.Assertions.mavenProject;

class SpringfoxToSpringdocTransformationTest implements RewriteTest {
Copy link
Member

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.

@timtebeek timtebeek changed the title prototype recipe for transforming programmatic springfox to swagger v3 Convert Spring Fox's ApiInfoBuilder into Swagger's Info Oct 24, 2025
@timtebeek timtebeek added the recipe Recipe requested label Oct 24, 2025
Copy link
Member

@timtebeek timtebeek left a 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!

@github-project-automation github-project-automation bot moved this from In Progress to Ready to Review in OpenRewrite Oct 24, 2025
@dsgrieve dsgrieve marked this pull request as ready for review October 24, 2025 15:55
@timtebeek timtebeek merged commit 8aa7f38 into main Oct 24, 2025
2 checks passed
@timtebeek timtebeek deleted the transform-programmatic-springfox branch October 24, 2025 15:57
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

recipe Recipe requested

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants