-
Notifications
You must be signed in to change notification settings - Fork 306
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
FISH-161 OpenAPI Class Data Reading using HK2 Class Model API #4758
Conversation
Signed-off-by: Gaurav Gupta <[email protected]>
jenkins test please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only concern is deployment time for applications that don't want or need openapi support. Is it possible to check that openapi is enabled before building all the metadata?
I haven't reviewed the code to understand whether there is a performance impact for EJB jars and other applications that don't contain any REST endpoints.
Is it possible to do a "fast" check that the application has REST components before doing further processing.
Hi @smillidge , OpenAPI metadata processing is initiated on the request to See: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think keeping the AnnotationModel
to MP model conversion in an extra method createInstance
is a good way to keep things separated. I even would go as far as moving all the conversion outside of the MP model types into a utility class only does that.
It might even be a good idea to wrap the AnnotationModel
API so that the conversion isn't directly based on these abstractions to decouple from the concrete types and to have a place (in the wrapper) to put some convenience methods to avoid repeating logic and get rid of parameters that are fixed in this context. I especially think about all the annotation.getValue
calls. What about if expected values do not exist? Are we settings null
or rather empty string (as usually default in annotations). Things like that.
I feel the code processing application types as Type
could operate on Class
but I might be wrong.
As far as I can tell the way the class processing is hooked into the deployment makes it eagerly evaluated which isn't good. I would think one can make this so that the metadata is computed on demand when OpenAPI actually needs it.
...roprofile/openapi/src/main/java/fish/payara/microprofile/openapi/api/visitor/ApiContext.java
Show resolved
Hide resolved
...rofile/openapi/src/main/java/fish/payara/microprofile/openapi/impl/model/ComponentsImpl.java
Outdated
Show resolved
Hide resolved
...rofile/openapi/src/main/java/fish/payara/microprofile/openapi/impl/model/ExtensibleImpl.java
Outdated
Show resolved
Hide resolved
...roprofile/openapi/src/main/java/fish/payara/microprofile/openapi/impl/model/OpenAPIImpl.java
Show resolved
Hide resolved
...penapi/src/main/java/fish/payara/microprofile/openapi/impl/model/callbacks/CallbackImpl.java
Show resolved
Hide resolved
...file/openapi/src/main/java/fish/payara/microprofile/openapi/impl/model/media/SchemaImpl.java
Outdated
Show resolved
Hide resolved
...e/openapi/src/main/java/fish/payara/microprofile/openapi/impl/model/util/AnnotationInfo.java
Outdated
Show resolved
Hide resolved
...ofile/openapi/src/main/java/fish/payara/microprofile/openapi/impl/model/util/ModelUtils.java
Outdated
Show resolved
Hide resolved
...napi/src/main/java/fish/payara/microprofile/openapi/impl/processor/ApplicationProcessor.java
Outdated
Show resolved
Hide resolved
nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/ApplicationLifecycle.java
Show resolved
Hide resolved
if defaultValue not passed to the function
Yes, HK2 Class Model processing is always hooked with application deployment and used by the annotation processor during application deployment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. It would be nice if you could link or mention the issues this fixes that you mentioned.
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Gaurav Gupta <[email protected]>
This comment has been minimized.
This comment has been minimized.
FISH-161 OpenAPI Class Data Reading using HK2 Class Model API
FISH-161 OpenAPI Class Data Reading using HK2 Class Model API
Description
This is a feature that replaces OPEN API class metadata reading from reflection API to HK2 Class Model API (underlying processing with ASM Visitor API)
Important Info
Depends on PR
payara/patched-src-hk2#12
payara/patched-src-hk2#13
payara/patched-src-hk2#14
payara/Payara_PatchedProjects#316
Testing
Testing Performed
Testing Environment
Windows 10, JDK 11.0
Notes for Reviewers
Exceptionally Classloading is needed to invoke the
javax.ws.rs.core.Application#getClasses()
:https://github.com/jGauravGupta/Payara/blob/f491727a90f87230faa0a45a256b9ebf979dcf82/appserver/payara-appserver-modules/microprofile/openapi/src/main/java/fish/payara/microprofile/openapi/impl/visitor/OpenApiWalker.java#L274-L275
Also Fixes
https://payara.atlassian.net/browse/FISH-70
https://payara.atlassian.net/browse/FISH-92
https://payara.atlassian.net/browse/FISH-50