How can you hide a graghQL field in DGS framework. E.g. as below, what can you use so that title cannot be fetched or isn't visible to the client?
type Show {
title: String
actors: [Actor]
}
I don't think that is possible. However, you can set authentication roles by field, which means that only clients with specific roles are going to be able to fetch data from it.
I am attaching a sample from DGS documentation of how you can do it.
@DgsComponent
public class SecurityExampleFetchers {
@DgsData(parentType = "Query", field = "hello")
public String hello() {
return "Hello to everyone";
}
@Secured("admin")
@DgsData(parentType = "Query", field = "secureGroup")
public String secureGroup() {
return "Hello to admins only";
}
}