-
Notifications
You must be signed in to change notification settings - Fork 15
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
Support for uri/uriabs from Quarkus Renarde #586
Conversation
Here a little demo with renarde uri: //c @FroMage |
Wow, super nice! |
c9bd18b
to
ac04ded
Compare
There are 2 problems with diagnostics in quarkus-renarde-todo in Login.html:
It's because we check that allowed method doesn't return void according to this rule https://github.com/quarkusio/quarkus/blob/ce19ff75e9f732ff731bb30c2141b44b42c66050/independent-projects/qute/core/src/main/java/io/quarkus/qute/ReflectionValueResolver.java#L176 @mkouba why ReflectionValueResolver forbids the void although renarde value resolver doesn't forbid it? If we want to keep this behavior,it means that we must provide custom validation for renarde.
It's because manualLogin expect 2 parameters:
It seems that userName and password comes from #formElement How to manage this rule with generic mean? |
Actually this doesn't go through
Well, this is because the method only requires parameters that end up in the URI, such as So yeah, namespace resolvers are really like primitives and must be hard-coded: you can't guess what they do. |
Stef is correct that we only validate output expressions where a namespace is mapped to a |
Indeed. It's only used to invoke the reverse-router. |
In general, an output expression that starts with a namespace should only be validated (java model) if the namespace is |
7511b79
to
6076d7f
Compare
I understand the idea, but my idea is to provide the capability to provide custom validation like renarde validation. |
Good catch! It should be fixed now. |
In https://github.com/FroMage/quarkus-renarde-todo/blob/main/src/main/resources/templates/Todos/index.html#L24, the target Controller is resolved: |
try { | ||
// Find all classes which extends 'io.quarkiverse.renarde.Controller' | ||
ITypeHierarchy typeHierarchy = type.newTypeHierarchy(monitor); | ||
IType[] controllerTypes = typeHierarchy.getAllClasses(); |
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.
@rgrunber here I need to collect all classes which extends "io.quarkiverse.renarde.Controller" class. I have a usecase with :
- Application which extends Controller
- Todos which extends ControllerWithUser which extends Controller.
When Controller and ControllerWithUser comes from sources (I copied/pasted thoses sources in my project), I can get Application and Todos.
But when Controller and ControllerWithUser comes from JAR,it seems (according the problem with @fbricon with Todos), that it get only Application (notTodos which extends ControllerWithUser which extends Controller).
At first do you think my code is correct? Have you some idea about this problem?
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.
Is it the same result if you try using IType[] getAllSubtypes(IType type);
from ITypeHierarchy
?
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.
The first thing I notice from running the test case is that
/qute-renarde/lib/quarkus-renarde-1.0.0-SNAPSHOT.jar[CPE_LIBRARY][K_BINARY][isExported:false][attributes:module=true]
/qute-renarde/lib/quarkus-renarde-oidc-1.0.0-SNAPSHOT.jar[CPE_LIBRARY][K_BINARY][isExported:false][attributes:module=true]
don't exist. They're defined in the .classpath
so they show, but there's no lib
folder in the qute-renard project so no way to even get the type. I assume you may have them locally so I think they probably need to be added to the commit.
Update : In fact, If I run javaProject.getResource().findMarkers(null, true, org.eclipse.core.resources.IResource.DEPTH_INFINITE)
, I get :
Marker [on: /qute-renarde, id: 5, type: org.eclipse.jdt.core.buildpath_problem, attributes: [arguments: 0:, categoryId: 10, classpathFileFormat: false, cycleDetected: false, id: 964, location: Build path, message: Project 'qute-renarde' is missing required library: 'lib/quarkus-renarde-oidc-1.0.0-SNAPSHOT.jar', outputOverlappingSource: false, severity: 2, sourceId: JDT], created: 3/10/22, 4:15 PM]
Marker [on: /qute-renarde, id: 4, type: org.eclipse.jdt.core.buildpath_problem, attributes: [arguments: 0:, categoryId: 10, classpathFileFormat: false, cycleDetected: false, id: 964, location: Build path, message: Project 'qute-renarde' is missing required library: 'lib/quarkus-renarde-1.0.0-SNAPSHOT.jar', outputOverlappingSource: false, severity: 2, sourceId: JDT], created: 3/10/22, 4:15 PM]
5ffd259
to
5925a6c
Compare
...c/main/java/com/redhat/qute/jdt/internal/extensions/renarde/UriNamespaceResolverSupport.java
Outdated
Show resolved
Hide resolved
3856c01
to
dee17c2
Compare
See #780 |
@angelozerr do you want to handle this in this PR or should I open an issue for it? |
I think it is a bug with space. If you write
it should work, no? I would like to do that in a separate PR since it is not linked to this PR |
@datho7561 I need to write JDT test to collect ResolvedJavaTypeInfo for renarde. |
You're right, I can confirm it works if I don't add spaces. The qute-ls server is not shutting down properly, but I think that is also not related to this PR. |
3dc2cac
to
8725b66
Compare
done quickly |
09558c9
to
24b7dea
Compare
No, but it is not related with new vscode language client? |
c1c3c3c
to
6885ba3
Compare
I did some testing, and it looks like you were right: it's related to the new language client. |
6885ba3
to
fd52efc
Compare
Fixes redhat-developer#571 This PR uses those renarde validation rules: * all parameters which are annotated with @RestPath (or @PathParam) are considered as required * all parameters which are annotated with @restquery (or @QueryParam) are optional * all parameters which are annotated with @restform (or @FormParam) cannot appear in the method of uri. Signed-off-by: azerr <azerr@redhat.com>
I removed https://github.com/redhat-developer/vscode-quarkus/pull/506/files#diff-c1b7030f8c5f91b6d8690295e037104c11aecfc6d7eb7a9bd531aa0a9c5547fdL40 because I though this language client fix the problem. If you add again shouldLanguageServerExitOnShutdown: true is shutdown working better? If it works better,it mean that we have the same problem with vscode-microprofile and vscode-xml -( |
@datho7561 tests pass now, if you think it is good, please merge it. |
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. Thanks, Angelo!
Thanks so much @datho7561 for your great review! @FroMage to have been patient and give us great feedback. This PR is à good start for supporting renarde but we need to improve again the support. @FroMage when you will have time please install vscode quarkus prerelease when it will be available. I think tomorrow prerelease should be available. Please install too vscode microprofile prerelease to avoid having problem with quarkus support |
Support for uri/uriabs from Quarkus Renarde
Fixes #571
This PR uses those renarde validation rules:
Signed-off-by: azerr azerr@redhat.com