graphql-java icon indicating copy to clipboard operation
graphql-java copied to clipboard

documentation on field visibility describes a deprecated path

Open softprops opened this issue 3 years ago • 0 comments

the documentation on field visibility suggests users use

GraphQLSchema schema = GraphQLSchema.newSchema()
        .query(StarWarsSchema.queryType)
        .fieldVisibility(blockedFields)
        .build();

which is deprecated

Screen Shot 2022-08-05 at 6 26 30 PM

I was able to get this working the the replacement with something that looked this

var schema = GraphQLSchema.newSchema()
        .query(StarWarsSchema.queryType)
        .build();
 var limitedSchema = schema
      .transform(schemaBuilder ->
         schemaBuilder.codeRegistry(
           schema.getCodeRegistry()
               .transform(codeRegistryBuilder -> codeRegistryBuilder.fieldVisibility(blockedFields)));

softprops avatar Aug 05 '22 22:08 softprops