Git Product home page Git Product logo

Comments (2)

deweyjose avatar deweyjose commented on July 19, 2024

To the best of my knowledge there isn't a way.

Also - you need to create an input type for your mutation. You can't pass a non input type to a mutation.

I would think about making the input type require a releaseYear in this case.

How would your resolver handle the two scenarios: 1. "not present" null vs 2. "explicit" null, differently?

I've added a mutation to the example repo.

type Query {
    shows(titleFilter: String): [Show]
}

type Mutation {
   createShow(showInput: ShowInput!): Show
}

type Show {
    id: Int
    title: String
    releaseYear: Int
}

input ShowInput {
    title: String!
    releaseYear: Int!
}

from graphqlcodegen.

Yang-Jace-Liu avatar Yang-Jace-Liu commented on July 19, 2024

Thank you @deweyjose for your reply. I'm creating a mutation used for updating rows in the database. I'm trying to make the mutation have the ability to "partially update" and "nullify objects", so here's the question.

My design was: If the field is set to null explicitly, it means the request wants to nullify the field in the database. If the field is not presented, the field is ignored. If the field is set to a non-null value, we replace the old value with the new value passed in.

Since we cannot tell the difference between the first 2 scenarios after Inputs are mapped to Java classes, I guess I need to find another way around.

Thanks for your reply.

from graphqlcodegen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.