★ wanayoo — archive 1999 https://github.com/graphql-java/graphql-java/issues/1921Nouvelle recherche | Portail wanayoo
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

SDL Validation doesn't allow implementing type to change field argument order #1921

Open
felipe-gdr opened this issue May 24, 2020 · 0 comments
Open
Assignees

Comments

@felipe-gdr
Copy link
Member

@felipe-gdr felipe-gdr commented May 24, 2020

Describe the bug
The validation done by SchemaTypeChecker does not allow an implementing type to change the argument order for a field declared by one of the implementing interfaces.

In graphql.schema.idl.ImplementingTypesChecker#checkArgumentConsistency we're relying on the arguments position (index) to do the comparison.

To Reproduce

    def "test changing argument order in implementing type is allowed"() {

        def spec = """                        
            interface InterfaceType1 {
                fieldA(arg1: String, arg2: Int) : String 
            }

            type BaseType implements InterfaceType1 {
                fieldA(arg2: Int, arg1: String) : String 
            }

            schema {
              query : BaseType
            }
        """

        def result = check(spec)

        expect:
        result.isEmpty()
    }

Results in these 2 errors:

  • The object type 'BaseType' [@6:13] has tried to redefine field 'fieldA' arguments defined via interface 'InterfaceType1' [@2:13] from 'arg1:String' to 'arg2:Int
  • The object type 'BaseType' [@6:13] has tried to redefine field 'fieldA' arguments defined via interface 'InterfaceType1' [@2:13] from 'arg2:Int' to 'arg1:String
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.