Skip to content

Suggestion: better formating of block strings #958

Open
@mrtnzlml

Description

@mrtnzlml

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprovement of existing features or bugfix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions