Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

printer package Print does not print descriptions #484

Closed
mmmveggies opened this issue May 24, 2019 · 0 comments · Fixed by #485
Closed

printer package Print does not print descriptions #484

mmmveggies opened this issue May 24, 2019 · 0 comments · Fixed by #485

Comments

@mmmveggies
Copy link
Contributor

Hello,

First of all, thank you to everyone involved in writing this package! I have used it extensively and started publishing some helpers at https://github.com/Fanatics/graphql-ast-helpers

One thing I'm confused about - calling printer.Print doesn't seem to emit the descriptions in the standard triple-quoted style, though the parser seems to have tests to ensure it can detect them ... am I just missing something, or would the printer need to be extended to support this?

I would be happy to look at it if it's currently unsupported or not planned, though I'm not quite familiar with the visitor pattern and a nudge in the right direction would probably save me a lot of time.

My guess would be:

  1. Each member function of the printDocASTReducer that can have a description prefix may need to try to read that value, and then fields that do have a description need to have that value be indented + newline'd (to support multiline comments) correctly in the output string
  2. Some places like ast.FieldDefinition.InputValueDefinition the may have to conditionally newline when they are currently always inline, to support something like the following
"""cool type"""
type Cool {

  """every cool bean"""
  beans: [ID]

  """
  check if a cool bean is present
  the resolver for this is super optimized
  """
  hasBean(

    """the id of the cool bean"""
    id: ID = "abc123"
  ): Boolean
}

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant