Add GraphQL parent context within Parse.Cloud.define()
#7621
Labels
type:feature
New feature or improvement of existing feature
Parse.Cloud.define()
#7621
New Feature / Enhancement Checklist
Current Limitation
It is currently not possible to get context of the "GraphQL parent". So it is not extend the GraphQL schema like so:
and query like this:
But instead, we have to do extend it like this:
and query like this:
The above assumes there is a
MyParseClass
parse class defined like so:The above is a very simple example, but you can see how it gets really complicated to run cloud code functions within GraphQL when doing nested queries, like
myParseClasses.edges.node.myParseClassCustomField
.This also means doing the waterfall approach when the objectId is not defined, where the query for the customField has to wait until you get the objectId from first query, then query for custom field using that id.
Feature / Enhancement Description
Add
parent
GraphQL context toParse.Cloud.define
request
argument.It should at minimum contain the
typename
andobjectId
of the parent, so that we can easily query using thatobjectId
:Example Use Case
Functionality explained above.
Alternatives / Workarounds
Current workaround is to extend type
Query
instead of the actual class we want to extend and add all required params (objectId or other) to filter/get the class instance we want within theParse.Cloud.define
definition.The text was updated successfully, but these errors were encountered: