graphql-java-generator / graphql-gradle-plugin-project

graphql-gradle-plugin is a Gradle Plugin for GraphQL, based on graphql-java. It accelerates the development for both the client and the server, by generating the Java code. It allows a quicker development when in contract-first approach, by avoiding to code the boilerplate code.
https://graphql-maven-plugin-project.graphql-java-generator.com/
MIT License
54 stars 8 forks source link

Support for triple-quoted comments? #9

Closed NfNitLoop closed 2 years ago

NfNitLoop commented 2 years ago

Your README.md says:

Comments coming from the GraphQL schema are reported in the generated code

And that does seem to work for # comments like this.

But I'm working with a schema generated by graphql-js's printSchema function, which outputs:

"""comments like this"""

"""
and sometimes
like
this
"""

It would be nice if that were supported too. Though maybe this is just a case of that library doing the wrong thing? (I couldn't find any documentation about using such strings as documentation/comments in GraphQL SDL.)

Thanks for this library!

etienne-sf commented 2 years ago

Hum,

I'm the 'responsible' for reading the comments. The graphql-java library is.

And according the GraphQL Spec, comments are marked with a #

I'll check that.

But I think it's up to graphql-java:

Did you try to change these comments at the exact same place in the schema, to check if it actually works ?

Etienne

etienne-sf commented 2 years ago

graphql-java still can't read these comments. And it's not a valid syntax according to the GraphQL specifications. I guess that graphql-java will take it into account as soon as the specification does. Then it will be ok for the plug-in.

I close this issue.

steven-sheehy commented 1 year ago

The spec does allow for single or double quoted comments. The spec differentiates between # line comments and " or """ block comments. The latter is the official way to provide descriptions for types, fields, arguments, etc. Graphql-java also supports single or triple quotes for descriptions and recommends that over the legacy # comments.

@etienne-sf Can we re-open this and consider supporting quoted comments? It does seem like there's some partial support for """ on types in the plugin but it doesn't seem to work for fields.

etienne-sf commented 1 year ago

Oups I missed this one

Yes, if it's not entirely treated, you can re-open it.

But then I'm sad: I thought it was ok.

Étienne

steven-sheehy commented 1 year ago

Unfortunately, I don't have permission to re-open. Can you or @NfNitLoop re-open it?