- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3k
REST data Panache reorganisation #9373
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
Conversation
| cc @geoand | 
| Thanks, I'll take a look first thing Monday. I assume you also want a review from @FroMage ? | 
| Yeah that would be helpful. | 
| Can you please rebase onto master to pick up a CI fix? Thanks | 
        
          
                ...rest-data-panache/runtime/src/main/java/io/quarkus/rest/data/panache/ResourceProperties.java
          
            Show resolved
            Hide resolved
        
      | import io.quarkus.builder.item.MultiBuildItem; | ||
|  | ||
| public final class PanacheCrudResourceBuildItem extends MultiBuildItem { | ||
| public final class PanacheCrudResourceInfo extends MultiBuildItem { | 
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.
Any reason why this was renamed?
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.
Before it was already used by a processor which would extract separate bits of information and only pass what's needed to a specific method implementor. I made the method implementors more abstract now so processor wouldn't have to know too much details about them. Now it just passes this object to each implementor. So I assumed the name without "BuildItem" suffix would be more suitable. What do you think?
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.
It just feels weird to have being a build item and not being called that. What we usually do in similar cases is to have a build item that just holds a reference to the regular class. Then in the non-build-step code you can just pass around the regular class. The build step classes would of course the build items to communicate.
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.
Yeah that makes sense, I'll extract it to a separate class
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.
Done
| return classInfo.classAnnotation(RESOURCE_PROPERTIES_ANNOTATION); | ||
| } | ||
| if (classInfo.superName() != null) { | ||
| ClassInfo superControllerInterface = index.getClassByName(classInfo.superName()); | 
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.
Minor nipick (can be fixed later): The use of controller seems a little out of place. Perhaps use resource instead?
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.
True. I'll take a note of this and will fix it separately after the release.
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.
Renamed
|  | ||
| private static final String[] SUFFIXES = { "controller", "resource" }; | ||
|  | ||
| public static String fromClass(Class<?> resourceClass) { | 
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.
This seems to be unused now, no?
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.
True, I had a use for it initially. I'll get rid of 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.
Removed
| * | ||
| * Default: hyphenated resource name without a suffix. Ignored suffixes are `Controller` and `Resource`. | ||
| */ | ||
| String path() default ""; | 
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.
Not that I think this will ever be an issue, but by using "" as the default value, you are effectively preventing users from making an panache rest data resource without a path. Now that's probably A good thing, but I am just bringing it up in case you hadn't considered it. In any case it would probably be safer to use some nonsensical default valur
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.
Hmm, we could maybe change this later too. Adding a nonsense value and based on that not add an annotation at all. I need to add some default value because otherwise user will always have to specify a path when using this annotation.
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.
Yeah, I understand the need for a default value, just saying that "" is not the proper one :)
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.
Shall we change it separately after the release? I don't want to hold this PR for too long.
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.
Sure yeah
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.
Seems fine to me!
| @geoand I've added modifications as a separate commit. I have to either keep them like this or squash all three commits (including the rename). Otherwise squashing first and third commits causes a lot of conflicts, so will take a lot of time to go through them. | 
| I think we can live with the extra commit :) | 
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.
Thanks for the quick work, and sorry about the late review. Aren't we missing the docs too?
        
          
                ...test/java/io/quarkus/hibernate/orm/rest/data/panache/deployment/CustomPathItemsResource.java
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...test/java/io/quarkus/hibernate/orm/rest/data/panache/deployment/CustomPathItemsResource.java
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...est-data-panache/runtime/src/main/java/io/quarkus/rest/data/panache/OperationProperties.java
              
                Outdated
          
            Show resolved
            Hide resolved
        
              
          
                ...rest-data-panache/runtime/src/main/java/io/quarkus/rest/data/panache/ResourceProperties.java
          
            Show resolved
            Hide resolved
        
              
          
                ...rest-data-panache/runtime/src/main/java/io/quarkus/rest/data/panache/ResourceProperties.java
          
            Show resolved
            Hide resolved
        
      | OK, so we're only missing the docs, right? | 
| I've just cherry-picked the docs commit from this PR #9254 so it would be easier for you to review and merge. | 
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.
OK, sorry I didn't realise we hadn't merged the docs PR yet. Thanks for bringing the commit over.
| Thanks for the review @FroMage. I've committed and squashed your suggestions. | 
| OpenID test failed the CI. Shouldn't be related to this PR. | 
| 
 Yeah, it's a known flaky test | 
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.
Great!
| I've restarted the CI tests | 
9339c07    to
    aac0081      
    Compare
  
    | "Native Tests - Data3" is the one that runs native tests for this extension. It passed our tests and later failed the  | 
| 
 Yeah, thats the reason we added  | 
#9293
#9261
Sorry for a big PR. I wanted to squeeze the main changes in before the Tuesday's release. I kept two separate commits, but I can squash them if you prefer it.
The main changes are:
quarkus-panache-rest-*toquarkus-*-rest-data-panachePathannotations andLocationheaders etc.) to one place outside of the method implementors.@PanacheRestResourceconfiguration annotation to two@ResourceProperties(to be used on an interface level and@OperationProperties(to be used on a method).