From 3bc9d6b43909a3c1438b86af28ea6e4ee45e662d Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Sat, 10 Feb 2024 13:59:46 +0100 Subject: [PATCH] Consistently use package including swagger --- .../resources/META-INF/rewrite/swagger-2.yml | 26 +++++++++---------- .../ConvertApiResponseCodesToStringsTest.java | 17 +++++++++++- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/main/resources/META-INF/rewrite/swagger-2.yml b/src/main/resources/META-INF/rewrite/swagger-2.yml index 53d8b72..71a46eb 100644 --- a/src/main/resources/META-INF/rewrite/swagger-2.yml +++ b/src/main/resources/META-INF/rewrite/swagger-2.yml @@ -15,7 +15,7 @@ # type: specs.openrewrite.org/v1beta/recipe -name: org.openrewrite.openapi.SwaggerToOpenAPI +name: org.openrewrite.openapi.swagger.SwaggerToOpenAPI displayName: Migrate from Swagger to OpenAPI description: Migrate from Swagger to OpenAPI. tags: @@ -27,12 +27,12 @@ recipeList: - org.openrewrite.java.ChangeType: oldFullyQualifiedTypeName: io.swagger.annotations.Tag newFullyQualifiedTypeName: io.swagger.v3.oas.annotations.tags.Tag - - org.openrewrite.openapi.MigrateApiOperationToOperation - - org.openrewrite.openapi.MigrateApiResponsesToApiResponses - - org.openrewrite.openapi.MigrateApiImplicitParamsToParameters - - org.openrewrite.openapi.MigrateApiToTag - - org.openrewrite.openapi.MigrateApiParamToParameter - - org.openrewrite.openapi.MigrateApiModelPropertyToSchema + - org.openrewrite.openapi.swagger.MigrateApiOperationToOperation + - org.openrewrite.openapi.swagger.MigrateApiResponsesToApiResponses + - org.openrewrite.openapi.swagger.MigrateApiImplicitParamsToParameters + - org.openrewrite.openapi.swagger.MigrateApiToTag + - org.openrewrite.openapi.swagger.MigrateApiParamToParameter + - org.openrewrite.openapi.swagger.MigrateApiModelPropertyToSchema - org.openrewrite.java.ChangeType: oldFullyQualifiedTypeName: io.swagger.annotations.ApiModel newFullyQualifiedTypeName: io.swagger.v3.oas.annotations.media.Schema @@ -41,7 +41,7 @@ recipeList: --- type: specs.openrewrite.org/v1beta/recipe -name: org.openrewrite.openapi.MigrateApiOperationToOperation +name: org.openrewrite.openapi.swagger.MigrateApiOperationToOperation displayName: Migrate from @ApiOperation to @Operation description: Converts the @ApiOperation annotation to @Operation and converts the directly mappable attributes and removes the others. @@ -72,7 +72,7 @@ recipeList: --- type: specs.openrewrite.org/v1beta/recipe -name: org.openrewrite.openapi.MigrateApiResponsesToApiResponses +name: org.openrewrite.openapi.swagger.MigrateApiResponsesToApiResponses displayName: Migrate from @ApiResponses to @ApiResponses description: Changes the namespace of the @ApiResponses and @ApiResponse annotations and converts its attributes (ex. code -> responseCode, message -> description). @@ -98,7 +98,7 @@ recipeList: --- type: specs.openrewrite.org/v1beta/recipe -name: org.openrewrite.openapi.MigrateApiImplicitParamsToParameters +name: org.openrewrite.openapi.swagger.MigrateApiImplicitParamsToParameters displayName: Migrate from @ApiImplicitParams to @Parameters description: Converts @ApiImplicitParams to @Parameters and the @ApiImplicitParam annotation to @Parameter and converts the directly mappable attributes and removes the others. @@ -128,7 +128,7 @@ recipeList: --- type: specs.openrewrite.org/v1beta/recipe -name: org.openrewrite.openapi.MigrateApiToTag +name: org.openrewrite.openapi.swagger.MigrateApiToTag displayName: Migrate from @Api to @Tag description: Converts @Api to @Tag annotation and converts the directly mappable attributes and removes the others. tags: @@ -145,7 +145,7 @@ recipeList: --- type: specs.openrewrite.org/v1beta/recipe -name: org.openrewrite.openapi.MigrateApiParamToParameter +name: org.openrewrite.openapi.swagger.MigrateApiParamToParameter displayName: Migrate from @ApiParam to @Parameter description: Converts the @ApiParam annotation to @Parameter and converts the directly mappable attributes. tags: @@ -162,7 +162,7 @@ recipeList: --- type: specs.openrewrite.org/v1beta/recipe -name: org.openrewrite.openapi.MigrateApiModelPropertyToSchema +name: org.openrewrite.openapi.swagger.MigrateApiModelPropertyToSchema displayName: Migrate from @ApiModelProperty to @Schema description: Converts the @ApiModelProperty annotation to @Schema and converts the "value" attribute to "description". tags: diff --git a/src/test/java/org/openrewrite/openapi/swagger/ConvertApiResponseCodesToStringsTest.java b/src/test/java/org/openrewrite/openapi/swagger/ConvertApiResponseCodesToStringsTest.java index 3dcf9a7..8c516ea 100644 --- a/src/test/java/org/openrewrite/openapi/swagger/ConvertApiResponseCodesToStringsTest.java +++ b/src/test/java/org/openrewrite/openapi/swagger/ConvertApiResponseCodesToStringsTest.java @@ -1,3 +1,18 @@ +/* + * Copyright 2024 the original author or authors. + *

+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *

+ * https://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.openrewrite.openapi.swagger; import org.junit.jupiter.api.Test; @@ -11,7 +26,7 @@ class ConvertApiResponseCodesToStringsTest implements RewriteTest { @Override public void defaults(RecipeSpec spec) { - spec.recipeFromResources("org.openrewrite.openapi.MigrateApiResponsesToApiResponses") + spec.recipeFromResources("org.openrewrite.openapi.swagger.MigrateApiResponsesToApiResponses") .parser(JavaParser.fromJavaVersion().classpath("swagger-annotations-1.+", "swagger-annotations-2.+")); }