0

I have a query that looks like this:

mutation update_single_article($itm: String, $changes: roles_set_input!) {
  update_roles(_set: $changes, where: {role_id: {_eq: $itm}}) {
    returning {

    }
  }
}

I am not sure where the type roles_set_input comes from. If I change it to something else I get an error saying did you mean... with a list of different values. Where does this value come from? Is it a graphql predefined type? Was it defined somewhere? I tried searching google for this but I wasn't able to get any results probably because I am not sure what to search for.

If this value was defined somewhere is it possible to see it in Hasura?

Get Off My Lawn
  • 34,175
  • 38
  • 176
  • 338

1 Answers1

1

Hasura automatically generates your GraphQL schema based on your Postgres database. You can run queries against your schema under the GraphiQL tab in the console.

GraphiQL Tab

You can explore the schema using either the "Explorer" panel on the left or by clicking the "Docs" link on the right. In addition to the description and return type for each field, the docs will also show any arguments available on each field, including the type for that argument.

Daniel Rearden
  • 80,636
  • 11
  • 185
  • 183
  • I don't think this answers the question. @avimoondra comment is closer to what I am looking for... – Get Off My Lawn Jun 15 '20 at 14:38
  • @GetOffMyLawn You asked where the type comes from (the schema generated by Hasura) and how to view the type in the console (screenshot and accompanying instructions). I'm happy to clarify if you're still unclear on something. You might also want to check out the [official introductory tutorial to GraphQL](https://graphql.org/learn/). Hasura also has a [tutorial](https://hasura.io/learn/graphql/hasura/data-modelling/2-try-user-queries/) you may find helpful. – Daniel Rearden Jun 15 '20 at 14:56
  • Maybe I am missing something from your image, but it doesn't seem to show where `roles_set_input` would have come from or is defined or how it was defined. – Get Off My Lawn Jun 15 '20 at 15:11
  • 1
    The type is defined as part of your schema, which is automagically generated for you by Hasura based on your database. I don't know if you can easily view the *entire* schema in SDL if that's what you're asking, but you can explore all of it via the two methods outlined above (explorer panel and docs panel). If you search for `update_roles` in the docs tab, you can click on the `_set` argument and then click on its type to see the type definition. – Daniel Rearden Jun 15 '20 at 15:46