diff --git a/default/generated/eapxp6/180-eapxp_microprofile_openapi_4.0.mta.yaml b/default/generated/eapxp6/180-eapxp_microprofile_openapi_4.0.mta.yaml new file mode 100644 index 00000000..8643b31e --- /dev/null +++ b/default/generated/eapxp6/180-eapxp_microprofile_openapi_4.0.mta.yaml @@ -0,0 +1,110 @@ +- ruleID: eapxp_microprofile_openapi_4.0-00001 + description: "Incompatible changes to the Schema model API, reflecting changes in the OpenAPI v3.1 document format." + message: "Replace use of `nullable` property with `SchemaType.NULL`." + category: mandatory + effort: 1 + links: + - url: https://download.eclipse.org/microprofile/microprofile-open-api-4.0/microprofile-openapi-spec-4.0.html#incompatible_changes_40 + title: "Release Notes for MicroProfile OpenAPI 4.0" + when: + and: + - java.dependency: + name: org.eclipse.microprofile.openapi.microprofile-openapi-api + lowerbound: "1.0" + upperbound: "3.99" + - or: + - java.referenced: + pattern: org.eclipse.microprofile.openapi.models.media.Schema.getNullable + location: METHOD_CALL + - java.referenced: + pattern: org.eclipse.microprofile.openapi.models.media.Schema.setNullable + location: METHOD_CALL + - java.referenced: + pattern: org.eclipse.microprofile.openapi.models.media.Schema.nullable + location: METHOD_CALL +- ruleID: eapxp_microprofile_openapi_4.0-00002 + description: "Incompatible changes to the Schema model API, reflecting changes in the OpenAPI v3.1 document format." + message: "`type` property type changed from `SchemaType` to `List`." + category: potential + effort: 1 + links: + - url: https://download.eclipse.org/microprofile/microprofile-open-api-4.0/microprofile-openapi-spec-4.0.html#incompatible_changes_40 + title: "Release Notes for MicroProfile OpenAPI 4.0" + when: + and: + - java.dependency: + name: org.eclipse.microprofile.openapi.microprofile-openapi-api + lowerbound: "1.0" + upperbound: "3.99" + - or: + - java.referenced: + pattern: org.eclipse.microprofile.openapi.models.media.Schema.getType + location: METHOD_CALL + - java.referenced: + pattern: org.eclipse.microprofile.openapi.models.media.Schema.setType + location: METHOD_CALL + - java.referenced: + pattern: org.eclipse.microprofile.openapi.models.media.Schema.type + location: METHOD_CALL +- ruleID: eapxp_microprofile_openapi_4.0-00003 + description: "Incompatible changes to the Schema model API, reflecting changes in the OpenAPI v3.1 document format." + message: "`exclusiveMinimum` and `exclusiveMaximum` property types changed from `Boolean` to `BigDecimal`." + category: potential + effort: 1 + links: + - url: https://download.eclipse.org/microprofile/microprofile-open-api-4.0/microprofile-openapi-spec-4.0.html#incompatible_changes_40 + title: "Release Notes for MicroProfile OpenAPI 4.0" + when: + and: + - java.dependency: + name: org.eclipse.microprofile.openapi.microprofile-openapi-api + lowerbound: "1.0" + upperbound: "3.99" + - or: + - java.referenced: + pattern: org.eclipse.microprofile.openapi.models.media.Schema.getExclusiveMaximum + location: METHOD_CALL + - java.referenced: + pattern: org.eclipse.microprofile.openapi.models.media.Schema.setExclusiveMaximum + location: METHOD_CALL + - java.referenced: + pattern: org.eclipse.microprofile.openapi.models.media.Schema.exclusiveMaximum + location: METHOD_CALL + - java.referenced: + pattern: org.eclipse.microprofile.openapi.models.media.Schema.getExclusiveMinimum + location: METHOD_CALL + - java.referenced: + pattern: org.eclipse.microprofile.openapi.models.media.Schema.setExclusiveMinimum + location: METHOD_CALL + - java.referenced: + pattern: org.eclipse.microprofile.openapi.models.media.Schema.exclusiveMinimum + location: METHOD_CALL +- ruleID: eapxp_microprofile_openapi_4.0-00004 + description: "Default value of `@RequestBody.required` changed from `false` to `true` to reflect that this is the much more common case where a RESTful resource method accepts a request body." + message: "If `@RequestBody` of a resource method is not required, override new default value via `required = false`." + category: potential + effort: 1 + links: + - url: https://download.eclipse.org/microprofile/microprofile-open-api-4.0/microprofile-openapi-spec-4.0.html#incompatible_changes_40 + title: "Release Notes for MicroProfile OpenAPI 4.0" + when: + and: + - java.dependency: + name: org.eclipse.microprofile.openapi.microprofile-openapi-api + lowerbound: "1.0" + upperbound: "3.99" + - java.referenced: + pattern: org.eclipse.microprofile.openapi.annotations.parameters.RequestBody + location: ANNOTATION +- ruleID: eapxp_microprofile_openapi_4.0-00005 + description: "`/openapi` endpoint now serves documentation in OpenAPI v3.1 format." + message: "Static OpenAPI documents should conform to verson 3.1 of the OpenAPI specification." + category: potential + effort: 1 + links: + - url: https://download.eclipse.org/microprofile/microprofile-open-api-4.0/microprofile-openapi-spec-4.0.html#incompatible_changes_40 + title: "Release Notes for MicroProfile OpenAPI 4.0" + when: + builtin.file: + pattern: openapi\.(yaml|yml|json) + diff --git a/default/generated/eapxp6/ruleset.yaml b/default/generated/eapxp6/ruleset.yaml new file mode 100644 index 00000000..269e56fe --- /dev/null +++ b/default/generated/eapxp6/ruleset.yaml @@ -0,0 +1,7 @@ +name: eapxp6/eapxp5 +description: This ruleset provides analysis of Maven built applications when migrating from EAP XP 5 to 6. +labels: + - konveyor.io/source=eapxp + - konveyor.io/target=eapxp6+ + - konveyor.io/target=eapxp + diff --git a/default/generated/eapxp6/test/data/eapxp_microprofile_openapi_4.0/pom.xml b/default/generated/eapxp6/test/data/eapxp_microprofile_openapi_4.0/pom.xml new file mode 100644 index 00000000..f78b54c7 --- /dev/null +++ b/default/generated/eapxp6/test/data/eapxp_microprofile_openapi_4.0/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + + com.example + microprofile-openapi-example + 1.0.0 + war + + + + + jakarta.platform + jakarta.jakartaee-bom + 10.0.0 + import + pom + + + org.eclipse.microprofile + microprofile + 6.0 + import + pom + + + + + + + jakarta.ws.rs + jakarta.ws.rs-api + provided + + + org.kohsuke.metainf-services + metainf-services + 1.11 + provided + + + + org.eclipse.microprofile.openapi + microprofile-openapi-api + provided + + + + diff --git a/default/generated/eapxp6/test/data/eapxp_microprofile_openapi_4.0/src/main/java/org/konveyor/EchoResource.java b/default/generated/eapxp6/test/data/eapxp_microprofile_openapi_4.0/src/main/java/org/konveyor/EchoResource.java new file mode 100644 index 00000000..f32a098d --- /dev/null +++ b/default/generated/eapxp6/test/data/eapxp_microprofile_openapi_4.0/src/main/java/org/konveyor/EchoResource.java @@ -0,0 +1,25 @@ +package org.konveyor; + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; + +import org.eclipse.microprofile.openapi.annotations.media.Content; +import org.eclipse.microprofile.openapi.annotations.parameters.RequestBody; + +/** + * @author Paul Ferraro + */ +@Path("/echo") +@Produces(MediaType.TEXT_PLAIN) +public class EchoResource { + + @GET + @Path("{value}") + public String echo(@RequestBody(content = @Content(mediaType = "text/plain")) @PathParam("value") String value) { + return value; + } +} + diff --git a/default/generated/eapxp6/test/data/eapxp_microprofile_openapi_4.0/src/main/java/org/konveyor/TestApplication.java b/default/generated/eapxp6/test/data/eapxp_microprofile_openapi_4.0/src/main/java/org/konveyor/TestApplication.java new file mode 100644 index 00000000..e3acca97 --- /dev/null +++ b/default/generated/eapxp6/test/data/eapxp_microprofile_openapi_4.0/src/main/java/org/konveyor/TestApplication.java @@ -0,0 +1,13 @@ +package org.konveyor; + +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; + +/** + * @author Paul Ferraro + */ +@ApplicationPath("/test") +public class TestApplication extends Application { + +} + diff --git a/default/generated/eapxp6/test/data/eapxp_microprofile_openapi_4.0/src/main/java/org/konveyor/TestFilter.java b/default/generated/eapxp6/test/data/eapxp_microprofile_openapi_4.0/src/main/java/org/konveyor/TestFilter.java new file mode 100644 index 00000000..dada2b91 --- /dev/null +++ b/default/generated/eapxp6/test/data/eapxp_microprofile_openapi_4.0/src/main/java/org/konveyor/TestFilter.java @@ -0,0 +1,26 @@ +package org.konveyor; + +import org.eclipse.microprofile.openapi.OASFilter; +import org.eclipse.microprofile.openapi.models.media.Schema; +import org.kohsuke.MetaInfServices; + +/** + * @author Paul Ferraro + */ +@MetaInfServices(OASFilter.class) +public class TestFilter implements OASFilter { + + @Override + public Schema filterSchema(Schema schema) { + Schema.SchemaType type = schema.getType(); + schema.setType(type); + Boolean max = schema.getExclusiveMaximum(); + schema.setExclusiveMaximum(max); + Boolean min = schema.getExclusiveMinimum(); + schema.setExclusiveMinimum(min); + Boolean nullable = schema.getNullable(); + schema.setNullable(nullable); + return schema; + } +} + diff --git a/default/generated/eapxp6/test/data/eapxp_microprofile_openapi_4.0/src/main/webapp/WEB-INF/openapi.json b/default/generated/eapxp6/test/data/eapxp_microprofile_openapi_4.0/src/main/webapp/WEB-INF/openapi.json new file mode 100644 index 00000000..55609883 --- /dev/null +++ b/default/generated/eapxp6/test/data/eapxp_microprofile_openapi_4.0/src/main/webapp/WEB-INF/openapi.json @@ -0,0 +1,38 @@ +{ + "openapi" : "3.1.0", + "paths" : { + "/test/echo/{value}" : { + "get" : { + "parameters" : [ { + "name" : "value", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "OK", + "content" : { + "text/plain" : { + "schema" : { + "type" : "string" + } + } + } + } + } + } + } + }, + "info" : { + "title" : "Test application", + "description" : "This is my test application description", + "version" : "1.0" + }, + "servers" : [ { + "url" : "/test" + } ] +} + diff --git a/default/generated/eapxp6/test/data/eapxp_microprofile_openapi_4.0/src/main/webapp/WEB-INF/web.xml b/default/generated/eapxp6/test/data/eapxp_microprofile_openapi_4.0/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..1a90515b --- /dev/null +++ b/default/generated/eapxp6/test/data/eapxp_microprofile_openapi_4.0/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,11 @@ + + + + + diff --git a/default/generated/eapxp6/test/eapxp_microprofile_openapi_4.0.test.yaml b/default/generated/eapxp6/test/eapxp_microprofile_openapi_4.0.test.yaml new file mode 100644 index 00000000..be68dbe1 --- /dev/null +++ b/default/generated/eapxp6/test/eapxp_microprofile_openapi_4.0.test.yaml @@ -0,0 +1,33 @@ +rulesPath: ../eapxp_microprofile_openapi_4.0.mta.yaml +providers: + - name: java + dataPath: ./data/eapxp_microprofile_openapi_4.0 + - name: builtin + dataPath: ./data/eapxp_microprofile_openapi_4.0 +tests: + - ruleID: eapxp_microprofile_openapi_4.0-00001 + testCases: + - name: MP-OpenAPI-Schema-1 + hasIncidents: + exactly: 2 + - ruleID: eapxp_microprofile_openapi_4.0-00002 + testCases: + - name: MP-OpenAPI-Schema-2 + hasIncidents: + exactly: 2 + - ruleID: eapxp_microprofile_openapi_4.0-00003 + testCases: + - name: MP-OpenAPI-Schema-3 + hasIncidents: + exactly: 4 + - ruleID: eapxp_microprofile_openapi_4.0-00004 + testCases: + - name: MP-OpenAPI-RequestBody-1 + hasIncidents: + exactly: 1 + - ruleID: eapxp_microprofile_openapi_4.0-00005 + testCases: + - name: MP-OpenAPI-Document-1 + hasIncidents: + exactly: 1 +