Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Mutation Input and Payload Structure in GraphQL


    Relay comes with a specification and a set of well define conventions for GraphQL Mutations. By following the conventions, we not only design Mutations in a way that they can be extended with easy, but also reduce a lot of cognitive overhead.

    We can summarise the conventions into 5 rules:

    1. Mutations are named as verbs createProduct, introduceShip, deleteCollection.
    2. There must be a single argument input
    3. The input type name is the capitalised mutation name with a Input postfix e.g. CreateProductInput, IntroduceShipInput.
    4. The returned value is a new custom type that can contain various fields.
    5. The return type is name is the capitalized mutation name with a Payload postfix e.g. CreateProductPayload, IntroduceShipPayload.