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

Adding a custom AnnotationScanner #1255

Open
Raptoer opened this issue Sep 13, 2022 · 9 comments
Open

Adding a custom AnnotationScanner #1255

Raptoer opened this issue Sep 13, 2022 · 9 comments
Labels
question Further information is requested

Comments

@Raptoer
Copy link

Raptoer commented Sep 13, 2022

Is is possible to add a custom AnnotationScanner in the project we're working with?

I know I could add it as a java service if I packaged it into a jar, but I want it to load from the project that the maven plugin is currently running on.

@MikeEdgar MikeEdgar added the question Further information is requested label Sep 13, 2022
@MikeEdgar
Copy link
Member

Hi @Raptoer, what is your requirement? There may be better-supported alternate approaches that rely on standard interfaces intended for application use. The AnnotationScanner interface is an internal type and shouldn't necessarily be considered for use by applications.

@Raptoer
Copy link
Author

Raptoer commented Sep 13, 2022 via email

@phillip-kruger
Copy link
Member

@MikeEdgar
Copy link
Member

@Raptoer , what type of annotations are you dealing with? Something entirely custom to your application domain?

@Raptoer Raptoer closed this as completed Sep 13, 2022
@Raptoer
Copy link
Author

Raptoer commented Sep 13, 2022

So I'm trying to read @PreAuthorize, the spring security annotation, to somehow indicate on the openAPI document about the permissions required

@Raptoer Raptoer reopened this Sep 13, 2022
@phillip-kruger
Copy link
Member

This sounds similar to https://github.com/quarkusio/quarkus/blob/main/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/filter/AutoRolesAllowedFilter.java

If you create a small reproducer and the expected entries in the schema document, I can maybe build it in the above filter.

@Raptoer
Copy link
Author

Raptoer commented Sep 14, 2022

The problem with these filters is that I'm using the maven plugin, and I'd rather not duplicate the expansive SmallRyeOpenApiProcessor that the quarkus extension uses.
The way the maven plugin works I don't get a constructor to hand in extra data.
I tried just using the class loader in the filter when it get activated, but I don't seem to have access to my application classes at that time.

@MikeEdgar
Copy link
Member

I tried just using the class loader in the filter when it get activated, but I don't seem to have access to my application classes at that time.

How did you obtain the class loader? I would expect if you use the class load of your filter, the application classes will be available.

@codespearhead
Copy link

@raptor Can you check if the problem still occurs with the latest release (v3.11.0)?

If so, can you provide a minimal reproducible example as asked above?

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

No branches or pull requests

4 participants