nicolasdao / graphql-s2s

Add GraphQL Schema support for type inheritance, generic typing, metadata decoration. Transpile the enriched GraphQL string schema into the standard string schema understood by graphql.js and the Apollo server client.
Other
187 stars 15 forks source link

Missing support for 'descriptions' #29

Closed jimmed closed 5 years ago

jimmed commented 5 years ago

Fairly recently, the GraphQL spec was extended to add the concept of 'descriptions' ─ essentially comments describing types and fields.

For example (lifted from the spec):

"""
A simple GraphQL schema which is well described.
"""
type Query {
  """
  Translates a string from a given language into a different language.
  """
  translate(
    "The original language that `text` is provided in."
    fromLanguage: Language

    "The translated language to be returned."
    toLanguage: Language

    "The text to be translated."
    text: String
  ): String
}

Unfortunately, graphql-s2s cannot parse this new syntax; the following error is thrown at startup:

TypeError: Cannot read property 'match' of undefined
    at genTypes.forEach.genType ([...]/node_modules/graphql-s2s/src/graphqls2s.js:286:43)

I'll take a look at fixing this myself and raising a PR, but I can't promise anything! Finally, thanks for creating such a useful library!

nicolasdao commented 5 years ago

Hi @jimmed ,

Thanks heaps for reporting this. This issue has already been reported by @yostools in https://github.com/nicolasdao/graphql-s2s/issues/17.

I'll try to fix this asap.

Really appreciate your support.

Nic

luisfrocha commented 5 years ago

Any updates on this? Was a PR ever submitted? I ran into this issue today. Not a big deal, as we're not really using the descriptions, but it would be nice to be able to start adding them.

nicolasdao commented 5 years ago

Hi @luisfrocha,

I haven't had time to fix that issue yet. I can't give you an ETA yet as I'm quite busy at the moment, but I'll try to fix asap.

Thanks for helping the community.

Cheers,

Nic

phoenix741 commented 5 years ago

Hi,

I create a pull request to add the support of descriptions. If you don't have time to develop it, can you review the code i wrote ?

Thanks

nicolasdao commented 5 years ago

Big thanks to @phoenix741 for fixing this issue. The latest release (0.19.1) on npm contains that PR. I'm closing this issue now. Thanks all for your support.