Skip to content

Documentation includes deprecated code#783

@ataylormays-duetto

Description

@ataylormays-duetto

Description

https://www.graphql-java-kickstart.com/tools/directives/ includes the following code:

public class UppercaseDirective implements SchemaDirectiveWiring{@Override public GraphQLFieldDefinition onField(SchemaDirectiveWiringEnvironment<GraphQLFieldDefinition> env){GraphQLFieldDefinition field = env.getElement(); GraphQLFieldsContainer parentType = env.getFieldsContainer(); // build a data fetcher that transforms the given value to uppercase DataFetcher originalFetcher = env.getCodeRegistry().getDataFetcher(parentType, field); DataFetcher dataFetcher = DataFetcherFactories.wrapDataFetcher( originalFetcher, ((dataFetchingEnvironment, value) ->{if (value instanceof String){return ((String) value).toUpperCase()} return value})); // now change the field definition to use the new uppercase data fetcher env.getCodeRegistry().dataFetcher(parentType, field, dataFetcher); return field} } 

However, DataFetcher originalFetcher = env.getCodeRegistry().getDataFetcher(parentType, field); is a deprecated method, which has now been removed in the latest v22 of graphql-java: https://github.com/graphql-java/graphql-java/pull/3514/files.

Expected behavior

The documentation is updated to show how to implement directives w/ the latest version of graphql-java.

Actual behavior

The documentation uses outdated code that is incompatible with the latest version of graphql-java.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions