Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot merge two directives if their descriptions differ (Part 2) #4366

Open
Tracked by #5201 ...
Friday32 opened this issue Apr 5, 2022 · 0 comments
Open
Tracked by #5201 ...

Cannot merge two directives if their descriptions differ (Part 2) #4366

Friday32 opened this issue Apr 5, 2022 · 0 comments

Comments

@Friday32
Copy link

Friday32 commented Apr 5, 2022

This issue seems like a continuation of #3031 where merges conflict if descriptions differ.

We use graphql-codegen that uses graphql-tools/merge to combine schema. Schemas are generated by two tools: graphql-js and graphql-java. Both generate a directive that differs slightly in the description.

Example of the directive: graphql-java/Directives.java at master · graphql-java/graphql-java · GitHub

    /**
     * The "specifiedBy" directive allows to provide a specification URL for a Scalar
     */
    public static final GraphQLDirective SpecifiedByDirective = GraphQLDirective.newDirective()
            .name(SPECIFIED_BY)
            .description("Exposes a URL that specifies the behaviour of this scalar.")
            .argument(newArgument()
                    .name("url")
                    .type(nonNull(GraphQLString))
                    .description("The URL that specifies the behaviour of this scalar."))
            .validLocations(SCALAR)
            .definition(SPECIFIED_BY_DIRECTIVE_DEFINITION)
            .build();

The node parameter of the function validateInputs() in directives.ts looks like:
image

The fix for issue 3031 does not handle the argument description.
Print out of "printedNode" and "existing PrintedNode" of validateInputs():

image

The "sameArguments " comparision fail due to the spelling difference of "behaviour".

Expected behavior

When I tweaked the the validateInputs() function locally to ignore the argument description, the graphql-codegen tool seemed to work properly.

Environment:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant