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

Add support for returning non random abstract types #73

Closed
milansmolik-dragon opened this issue Jul 18, 2019 · 2 comments
Closed

Add support for returning non random abstract types #73

milansmolik-dragon opened this issue Jul 18, 2019 · 2 comments

Comments

@milansmolik-dragon
Copy link

I have had a very specific problem: I have an app, which uses interface Card extended by both Debit Card and CreditCard. They are used by DebitAccount and CreditAccount respectively. However when I receive faked CreditCard type for DebitAccount, the app is not built to handle that.

It would be best for me if I could return DebitCard for DebitAccount only, and not to be limited by a random selection from all Card types.

Would there be interest in such functionality? I have already implemented it in my fork, so I can open a PR for it whenever.

@IvanGoncharov
Copy link
Member

@milansmolik-dragon I added support for __typename in @examples values 72f59ca
and released it as 2.0.0-rc.2 on NPM.
It allows you to do the following:

type Query {
  card: Card @examples(values:[{ __typename: DebitCard }])
}

interface Card {
  id: ID!
}

type DebitCard implements Card {
  id: ID!
}

type CreditCard implements Card {
  id: ID!
  creditLimit: Float
}

Can you please test it?
Does it solve your issue?

@milansmolik-dragon
Copy link
Author

Oh yeah, I used an older build for that. This one works great, thanks!

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

2 participants