jhipster / generator-jhipster-micronaut

Micronaut blueprint for JHipster
Apache License 2.0
99 stars 29 forks source link

eagerload is not defined on some Resource classes #97

Closed agilob closed 4 years ago

agilob commented 4 years ago
Overview of the issue

eagerload is not defined on XResource methods:

[ERROR] /home/agilob/Projects/agileb-jhipster/src/main/java/net/agileb/web/rest/SessionResource.java:[97,40] The route declares a uri variable named [eagerload], but no corresponding method argument is present
[ERROR] /home/agilob/Projects/agileb-jhipster/src/main/java/net/agileb/web/rest/MessageResource.java:[97,40] The route declares a uri variable named [eagerload], but no corresponding method argument is present

Correcting method definition to contains parameter @Nullable Boolean eagerload fixes this error.

@Get("/sessions{?eagerload}")
public HttpResponse<List<Session>> getAllSessions(HttpRequest request, Pageable pageable, @Nullable Boolean eagerload) {
Reproduce the error

I simply generated a new project and it throws this error when I do ./mvnw

agilob commented 4 years ago

When changed to primitive type @Nullable boolean eagerload it causes backend to crash and frontend to throw error when list of X-model is visited.

agilob commented 4 years ago

Only some resources (member, user, message resource) are affected by this bug, I have over 20 generated but these 3 failed

[ERROR] /home/agilob/Projects/agileb-jhipster/src/main/java/net/agileb/web/rest/MemberResource.java:[97,39] The route declares a uri variable named [eagerload], but no corresponding method argument is present
[ERROR] /home/agilob/Projects/agileb-jhipster/src/main/java/net/agileb/web/rest/SessionResource.java:[97,40] The route declares a uri variable named [eagerload], but no corresponding method argument is present
[ERROR] /home/agilob/Projects/agileb-jhipster/src/main/java/net/agileb/web/rest/MessageResource.java:[97,40] The route declares a uri variable named [eagerload], but no corresponding method argument is present

This happens when .jdl has

// Set pagination options
paginate Room, Member with infinite-scroll
paginate Session, Message with pagination

// Use Data Transfert Objects (DTO)
// dto * with mapstruct

My classes eg. Room have correct method definition.

JasonTypesCodes commented 4 years ago

I believe the eagerload was being added to the URI in error. It appears that the only time eagerload should come into play is if the field contains the owner of a many to many