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

Add the ability to group the mutations #621

Closed
yordis opened this issue Oct 15, 2017 · 5 comments
Closed

Add the ability to group the mutations #621

yordis opened this issue Oct 15, 2017 · 5 comments

Comments

@yordis
Copy link

yordis commented Oct 15, 2017

I don't if this should be here or in the actual spec but. Right now practices like put the resource name and then action for example postCreate because we want to have some order in the mutations can be resolve with some soft of tag or grouping.

I think it will be good to add that functionality so it's easier to manage the mutations and we do not have to create some weird names because the tooling force us to do for a better experience on it.

@asiandrummer
Copy link
Contributor

Hi @yordis - I'm not sure if I understand your proposal, but regardless I don't think GraphiQL should be the place to open this issue because I'm guessing you're suggesting for a feature addition in graphql reference implementation. I think opening an issue in graphql-js for feature addition like this would be better.

As such, I'm going to close this issue for now. Feel free to reopen it if you think GraphiQL should handle this - if that's the case I'd love to see some example code + a more detailed use case scenario please.

@yordis
Copy link
Author

yordis commented Oct 16, 2017

@asiandrummer many people flip the order of the naming for example createOrder vs orderCreate. If you have multiple actions around the order you will normally put updateOrder, createOrder ... so on. But this will spread the mutation list all over the place in the Dos section, instead of put them together for be better organization.

I am not sure how to do some code example because it is more about what GraphiQL does, or rather does not do. I am not quite sure if the introspection is forced by Graphql on what you could put inside. For example add group: key to the schema in the introspection.

So I need to do is some way of tagging the mutation so I can group them for example

@group :order
mutation :create_order do
# ...
end

@group :order
mutation :update_order do
# ...
end

so it will be something like

{
  __schema {
    group <--- I guess
    queryType {
      name
    }
  }
}

Something like that, where you could read from the introspection and be able to group them (probably use the same navigation in the Docs section)

The reason I didn't open it there is because I am not sure if the introspection shape is forced by GraphQL or you could relay on some added feature from it.

@yordis
Copy link
Author

yordis commented Nov 24, 2017

@asiandrummer could you reopen this please so we have track of the feature request.

Related to graphql/graphql-spec#376
Related to graphql/graphql-spec#300

@luatnd
Copy link

luatnd commented Oct 27, 2021

Agree, no one want a flat list of hundreds queries & mutation
We need groups (folder like):

Actual:

Queries:
  cart__items
  cart__estimateShippingFee
  anotherModule__query1
  anotherModule__query2
  anotherModule__query3
  anotherModule__query4
Mutation:
  cart__addItem
  cart__removeItem
  anotherModule__mut1
  anotherModule__mut2

Expected:

CART
  Queries:
    items
    estimateShippingFee
  Mutation:
    addItem
    removeItem

ANOTHER
  Queries:
    query1
    query2
    query3
    query4
  Mutation:
    mut1
    mut2

Or at least

CART
  Queries:
    cart__items
    cart__estimateShippingFee
  Mutation:
    cart__addItem
    cart__removeItem

ANOTHER
  Queries:
    anotherModule__query1
    anotherModule__query2
    anotherModule__query3
    anotherModule__query4
  Mutation:
    anotherModule__mut1
    anotherModule__mut2

@sebastienbarre
Copy link

Was there ever a resolution to this? I can't be the only one with an absolutely unruly list of queries and mutations, almost 1800 lines long. My "Execute Query" button requires scrolling several screens down to reach the last one. Are you guys using a different set of tooling to solve this? From a UI perspective, allowing the "Execute Query" to have sub-menus for "groups" would be logical step. Thank you.

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

No branches or pull requests

4 participants