<@U78HPECSK> ``` const SearchType = new GraphQLOb...
# prisma-whats-new
c
@Sheel Patel
Copy code
const SearchType = new GraphQLObjectType({
  name: 'search',
  fields: () => ({
    type: { type: GraphQLString },
    params: {
      type: new GraphQLObjectType({
        name: 'params',
        fields: {
          definition: {
            type: new GraphQLObjectType({
              name: 'definition',
              fields: {
                rules: {
                  type: new GraphQLList(
                    new GraphQLObjectType({
                      name: 'rules',
                      field: {
                        field: { type: GraphQLString },
                        value: { type: GraphQLString },
                        operator: { type: GraphQLString }
                      }
                    })
                  )
                }
              }
            })
          },
          page: { type: GraphQLInt },
          page_size: { type: GraphQLInt }
        }
      })
    }
  })
});
s
What happened when you tried this?
c
This works fine, it's when I try to put this at my root query
Copy code
...
search: {
      type: SearchType,
      args: {
        search: { type: SearchType},
        resolve(parentValue, args) {
          return args.search;
        }
      }
    }
I test it like this before moving on just to make sure it's acceptable, but I get a error something along the lines of
root.search(search:) argument type must be Input Type but got: search.
s
Thats because you need to use
GraphQLInputObjectType
instead of
GraphQLObjectType
for arguments
c
... I feel really dumb right now. So if you don't mind me asking, where exactly should I need to make that change, because I have ObjectTypes sprinkled through out the SearchType or are you referencing where I had args
search
that needs to be a InputObjectType instead of the SearchType?
s
They have to all be input types
Let me know if you have any more questions, I'm happy to help.
c
Thanks, for the point in the right direction!
@Sheel Patel I got a quick question. At my root query it looks like this
Copy code
search: {
      type: GraphQLString,
      args: {
        search: { type: SearchInput },
        resolve(parentValue, args) {
          return args.search.type;
        }
      }
    }
Then the Input its grabbing looks like this
Copy code
const SearchInput = new GraphQLInputObjectType({
  name: 'search',
  fields: {
    type: { type: new GraphQLNonNull(GraphQLString) }
  }
});
But I still get this error
root.search(resolve:) argument type must be Input Type but got: undefined.
crap nvm, I think I see my mistake
I got it, nvm thanks!
s
haha great!
c
Typing to fast for my own good. I probably have spent 6 hours trying to figure out what you basically lead me to in 5 minutes
s
It happens to us all, sometimes taking a break and coming back with a fresh perspective is what kicks things back into gear!