Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxied documents are no longer hardcoded to the "query" operation type. #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kyleu
Copy link
Collaborator

@kyleu kyleu commented Jun 27, 2018

No description provided.

@kyleu kyleu requested a review from OlegIlyenko June 27, 2018 18:47
case h :: Nil => (h, Some("Delegated" + h))
case x => throw new IllegalStateException(s"Query contains operations [${x.mkString(", ")}].")
}
val queryOp = ast.OperationDefinition(operationType = ot, name = n, variables = varDefs, selections = updatedFields)
Copy link
Owner

@OlegIlyenko OlegIlyenko Jun 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can replace hardcoded ast.OperationType.Query with something like this:

c.query.operationType(c.ctx.operationName) getOrElse 
  throw new IllegalStateException(s"Can't find operation type")

You need to consider the operationName since it defines which operation must be executed if multiple operations are defined in the query.

Otherwise it looks good to me 👍 In future we need to think of a way how we can detach these 2. For example, in case I'm doing a mutation, but the delegate one of the nested fields. in this case delegated query type is Query even though original query is a Mutation

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

Successfully merging this pull request may close these issues.

2 participants