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

Suggestion: better formating of block strings #958

Open
mrtnzlml opened this issue Jul 11, 2021 · 0 comments
Open

Suggestion: better formating of block strings #958

mrtnzlml opened this issue Jul 11, 2021 · 0 comments
Labels
enhancement Improvement of existing features or bugfix

Comments

@mrtnzlml
Copy link

Is your feature request related to a problem? Please describe.

This one is very simple. Basically, currently, Juniper prints schemas like so (real copy-pasted example):

"""

        This type should be used together with GraphQL uploads and it should hold the file names
        being uploaded. It's used together with the actual uploaded files for validation purposes.
        Only files which are defined using this scalar will be processed.

"""
scalar ProductImageUploadable

input ProductPriceInput {
  """
    The unit amount in centavo to be charged, represented as a whole integer.
    Centavo equals ¹⁄₁₀₀ of the basic monetary unit.
  """ unitAmount: Int!
  "Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html)." unitAmountCurrency: SupportedCurrency!
}

I assume it's because this is how it's written in the source code. But it's not very nice (moreover, there is this: #879). Both Prettier and reference implementation in JS would print something like this:

"""
This type should be used together with GraphQL uploads and it should hold the file names
being uploaded. It's used together with the actual uploaded files for validation purposes.
Only files which are defined using this scalar will be processed.
"""
scalar ProductImageUploadable

input ProductPriceInput {
  """
  The unit amount in centavo to be charged, represented as a whole integer.
  Centavo equals ¹⁄₁₀₀ of the basic monetary unit.
  """
  unitAmount: Int!
  "Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html)."
  unitAmountCurrency: SupportedCurrency!
}

Describe the solution you'd like

I'd like if Juniper could also remove these whitespaces similar to what's described in this PR: https://github.com/graphql/graphql-js/pull/926/files

Describe alternatives you've considered

We could be running Prettier over the generated file but that seems to be a bit cumbersome.

Additional context

Related issue: #879

@mrtnzlml mrtnzlml added the enhancement Improvement of existing features or bugfix label Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement of existing features or bugfix
Projects
None yet
Development

No branches or pull requests

1 participant