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

Update operation docs #1802

Open
wants to merge 26 commits into
base: source
Choose a base branch
from

Conversation

mandiwise
Copy link
Contributor

Addresses #250, #584, #728, #754, and #992

Description

This PR contains updated operations-related content in the Learn docs. Key changes include:

  • Expanded content on GraphQL query operations
  • A separate "Mutations" page with additional examples for updating and deleting data
  • A new "Subscriptions" page
  • Updates to the Star Wars schema to support the new mutation examples
  • Operation-related content now comes after the Schemas and Types page in the left nav
  • Standardization of capitalization and naming for named types

@benjie @jorydotcom

Copy link

vercel bot commented Oct 26, 2024

@mandiwise is attempting to deploy a commit to the The GraphQL Foundation Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Oct 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
graphql-github-io ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 18, 2024 5:34pm

Copy link
Contributor

@Urigo Urigo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so excited for this!


## Deleting data

Just as we can send a `DELETE` request to delete a resource with a REST API, we can use mutations to delete some existing data as well by defining another field on the `Mutation` type:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should clarify that in GraphQL we send a POST request to delete

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have an updated "Serving over HTTP" page almost ready to go where I go into this in detail based on the draft GraphQL over HTTP spec (including when GET may be used too). Does it make sense to duplicate that here? My goal was draw connections with REST patterns the reader would likely be familiar with while explaining how different kinds of mutations work without overloading with too much information. It can be tricky to find the right balance though! Let me know what you think.

Copy link
Member

@benjie benjie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love the improvements to the queries page (and include a number of minor suggested edits), but I have concerns over the mutations page. I have not yet read the subscriptions page.

src/pages/learn/queries.mdx Outdated Show resolved Hide resolved
src/pages/learn/queries.mdx Outdated Show resolved Hide resolved
src/pages/learn/queries.mdx Show resolved Hide resolved
src/pages/learn/queries.mdx Outdated Show resolved Hide resolved
src/pages/learn/queries.mdx Outdated Show resolved Hide resolved
src/pages/learn/queries.mdx Outdated Show resolved Hide resolved
src/pages/learn/queries.mdx Outdated Show resolved Hide resolved
src/pages/learn/queries.mdx Outdated Show resolved Hide resolved
src/pages/learn/mutations.mdx Outdated Show resolved Hide resolved
src/pages/learn/mutations.mdx Outdated Show resolved Hide resolved
@benjie
Copy link
Member

benjie commented Nov 21, 2024

Not quite sure what happened here but it went to 136 files changed... I've merged in the latest source and resolved the conflicts... That seems to have us back down to 5 files changed.

Copy link
Member

@benjie benjie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this new structure and this is great content - really really good! I've included some minor nit-picky suggestions below - the only big change I think is that it would be nice to see the purpose-driven mutations content raised to be its own heading so it's easy to link to, and doing so may or may not require some minor reworking of the surrounding text.

src/pages/learn/subscriptions.mdx Outdated Show resolved Hide resolved
src/pages/learn/subscriptions.mdx Outdated Show resolved Hide resolved
src/pages/learn/subscriptions.mdx Outdated Show resolved Hide resolved
src/pages/learn/subscriptions.mdx Outdated Show resolved Hide resolved
src/pages/learn/subscriptions.mdx Outdated Show resolved Hide resolved
src/pages/learn/mutations.mdx Outdated Show resolved Hide resolved
src/pages/learn/mutations.mdx Outdated Show resolved Hide resolved
src/pages/learn/mutations.mdx Outdated Show resolved Hide resolved
src/pages/learn/mutations.mdx Outdated Show resolved Hide resolved
}
```

As a general rule, schemas should be designed to help clients get the data that they need from the GraphQL API, so the fields defined in a schema should be informed by those use cases.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really great content, but "get the data that they need from" seems very query-focussed (and side-effect free) - can you tweak it so that it better reflects mutations?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 1f3ae06.

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

Successfully merging this pull request may close these issues.

8 participants