According to New Generation API for Creating and Learning the First GraphQL Web Service, if you want to comment on each schema in the schema definition file, It is supposed to be surrounded by 3 double quotes like.
scheme.graphqls
"""Book"""
type Book {
"""ID"""
id: ID
"""name"""
name: String
"""number of pages"""
pageCount: Int
"""Author"""
author: Author![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/23101/6f44c6e0-4691-8ca9-a029-0d5ef55f6d7e.png)
}
By writing as above, the comment surrounded by three double quotation marks will be displayed in the Description of GraphQL and GraphQL Playground. However, while writing GraphQL lightly with our Java + Spring Boot, I noticed that if the above writing is enough, it will not be reflected in GraphQL or GraphQL Playground and it will be No Description.
Therefore, I solved it by putting # at the beginning as shown below.
scheme.graphqls
#Book
type Book {
# ID
id: ID
#name
name: String
#number of pages
pageCount: Int
#Author
author: Author
}
When I check it with GraphiQL and GraphQL Playground, it is displayed as follows. that's all.
Recommended Posts