Closed gentunian closed 3 months ago
Hi. Thank you for raising this issue. I'll try to answer those questions.
Examples are automatically generated from your schema. They are not described anywhere in the configuration.
For the active field, it should technically detect the field type and try to represent it we best as possible. If your field is indeed boolean and it outputs a string, this might be a bug. Would you be able to provide a reproduction schema ?
In the meantime, have a look at the query generation factory. This can help you override field outputs for those queries.
Hi, @pelletier197 thanks for replying and clarifying.
Based on the live demo site Response tab:
and reading the repo example for spacex, I didn't find how to produce such output.
Now that you mention I do realize I made a mistake in my example. The type for active
was String
, my apologies for the confusion.
Still the case on how to produce such a Response with example data like the live demo is a mystery for me trying to find it in the schema file.
Thanks,
I'm not sure I understand your question. This is done automatically on queries
, mutations
and subscriptions
. You don't need to do anything.
I pasted a screenshot on how the live demo shows an example for properties like id
, orbit_duration_yr
, sidewall_angle_deg
with custom values. I was wondering if we can provide examples for those values like for REST APIs using OpenAPI. You can close the ticket if that's not possible so no documentation would be added because maybe there's no feature for it.
So this is possible for request values as well as response values, using the factory configuration.
It is not done through the scheme itself, but through the configuration file.
Thanks for clarifying, I'm closing this.
I've read the magidoc example for graphql schema and I compared the live demo. The live demo has examples on how responses or variables would be.
However, I don't see those examples in the schema file.
In my case, the example in variables and in response tabs are the name of the property. Imagine we have a property named
active
of typeboolean
then I see: