Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • In GraphQL, you could easily add an allowedSchemes argument to your card/cards field, and filter accordingly in the resolver (like you do in getCard). The argument type would be a list of values of the CardType enum. This will be forward-compatible, you can add new enum values without breaking clients that still assume the old schema. Of course you need to ensure yourself that all fields which return a CardType (or an object containing one, such as your Card) have such a (required!) allowedSchemes argument, and of course a GraphQL schema cannot express the generic type. Commented Jun 25, 2025 at 2:43
  • @Bergi That's the problem. The return type of card field would still need to be the full list of values, and it would show up as a type error for the consumer. Though, arguably, that's something you could work around as the client. Commented Jun 25, 2025 at 3:30