spectaql
spectaql copied to clipboard
Enum example data displayed with quotes
In the example for an enum type field, the value is quoted which is incorrect GraphQL syntax. Below it should be "state": InStock,
for the BoxState enum field.
Tested with v1.0.14
While I understand what you're trying to say, I'm a little on the fence about what is the "right" way to display the information here.
In "GraphQL syntax" I'm not sure there is a "correct" way to fully represent an example of a Type, but only to describe one. Rather, GraphQL types do their best to describe or placehold the idea of a thing as it passes from the external system implementation (usually a JSON representation) to the internal system (e.g. JavaScript strings, DateTimes, and other classes and Objects). And the example representation of one is usually done (at least if we're talking about the external/client side of the client/server wall) using JSON since that's what will probably come across the wire.
I do realize that my representations are also not pure/correct JSON when I sometimes use strings without quotes (usually to reference complex Type so that I don't have to do nested/deep/recursive example expansion). However, I think that along that line/pattern of the examples typically being thought of as JSON representations of a thing, that keeping enum
examples "quoted"
does make sense to me since it's a "simple" thing, not a "complex" one. Having a most complex type like Product
represented by a placeholder without quotes while also having a simple type like the enum value InStock
also represented without quotes seems to cause an inconsistency for me.
What do you think? Maybe we should let this sit for a bit open and see if others comment or 👍 it?