federation-jvm icon indicating copy to clipboard operation
federation-jvm copied to clipboard

Strip hash comments from schemas by default, or as an option

Open seanf opened this issue 3 years ago • 0 comments

By default GraphQL-Java's SchemaGenerator treats hash comments as descriptions when generating a schema from an SDL file. I believe GraphQL-Java does this for historical reasons, since hash comments predated docstring descriptions in the GraphQL spec. However, this is a problem because hash comments may be used for internal-only schema comments, not intended for publication.

It would be great if the class com.apollographql.federation.graphqljava.Federation were to specify the SchemaGenerator option useCommentsAsDescriptions(false), or at least add some ability to use non-default options.

~Perhaps now is a good time to make such a change, before v2.0.0 is finalised?~

https://github.com/apollographql/federation-jvm/blob/7d05eb2ef896f812ad284dc1df0c494c9567e64c/graphql-java-support/src/main/java/com/apollographql/federation/graphqljava/Federation.java#L25-L27

vs

  private static final SchemaGenerator.Options generatorOptions =
      SchemaGenerator.Options.defaultOptions().useCommentsAsDescriptions(false);

seanf avatar Apr 20 '22 03:04 seanf