graphql-spec icon indicating copy to clipboard operation
graphql-spec copied to clipboard

Question about BlockString term

Open sungam3r opened this issue 3 years ago • 2 comments

See http://spec.graphql.org/October2021/#sec-Descriptions :

To allow GraphQL service designers to easily publish documentation alongside the capabilities of a GraphQL service, GraphQL descriptions are defined using the Markdown syntax (as specified by CommonMark). In the type system definition language, these description strings (often {BlockString}) occur immediately before the definition they describe.

{BlockString} is used like a reference to some term but I don't see its definition. I can find only single usage of BlockString through the spec. I see BlockStringCharacter term and BlockStringValue function. I suppose that {BlockString} term here is used by mistake and should be changed to just block string.

sungam3r avatar Nov 05 '21 19:11 sungam3r

Good question @sungam3r; it's a StringValue (http://spec.graphql.org/October2021/#StringValue) but that covers more than just the block string that the content is aiming for. I think it would probably be beneficial to alter the grammar to specifically call out BlockString; so:

StringValue ::
  - `""` [lookahead != `"`]
  - `"` StringCharacter+ `"`
  - BlockString

BlockString :: `"""` BlockStringCharacter* `"""`

That'd also involve changing the spec around this line:

https://github.com/graphql/graphql-spec/blob/60323c90dc2699266be7da7f0d4ab293953cd733/spec/Section%202%20--%20Language.md?plain=1#L930

benjie avatar Nov 05 '21 23:11 benjie

It makes sense. Then I will probably use the BlockString term in error messages. Thanks.

sungam3r avatar Nov 06 '21 19:11 sungam3r