Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Can create different Type definitions with the same name in two SE #420

Closed
schickling opened this issue Sep 8, 2017 · 3 comments
Closed
Assignees
Milestone

Comments

@schickling
Copy link
Member

Issue by kbrandwijk
Thursday Aug 03, 2017 at 20:51 GMT
Originally opened as https://github.com/graphcool/api-bugs/issues/217


What is the current behavior?
It's possible to create two SE's with the same Type in them, with a different definition. Both SE's will save correctly. Only the first Type definition is actually used.

Please share the relevant part of your GraphQL schema and all functions, permissions or other project settings for easier reproduction
SDL 1:

type MyPayload { someField: Int }

extend type Query {
  add(a: Int! b: Int!): MyPayload
}

SDL 2:

type MyPayload { anotherField: Int }

extend type Query {
  sum(a: Int! b: Int!): MyPayload
}

This breaks intellisense in the Playground, the Docs only show the first definition, but both queries work with the correct return field (someField for add, anotherField for sum)
image

What is the expected behavior?
The two payload definitions should either be merged (like with gql schema definitions), or the second SE should throw a validation error on save.

@sorenbs
Copy link
Member

sorenbs commented Sep 12, 2017

We should return an error on save.

@kbrandwijk
Copy link
Contributor

Or allow the extend type syntax? Because this is related to a bunch of other issues, for example that you can't reuse payload types across SE's etc.

@marktani marktani modified the milestones: 1.4, 1.5 Sep 22, 2017
@do4gr
Copy link
Member

do4gr commented Sep 30, 2017

We were not correctly checking for duplicate type names and duplicate function names in all cases. We fixed that and you will now get an error on trying to use the same name for two types or functions - even when they are created in the same deploy.

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

No branches or pull requests

5 participants