Dynamically restrict fields in graphql spring methods returning the same object type

Dynamically restrict fields in graphql spring methods returning the same object type


0

Would it be possible to somehow restrict some fields from being returned in a graph ql method, bur return them in another considering they both return the same object ?

For example in the following methods i would like to restrict the field UserDto.birthday from being able to be queried in the second method.

@GraphQLQuery(name = "getUser")
@PreAuthorize("hasAuthority('userRead')")
public UserDto getUser(@GraphQLArgument(name = "id") Long id) 

and

@GraphQLQuery(name = "getAllUsers")
@PreAuthorize("hasAuthority('userSelect')")
public List<UserDto> getAllUsers()

I am using graphql-spqr-spring-boot-starter version 0.0.7 with Spring Boot 2.7.6

Share
Improve this question


Load 5 more related questions


Show fewer related questions

0

Reset to default



Browse other questions tagged

or ask your own question.

Leave a Reply

Your email address will not be published. Required fields are marked *