-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
Description
Describe the bug
With respect to what constitutes a valid type
, the GraphQL spec states that for each field on a type
corresponding to a field on an implemented interface
:
field
must return a type which is equal to or a sub-type of (covariant) the return type ofimplementedField
field’s return type
Dgraph's implementation of GraphQL does not allow such covariant field implementation.
To Reproduce
Attempt to apply the following GraphQL schema to a Dgraph instance (POST to /admin/schema
):
interface Vacancy {
roleName: String!
}
type DeveloperVacancy implements Vacancy {
roleName: String!
requiredLanguages: [String!]!
}
type DesignerVacancy implements Vacancy {
roleName: String!
}
interface Application {
vacancy: Vacancy!
}
type DeveloperApplication implements Application {
vacancy: DeveloperVacancy!
knownLanguages: [String!]!
}
type DesignerApplication implements Application {
vacancy: DesignerVacancy!
portfolioUrl: String!
}
Expected behavior
Schema is successfully applied to Dgraph instance.
Screenshots
An error message is returned:
resolving updateGQLSchema failed because input:19: For type DeveloperApplication to implement interface Application the field vacancy must have type Vacancy!\n (Locations: [{Line: 3, Column: 4}])
Environment
- Docker image
dgraph/standalone:v25.0.0-preview6
matteo-zanoni