graphql-java-generator / graphql-maven-plugin-project

graphql-maven-plugin is a Maven 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
115 stars 47 forks source link

Desciptions from the schema should be included in the generated code if they exist #164

Closed dpalmmna closed 1 year ago

dpalmmna commented 1 year ago

With the following schema definition defined using graphql syntax:

type query_root {
  """
  fetch data from the table: "maps.acq"
  """
  mapsAcq(
    """distinct select on columns"""
    distinctOn: [MapsAcqrSelectColumn!]

    """limit the number of rows returned"""
    limit: Int

    """skip the first n rows. Use only with order_by"""
    offset: Int

    """sort the rows by one or more columns"""
    orderBy: [MapsAcqOrderBy!]

    """filter the rows returned"""
    where: MapsAcqBoolExp
  ): [MapsAcq!]!
}

In the generated classes the comments could be included to describe the different fields correctly instead of using "Parameter for the mapsAcqr field of query_root, as defined in the GraphQL schema" description string.

All comments are loaded in Description field and no longer in comment (graphql.language.Comment) fields when using java schema parser (https://github.com/graphql/graphql-js/pull/927 and https://github.com/graphql/graphql-spec/issues/420).

Update of all call to setComments in DocumentParser to load Descriptions instead of comments. Allow descriptions to be acessible in template files. Add desciptions to InputParameters if exist to be acessible to templaters.

etienne-sf commented 1 year ago

Yes, that is a good point.

It would make comment much more effective. I'll check that, hopefully for the next release.

Etienne

etienne-sf commented 1 year ago

Released in the 1.18.9.