-
Notifications
You must be signed in to change notification settings - Fork 8
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
Migrate @SwaggerDefinition to @OpenAPIDefinition #25
Conversation
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.
Some suggestions could not be made:
- src/main/java/org/openrewrite/openapi/swagger/MigrateApiToTag.java
- lines 30-31
src/main/java/org/openrewrite/openapi/swagger/MigrateSwaggerDefinitionToOpenAPIDefinition.java
Outdated
Show resolved
Hide resolved
src/test/java/org/openrewrite/openapi/swagger/SwaggerToOpenAPITest.java
Outdated
Show resolved
Hide resolved
String servers = ""; | ||
if (basePath != null && host != null && schemes != null) { | ||
tpl.append("servers = {\n"); | ||
for (Expression scheme : ((J.NewArray) schemes).getInitializer()) { |
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.
If folks use schemes = SwaggerDefinition.Scheme.HTTPS
then this throws a class cast exception:
Caused by: java.lang.ClassCastException: class org.openrewrite.java.tree.J$FieldAccess cannot be cast to class org.openrewrite.java.tree.J$NewArray (org.openrewrite.java.tree.J$FieldAccess and org.openrewrite.java.tree.J$NewArray are in unnamed module of loader 'app')
at org.openrewrite.openapi.swagger.MigrateSwaggerDefinitionToOpenAPIDefinition$1.visitAnnotation(MigrateSwaggerDefinitionToOpenAPIDefinition.java:75)
at org.openrewrite.openapi.swagger.MigrateSwaggerDefinitionToOpenAPIDefinition$1.visitAnnotation(MigrateSwaggerDefinitionToOpenAPIDefinition.java:55)
at org.openrewrite.java.tree.J$Annotation.acceptJava(J.java:233)
at org.openrewrite.java.tree.J.accept(J.java:59)
at org.openrewrite.TreeVisitor.visit(TreeVisitor.java:250)
I think that's common enough to warrant proper handling here.
e7f0f89
to
b2444bc
Compare
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.
Some suggestions could not be made:
- src/main/java/org/openrewrite/openapi/swagger/MigrateApiToTag.java
- lines 30-31
src/main/java/org/openrewrite/openapi/swagger/AnnotationUtils.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/openapi/swagger/MigrateSwaggerDefinitionToOpenAPIDefinition.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/openapi/swagger/MigrateSwaggerDefinitionToOpenAPIDefinition.java
Outdated
Show resolved
Hide resolved
src/test/java/org/openrewrite/openapi/swagger/SwaggerToOpenAPITest.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 @SiBorea ! Thanks a lot for the continued work here.
What's changed?
This recipe migrate
@SwaggerDefinition
to@OpenAPIDefinition
basePath
,host
andschemes
intoservers
consumes
andproduces
, leave the others untouchedio.swagger.annotations.Info
toio.swagger.v3.oas.annotations.info.Info
Ref: https://support.intershop.com/kb/index.php/Display/2914L4
Checklist