ChilliCream / ChilliCream/graphql-platform

Improve schema documentation formatting

Open
#7,089 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🌶️ hot chocolate Area: Type System
Dominant language
C#
Stars
5.8k
Forks
810
Avg merge
15h 39m
Merged PRs (30d)
98

Description

Product

Hot Chocolate

Is your feature request related to a problem?

The schema file is currently rendered in a way that is not particularly readable. See for example the long searchOrders line with the inline documentation for each parameter, and how the second to last line ends with """ and then continues with more non-documentation stuff.

type Query {
  "Fetches an object given its ID."
  node("ID of the object." id: ID!): Node
  "Lookup nodes by a list of IDs."
  nodes("The list of node IDs." ids: [ID!]!): [Node]!
  me: User
  searchOrders(filters: SearchOrdersFiltersInput! sort: [SearchOrdersSortTermInput!] "Returns the first _n_ elements from the list." first: Int "Returns the elements in the list that come after the specified cursor." after: String): SearchOrdersConnection
  """
  Capacity data for the specified factory. This requires the requesting user's `access.capacity.hasAccess` to be
  true.
  """
  factoryCapacity("""
  The ID of the factory to get capacity data for. Only values present in the requesting user's
  `access.capacity.factories` are allowed.
  """ factory: ID!): FactoryCapacityResult!
}
The solution you'd like

Something like the following would be much better, taken from https://jsonformatter.org/graphql-formatter:

type Query {
  "Fetches an object given its ID."
  node("ID of the object." id: ID!): Node
  "Lookup nodes by a list of IDs."
  nodes("The list of node IDs." ids: [ID!]!): [Node]!
  me: User
  searchOrders(
    filters: SearchOrdersFiltersInput!
    sort: [SearchOrdersSortTermInput!]
    "Returns the first _n_ elements from the list."
    first: Int
    "Returns the elements in the list that come after the specified cursor."
    after: String
  ): SearchOrdersConnection
  """
  Capacity data for the specified factory. This requires the requesting user's `access.capacity.hasAccess` to be
  true.
  """
  factoryCapacity(
    """
    The ID of the factory to get capacity data for. Only values present in the requesting user's
    `access.capacity.factories` are allowed.
    """
    factory: ID!
  ): FactoryCapacityResult!
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named in the issue. Start by locating the GraphQL schema rendering or formatting entry point, compare its output with the supplied examples, and add or update coverage for multiline arguments and descriptions; done means the schema is rendered in the demonstrated readable format.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql
Domain
api, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.