Did someone notice that the introspection of Performance type provides fields such as
"name": "actor", "description": "", "type": { "name": null, "description": "", "kind": "LIST", "ofType": { "name": "Actor", "kind": "OBJECT" } }
But if you query using DQL on using expand(all) you see that the predicates are different.
performance.actor, performance.film etc…
So basically the graphQL schema for Performance is wrong.
If confirmed, do you know where should I report this?
for performance <-> film relation,
the graphQL schema tells field “films” with an s.
but the DB contains the predicate “performance.film” with no s at film !
Good eye. That’s intentional. The GraphQL schema has different field names for simplicity. The GraphQL queries don’t need the prefixed names e.g., “performance” as this name is already in the type name.
The movie dataset in play.dgraph.io is accessible whether it’s via DQL or via GraphQL. The schema takes advantage of the @dgraph directive (docs) under the covers to map predicate like performance.film to the GraphQL field films.
ok. So I have an issue. I’m trying to create a visualization tool in Oculus (3D navigation in a graph !).
DQL schema gives me only a list of predicates without telling me the type of objects in relation with a given node type. GraphQL schema gives me this complete relation information that I need but does not provide directive such as “lang”.
So if I introspect GraphQL endpoint I can see that Film have a name but cannot figure our that I should ask for name@en in a DQL request ! I found the solution by using both and getting the predicate from the GraphQL schema fields names.
If they are different then I’m kind of stuck.
I need to use DQL as I want to do queries not supported by GraphQL API.
Any idea on how to get the information I need ? ( apart from generating a manual mapping of GraphQL names to predicate names !!).
By the way, I cannot read the schema in GraphQL admin port as it is protected. That’s why I’m using /graphql introspection.
Maybe having the full schema as an admin can get on /admin would solve my problem.
Where can I find the schema returned on admin?
They can be completely different and DQL can even work without types altogether is a loosely typed kind of way (hence why edges in DQL schema just point to a uid or a uid list and not another actual type, because types are not required in DQL. GraphQL is strongly typed so an edge has to point to a type of sorts either type, interface (also DQL type), or a union of multiple types.
With the option of using the dgraph directive in GraphQL, it is possible to map to a completely different looking DQL schema so it is not always safe to say what a GraphQL schema and DQL schema are equivalent to without having the raw GraphQL schema.
I don’t think it is safe to accurately introspect and assume a correct schema mapping.