How to write comments in the schema definition file in GraphQL Java and reflect them in GraphQL and GraphQL Playground

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. image.png image.png that's all.

Recommended Posts

How to write comments in the schema definition file in GraphQL Java and reflect them in GraphQL and GraphQL Playground
[Java] Types of comments and how to write them
Sample to read and write LibreOffice Calc fods file in Java 2021
How to get the length of an audio file in java
[Java] How to use the File class
[Java] How to output and write files!
How to get the date in java
The story of forgetting to close a file in Java and failing
How to create your own annotation in Java and get the value
[Java] Memo on how to write the source
How to write Java String # getBytes in Kotlin?
Notes on how to write comments in English
How to ZIP a JAVA CSV file and manage it in a Byte array
[Java] How to omit the private constructor in Lombok
How to write Scala from the perspective of Java
Java classes and instances to understand in the figure
How to convert A to a and a to A using AND and OR in Java
How to convert a file to a byte array in Java
How to debug the generated jar file in Eclipse
Gzip-compress byte array in Java and output to file
A memo about the types of Java O/R mappers and how to select them
[Java] How to get the key and value stored in Map by iterative processing
How to save a file with the specified extension under the directory specified in Java to the list
Let's sort out the differences between Java substring and C # Substring, and how to port them.
How to get the class name / method name running in Java
How to correctly check the local HTML file in the browser
How to read your own YAML file (*****. Yml) in Java
Difference between Java and JavaScript (how to find the average)
What happened in "Java 8 to Java 11" and how to build an environment
How to call and use API in Java (Spring Boot)
How to write and notes when migrating from VB to JAVA
How to develop and register a Sota app in Java
How to derive the last day of the month in Java
Differences in how to handle strings between Java and Perl
How to switch Java in the OpenJDK era on Mac
[Rails5] japanMap link How to write parameters in js.erb file
Method definition location Summary of how to check When defined in the project and Rails / Gem
Basics of Java development ~ How to write programs (variables and types) ~
[jOOQ] How to CASE WHEN in the WHERE / AND / OR clause
How to install the language used in Ubuntu and how to build the environment
Sample to read and write LibreOffice Calc fods file in JRuby 2021
How to solve the unknown error when using slf4j in Java
[Java] How to convert from String to Path type and get the path
How to encrypt and decrypt with RSA public key in Java
How to increment the value of Map in one line in Java
How to write the view when Vue is introduced in Rails?
[Rails] How to write in Japanese
How to learn JAVA in 7 days
Unzip the zip file in Java
Log output to file in Java
How to write Java variable declaration
How to use classes in Java?
How to name variables in Java
How to concatenate strings in java
How to test a private method in Java and partially mock that method
[Java] How to get the current date and time and specify the display format
How to record JFR (Java Flight Recorder) and output a dump file
How to change the maximum and maximum number of POST data in Spark
How to find out the Java version of a compiled class file
How to find the total number of pages when paging in Java
How to get the value after "_" in Windows batch like Java -version