0

Is it possible to add a description or a comment to the arguments that are accepted in a query with graphql?

I have a Query as follows:

    field :users, types[Types::UserType] do
  description 'List of Users. Date parameters accepted in yyyy/mm/dd format.'

  # Required for date range search, accepts string (yyyy/mm/dd)
  argument :from_date, types.String, default_value: nil

as you can see, currently I'm adding the description of the parameters to the description of the field. In the graphiql schema where it describes the types I see:

users(from_date: Stringto_date: Stringemail: Stringname: Stringoffset: Intlimit: Int): [UserType]

when I click on the from_date it describes a string. Is there anyway to have it describe the format of the string? eg. "A string in yyyy/mm/dd format."

Thanks!

Matias Faure
  • 822
  • 1
  • 9
  • 20
Timmy
  • 366
  • 5
  • 10

1 Answers1

2

Looking at the docs, you should be able to do something like:

argument :favoriteFood, types.String, "A string in yyyy/mm/dd format", default_value: nil
Daniel Rearden
  • 80,636
  • 11
  • 185
  • 183