question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature] Choosing The scope of the DTO type to return in REST resources dynamically

See original GitHub issue
Overview of the issue

Suppose you have to DTOs for your User entity: the heavyweight one, UserFullDTO, and the light one, UserLightDTO. and suppose the Generated resources could get the type of DTO you need as a query parameter —> localhost:8080/api/users?scope=full

a map could be generated for user — Map<String, Class> — which contains pair(“full”, UserFullDTO.class) and pair(“tiny”, UserTinyDTO.class) so the 1 REST resource could produce response with respect to the scope you provided, and if you don’t provide one, by default it could return the scopeless DTO --> UserDTO or anything that suits better (maybe UserDTO doesn’t fit anymore in this case, all DTOs should have a scope from now on —> UserFullDTO , UserLightDTO, UserUidDTO, UserLightDTO …

Motivation for or Use Case

so you don’t have to write many resource methods for just changing a DTO scope

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jduboiscommented, Sep 12, 2018

No. There isn’t a good GraphQL solution in Java, and also the way GraphQL works will probably be very inefficient with Hibernate, and quite troublesome with Spring Security.

I’m also waiting to see if the technology takes off. At the moment, after a lot of hype, the main GraphQL project has as many stars as JHipster. And the issue with something this complex, is that we need a lot of users in order to have something working. That’s how OSS works: we have typically 1 contributor for every 1,000 users. So if a complex technology is asked by too few people, we won’t be able to maintain it correctly.

So while I’d like to use GraphQL (I’m using it for a client, and like many parts of it), we’re not supporting it now, and probably not in the near future. Unless a great team of people decide to join the project and implement it & maintain it, of course.

0reactions
cbornetcommented, Sep 12, 2018

If you’re interested in GraphQL, don’t hesitate to do a module or blueprint !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Data REST Reference Guide
HEAD. The HEAD method returns whether the collection resource is available. It has no status codes, media types, or related resources.
Read more >
Dynamically return fields from a web method - Stack Overflow
How do I handle a request like /api/people?fields=FirstName,Email returning just those two fields for all people? Bonus points if I can map ...
Read more >
Testing REST Endpoints Using REST Assured - Semaphore CI
Learn how to create functional tests that focus on the HTTP endpoints of a REST application using the Java library REST Assured.
Read more >
An awesome guide on how to build RESTful APIs with ASP ...
In this article, I'll show you how to write a well structured RESTful API for an “almost” real world scenario, using the ASP.NET...
Read more >
Using the REST Client Reactive - Quarkus
When the quarkus-rest-client-reactive-jackson extension is installed, Quarkus will use the application/json media type by default for most return values, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found