Skip to content

Argument grouping #444

@mroach

Description

@mroach

Describe the problem

I've been getting started with Magidoc and the out-of-the-box experience is excellent, so thanks for that!

As I'm putting the finishing touches on our documentation and looking around for ways to refine it, one thing that sticks out to me is that on our queries, the same arguments are repeated on every connection type: before, after, first, last. These are the arguments used by Relay-style pagination.

Regardless of the sorting mechanism, these end up mixed in with "normal" arguments. This creates a bit of noise and distraction from the other args.

This is what these Relay-style pagination args look like in the SDL:

type Author {
  books(
    """
    Returns the elements in the list that come after the specified cursor.
    """
    after: String

    """
    Returns the elements in the list that come before the specified cursor.
    """
    before: String

    """
    Returns the first _n_ elements from the list.
    """
    first: Int

    """
    Returns the last _n_ elements from the list.
    """
    last: Int
  ): BookConnection
}

Describe the proposed solution

I realise there's no way for Magidoc to even know these args are standard or part of some interface, so there's no fault there. But what I'm wondering is if there's a way in the config perhaps to define argument groups. Perhaps some customer matcher function that returns a group title or null for no group? Then the UI could render collapsible groups?

As an interim solution I've been considering a GraphQL directive to attach to these args so they appear differently in the documentation.

Importance

Nice to have

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions