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

Fake Relay connections #3

Open
IvanGoncharov opened this issue Apr 10, 2017 · 2 comments
Open

Fake Relay connections #3

IvanGoncharov opened this issue Apr 10, 2017 · 2 comments

Comments

@IvanGoncharov
Copy link
Member

suggested by @5hanth in #2
Need to think how to describe Relay connections in IDL without requiring too much boilerplate.

@soneymathew
Copy link

soneymathew commented Jul 28, 2018

Hi @IvanGoncharov / @5hanth what are your thoughts on how to go about implementing this?
To breakdown the problem I had the following thoughts

  1. How do I identify that a type is a connection?
    Approach 1: We could use a directive to mark a field as a connection
type Company {
  name: String @fake(type:companyName)
  employees(
      first: Int,
      after: String,
      last: Int,
      before: String,
 : EmployeeConnection @connection(options:{type: "relay"})
}

Approach 2: Detect if something is a connection using the same technique used by voyager

https://github.com/APIs-guru/graphql-voyager/blob/b2deb19bf8d82e0b496e1ad660823e61b5ce8772/src/introspection/introspection.ts#L135

  if (!/.Connection$/.test(field.type.name)) return;
  1. How does the field resolvers know the connection args to determine the length as done in

https://github.com/APIs-guru/graphql-faker/blob/7bce2980dccef21c1d121688cb741bff47ea2a45/src/fake_schema.ts#L180-L182

  1. How do we enable a hybrid connection as supported by Github APIs?
    https://developer.github.com/v4/object/searchresultitemconnection/
    tricky bit I think is the presence of both nodes and edges in the result

If we can converge on an approach I can put in some time to help out with this.

Best,
Soney

@timonkbd
Copy link

timonkbd commented Mar 4, 2020

Any progress on this? Faking Relay connections would be super helpful for us! 🙂

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

No branches or pull requests

3 participants