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

Required fields for delegated methods #846

Closed
RobertStigsson opened this issue Jun 15, 2018 · 2 comments
Closed

Required fields for delegated methods #846

RobertStigsson opened this issue Jun 15, 2018 · 2 comments

Comments

@RobertStigsson
Copy link

When doing normal requests (not delegated) we can have Id's without the user needing to call them. With delegated methods, this is not as easy. For example:

Schema1:

User {
   id: String
}

query {
   getAllUsers(): [User]
}

Schema2:

PaymentOption {
   paymentOption: Integer
}

query {
   getPaymentOptions(userId: String): [PaymentOption]
}

SchemaStiching:

extend type User {
  paymentOptions: [PaymentOption]
}

StitchedSchemas:

User {
   id: String
   paymentOptions: [PaymentOption]
}

PaymentOption {
   paymentOption: Integer
}

query {
   getPaymentOptions(userId: String): [PaymentOption]
   getAllUsers(): [User]
}

With this schema (and our resolvers) we can do a query looking like this:

getAllUsers() { 
   id
   paymentOptions 
}

But if we aren't asking for id, our getAllUsers-function wont return any Id's, meaning this query wont return anything:

getAllUsers() {
   paymentOptions
}

Is there any easy way to modify the query that is being delegated to our user-system?

@mfix22
Copy link
Contributor

mfix22 commented Jun 15, 2018

I believe this question is almost identical to #786. We have some related discussion there.

@yaacovCR
Copy link
Collaborator

yaacovCR commented Apr 1, 2020

This may be a duplicate of #786 or you may need to just specify the fragment or new v5 selectionSet hint in mergeSchemas.

Closing for now, feel free to reopen with minimal reproduction if still relevant.

@yaacovCR yaacovCR closed this as completed Apr 1, 2020
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

No branches or pull requests

3 participants