Skip to content
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

[234] Create rules detecting use of MicroProfile OpenAPI to facilitate EAP XP5->6 migration. #235

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pferraro
Copy link

…e EAP XP5->6 migration.

Signed-off-by: Paul Ferraro <paul.ferraro@redhat.com>
Copy link
Contributor

@jmle jmle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @pferraro, thank you for submitting this. The rule you have submitted is technically correct, but usually we try to cater for all the available points of the migration guide so that we can offer a more accurate report. It would be good to cover these points in the migration guide too (the Incompatible Changes section is the only one I can see with meaningful changes).

@pferraro
Copy link
Author

@jmle Is the java language provider capable of more than just regex parsing? If not, I do not see how to make this more specific without introducing false negatives.
e.g. the tool does not seem to detect usage of a class/method unless imported or declared using its FQCN.

@jmle
Copy link
Contributor

jmle commented Jan 16, 2025

@jmle Is the java language provider capable of more than just regex parsing? If not, I do not see how to make this more specific without introducing false negatives. e.g. the tool does not seem to detect usage of a class/method unless imported or declared using its FQCN.

@pferraro of course. Take a look at other rules in this repo or at the docs. The providers are backed by language servers, so they can do more complex lookups than just regexing. Feel free to ask me any questions.

@pferraro
Copy link
Author

@jmle I had already consulted the docs you linked, which only describes the use of regular expressions for detecting code within a source file.
Consequently, I do not see how to (and cannot find any examples of) detecting the use of a specific class/interface unless it was explicitly declared or imported within the source code.
e.g.
The following code behaves differently between MicroProfile OpenAPI 3.1 and 4.0, where the former returns a SchemaType and the latter returns a List and thus should be detected by the rule:

MediaType mediaType = ...;
String type = mediaType.getSchema().getType().toString();

To detect this, I tried creating a rule using:

java.referenced:
    pattern: org.eclipse.microprofile.openapi.models.media.Schema

... with every location option, but was not able to convince the java language provider to detect this usage of the Schema interface, let alone a specific method on it.
What am I missing? Please advise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants