yussenn
yussenn

Reputation: 615

Apollo Graphql Creating Directives Replacing field.type with a custom GraphQLScalarType

I am creating a custom directive based on the next documentation: https://www.apollographql.com/docs/apollo-server/v2/features/creating-directives.html#Enforcing-value-restrictions and a have a question about the comment "Replace field.type with a custom GraphQLScalarType th ...."

    ...
    visitFieldDefinition(field) {
        this.wrapType(field);
    }

    // Replace field.type with a custom GraphQLScalarType that enforces the
    // length restriction.
    wrapType(field) {
        if (
    ...

The example creates a new GraphQLScalarType and replace the initial type, so I am losing the initianl Type (String, ID, etc)

How Can I use visitInputFieldDefinition without replaces the initial type? Is it posible to use method resolve? like in method visitFieldDefinition

Upvotes: 2

Views: 523

Answers (1)

Ryall
Ryall

Reputation: 12281

Currently there is no resolve on input types, though it has been asked for.

Upvotes: 1

Related Questions