Skip to content

How do I nest fields which take args on queryType #330

Answered by VinSpee
VinSpee asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks @hayes! I did look through that schema example specifically (and just did again) – I think the biggest difference I'm dealing with is that my desire is to nest subjects inside of featured inside of viewer, and they're not necessarily relations on user., and to allow them to take an input which filters the result. Here's the complete solution I ended up with, any obvious issues or improvements I could make? Thanks again!

const FeaturedInput = builder.inputType('FeaturedInput', {
  fields: (t) => ({
    featuredOn: t.field({ type: FeaturedLabel, required: false }),
  }),
});

builder.objectType('FeaturedContent', {
  description: 'Currently featured assets of various types',
  fields: (

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@hayes
Comment options

Answer selected by VinSpee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants