You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/05/26 20:34:23 UTC
[GitHub] [camel-quarkus] ffang opened a new pull request #2682: fix camel-quarkus-jacksonxml:JsonView annotations take no effect in n…
ffang opened a new pull request #2682:
URL: https://github.com/apache/camel-quarkus/pull/2682
…ative mode #2681
<!-- Uncomment and fill this section if your PR is not trivial
[ ] An issue should be filed for the change unless this is a trivial change (fixing a typo or similar). One issue should ideally be fixed by not more than one commit and the other way round, each commit should fix just one issue, without pulling in other changes.
[ ] Each commit in the pull request should have a meaningful and properly spelled subject line and body. Copying the title of the associated issue is typically enough. Please include the issue number in the commit message prefixed by #.
[ ] The pull request description should explain what the pull request does, how, and why. If the info is available in the associated issue or some other external document, a link is enough.
[ ] Phrases like Fix #<issueNumber> or Fixes #<issueNumber> will auto-close the named issue upon merging the pull request. Using them is typically a good idea.
[ ] Please run mvn process-resources -Pformat (and amend the changes if necessary) before sending the pull request.
[ ] Contributor guide is your good friend: https://camel.apache.org/camel-quarkus/latest/contributor-guide.html
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] ppalaga commented on pull request #2682: fix camel-quarkus-jacksonxml:JsonView annotations take no effect in n…
Posted by GitBox <gi...@apache.org>.
ppalaga commented on pull request #2682:
URL: https://github.com/apache/camel-quarkus/pull/2682#issuecomment-849491273
Could perhaps the extension auto-register the required classes?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] ffang commented on pull request #2682: fix camel-quarkus-jacksonxml:JsonView annotations take no effect in n…
Posted by GitBox <gi...@apache.org>.
ffang commented on pull request #2682:
URL: https://github.com/apache/camel-quarkus/pull/2682#issuecomment-851669354
Hi @ppalaga , @jamesnetherton ,
Just pushed a new commit which uses jandex to read JsonView annotations and add class to reflection list per your guys suggested.
Thanks!
Freeman
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] ffang merged pull request #2682: fix camel-quarkus-jacksonxml:JsonView annotations take no effect in n…
Posted by GitBox <gi...@apache.org>.
ffang merged pull request #2682:
URL: https://github.com/apache/camel-quarkus/pull/2682
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] ffang commented on a change in pull request #2682: fix camel-quarkus-jacksonxml:JsonView annotations take no effect in n…
Posted by GitBox <gi...@apache.org>.
ffang commented on a change in pull request #2682:
URL: https://github.com/apache/camel-quarkus/pull/2682#discussion_r643570537
##########
File path: extensions/jacksonxml/deployment/src/main/java/org/apache/camel/quarkus/component/jacksonxml/deployment/JacksonxmlProcessor.java
##########
@@ -28,4 +37,21 @@ FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}
+ @BuildStep
+ ReflectiveClassBuildItem registerJsonView(CombinedIndexBuildItem combinedIndex) {
+
+ IndexView index = combinedIndex.getIndex();
+ DotName JSON_VIEW = DotName.createSimple(JsonView.class.getName());
+ String[] jsonViews = index.getAnnotations(JSON_VIEW).stream().map(ai -> ai.value())
+ .filter(p -> AnnotationValue.Kind.ARRAY.equals(p.kind()))
+ .map((Function<? super AnnotationValue, ? extends String>) ai -> {
+ Type[] annotationType = ai.asClassArray();
+ return annotationType[0].name().toString();
Review comment:
You are right, I will send another commit.
Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] ffang commented on a change in pull request #2682: fix camel-quarkus-jacksonxml:JsonView annotations take no effect in n…
Posted by GitBox <gi...@apache.org>.
ffang commented on a change in pull request #2682:
URL: https://github.com/apache/camel-quarkus/pull/2682#discussion_r643598269
##########
File path: extensions/jacksonxml/deployment/src/main/java/org/apache/camel/quarkus/component/jacksonxml/deployment/JacksonxmlProcessor.java
##########
@@ -28,4 +37,21 @@ FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}
+ @BuildStep
+ ReflectiveClassBuildItem registerJsonView(CombinedIndexBuildItem combinedIndex) {
+
+ IndexView index = combinedIndex.getIndex();
+ DotName JSON_VIEW = DotName.createSimple(JsonView.class.getName());
+ String[] jsonViews = index.getAnnotations(JSON_VIEW).stream().map(ai -> ai.value())
+ .filter(p -> AnnotationValue.Kind.ARRAY.equals(p.kind()))
+ .map((Function<? super AnnotationValue, ? extends String>) ai -> {
+ Type[] annotationType = ai.asClassArray();
+ return annotationType[0].name().toString();
Review comment:
Hi @ppalaga ,
And here is the follow up PR
https://github.com/apache/camel-quarkus/pull/2709
Please take a look.
Freeman
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #2682: fix camel-quarkus-jacksonxml:JsonView annotations take no effect in n…
Posted by GitBox <gi...@apache.org>.
ppalaga commented on a change in pull request #2682:
URL: https://github.com/apache/camel-quarkus/pull/2682#discussion_r643467231
##########
File path: extensions/jacksonxml/deployment/src/main/java/org/apache/camel/quarkus/component/jacksonxml/deployment/JacksonxmlProcessor.java
##########
@@ -28,4 +37,21 @@ FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}
+ @BuildStep
+ ReflectiveClassBuildItem registerJsonView(CombinedIndexBuildItem combinedIndex) {
+
+ IndexView index = combinedIndex.getIndex();
+ DotName JSON_VIEW = DotName.createSimple(JsonView.class.getName());
+ String[] jsonViews = index.getAnnotations(JSON_VIEW).stream().map(ai -> ai.value())
+ .filter(p -> AnnotationValue.Kind.ARRAY.equals(p.kind()))
+ .map((Function<? super AnnotationValue, ? extends String>) ai -> {
+ Type[] annotationType = ai.asClassArray();
+ return annotationType[0].name().toString();
Review comment:
Why are we taking only the first array element into account? IMO all elements need to be registered for reflection.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] ppalaga commented on pull request #2682: fix camel-quarkus-jacksonxml:JsonView annotations take no effect in n…
Posted by GitBox <gi...@apache.org>.
ppalaga commented on pull request #2682:
URL: https://github.com/apache/camel-quarkus/pull/2682#issuecomment-849974553
You can use Jandex to find instances of `@JsonView` in the user code. Here is some overview https://peter.palaga.org/presentations/210407-quarkus-insights-how-to-write-quarkus-extensions/index.html#/jandex-example
The pattern is used several times in Camel Quarkus code base, just grep for `CombinedIndexBuildItem`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] jamesnetherton commented on pull request #2682: fix camel-quarkus-jacksonxml:JsonView annotations take no effect in n…
Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on pull request #2682:
URL: https://github.com/apache/camel-quarkus/pull/2682#issuecomment-849498119
> Could perhaps the extension auto-register the required classes?
+1 I had the same thought. It'd make the UX better.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-quarkus] ffang commented on pull request #2682: fix camel-quarkus-jacksonxml:JsonView annotations take no effect in n…
Posted by GitBox <gi...@apache.org>.
ffang commented on pull request #2682:
URL: https://github.com/apache/camel-quarkus/pull/2682#issuecomment-849590417
Hi @ppalaga @jamesnetherton ,
Thanks for the feedback!
But I don't know how to do it at extension. The view class names are not fixed, could be any class used in users application. I thought @RegisterForReflection is the standard approach to address this issue at application level. Could you guys please shed more light here?
Freeman
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org