Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

[BUG] Schema must contain unique named types but contains multiple types named "Recipient" #260

Closed
naydav opened this issue Nov 21, 2018 · 1 comment
Assignees
Labels

Comments

@naydav
Copy link
Contributor

naydav commented Nov 21, 2018

After merging #226 we have got an error message for loading documentation

"errors": [
    {
      "debugMessage": "Schema must contain unique named types but contains multiple types named \"Recipient\" (see http://webonyx.github.io/graphql-php/type-system/#type-registry).",
      "message": "Internal server error",
      "category": "internal",
      "locations": [
        {
          "line": 6,
          "column": 7
        }
      ],

Proposed scheme

# Copyright © Magento, Inc. All rights reserved.
# See COPYING.txt for license details.

type Mutation {
    sendEmailToFriend (input: SendEmailToFriendInput): SendEmailToFriendOutput @resolver(class: "\\Magento\\SendFriendGraphQl\\Model\\Resolver\\SendEmailToFriend") @doc(description:"Recommends Product by Sending Single/Multiple Email")
}

input SendEmailToFriendInput {
   product_id: Int!
   sender: SendEmailToFriendSender!
   recipients: [SendEmailToFriendRecipient!]!
}

type SendEmailToFriendOutput {
    sender: SendEmailToFriendSender
    recipients: [SendEmailToFriendRecipient]
}

type SendEmailToFriendSender {
    name: String!
    email: String!
    message: String!
}

type SendEmailToFriendRecipient {
    name: String!
    email: String!
}

Steps to reproduce:

  1. Performe quey
query IntrospectionQuery {
    __schema {
      queryType { name }
      mutationType { name }
      types {
        ...FullType
      }
      directives {
        name
        description
        locations
        args {
          ...InputValue
        }
      }
    }
  }

  fragment FullType on __Type {
    kind
    name
    description
    fields(includeDeprecated: true) {
      name
      description
      args {
        ...InputValue
      }
      type {
        ...TypeRef
      }
      isDeprecated
      deprecationReason
    }
    inputFields {
      ...InputValue
    }
    interfaces {
      ...TypeRef
    }
    enumValues(includeDeprecated: true) {
      name
      description
      isDeprecated
      deprecationReason
    }
    possibleTypes {
      ...TypeRef
    }
  }

  fragment InputValue on __InputValue {
    name
    description
    type { ...TypeRef }
    defaultValue
  }

  fragment TypeRef on __Type {
    kind
    name
    ofType {
      kind
      name
      ofType {
        kind
        name
        ofType {
          kind
          name
          ofType {
            kind
            name
            ofType {
              kind
              name
              ofType {
                kind
                name
                ofType {
                  kind
                  name
                }
              }
            }
          }
        }
      }
    }
  }

Fix is replacing type on input

   sender: SendEmailToFriendSender!
   recipients: [SendEmailToFriendRecipient!]!

=>

   sender: SendEmailToFriendSenderInput!
   recipients: [SendEmailToFriendRecipientInput!]!
@naydav
Copy link
Contributor Author

naydav commented Nov 23, 2018

#262

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

No branches or pull requests

3 participants