Skip to content

Commit

Permalink
[234] Create rules detecting use of MicroProfile OpenAPI to facilitat…
Browse files Browse the repository at this point in the history
…e EAP XP5->6 migration.
  • Loading branch information
pferraro committed Jan 13, 2025
1 parent 4198c48 commit a4a9866
Show file tree
Hide file tree
Showing 8 changed files with 167 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
- category: mandatory
customVariables: []
description: MicroProfile OpenAPI 4.0
effort: 1
labels:
- konveyor.io/source=eapxp
- konveyor.io/target=eapxp6
- konveyor.io/target=eapxp
- JBossEAP
- EAPXP
links: []
message: When migrating an application making use of MicroProfile OpenAPI to JBoss EAP XP 6.0 (or later), please note that MicroProfile OpenAPI 4.0 introduces potentially incompatible changes as documented. See https://download.eclipse.org/microprofile/microprofile-open-api-4.0/microprofile-openapi-spec-4.0.html#incompatible_changes_40
ruleID: eapxp_microprofile_openapi_4.0-00001
when:
or:
- java.dependency:
name: org.eclipse.microprofile.openapi.microprofile-openapi-api
lowerbound: 0.0.0
- builtin.file:
pattern: openapi\.(yaml|yml|json)
2 changes: 2 additions & 0 deletions default/generated/eapxp6/ruleset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name: eapxp6
description: This ruleset provides analysis of Maven built applications when migrating from EAP XP 5 -> 6.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.example</groupId>
<artifactId>microprofile-openapi-example</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-bom</artifactId>
<version>10.0.0</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile</groupId>
<artifactId>microprofile</artifactId>
<version>7.0</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.microprofile.openapi</groupId>
<artifactId>microprofile-openapi-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package org.konveyor;

import jakarta.ws.rs.ApplicationPath;
import jakarta.ws.rs.core.Application;

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;

/**
* @author Paul Ferraro
*/
@Path("/echo")
@Produces(MediaType.TEXT_PLAIN)
public class EchoResource {

@GET
@Path("{value}")
public String echo(@PathParam("value") String value) {
return value;
}
}

Original file line number Diff line number Diff line change
@@ -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 {

}

Original file line number Diff line number Diff line change
@@ -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"
} ]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright The WildFly Authors
~ SPDX-License-Identifier: Apache-2.0
-->
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
version="6.0">
</web-app>

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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-Dependency-1
hasIncidents:
exactly: 1
- name: MP-OpenAPI-Document-1
hasIncidents:
exactly: 1

0 comments on commit a4a9866

Please sign in to comment.