GithubHelp home page GithubHelp logo

Comments (8)

MichalLytek avatar MichalLytek commented on June 12, 2024 1

@geisterfurz007
The @oneOf does not make an input union.
In this case, we can't have disconnect field of type Boolean | SomePrismaType.
We would need to split them into disconnectBoolean: Boolean and disconnectComplex: SomePrismaType and then in resolver merge them into disconnect Prisma Client query object.

from typegraphql-prisma.

MichalLytek avatar MichalLytek commented on June 12, 2024

This is a big problem with graphql not supporting input union while prisma does. So they accept boolen or filter object while in graphql we can't, so in most cases it accepts the object but for this case it might be problematic.

from typegraphql-prisma.

andrewleverette avatar andrewleverette commented on June 12, 2024

Thank you for the quick response. So this is a limitation of GraphQL? Do you know of a good workaround? Or is there any work that could be done to resolve this issue? I would be open to contributing, but not sure where I would start with this.

Also, just for reference. I found this document that seemed relevant -> https://github.com/graphql/graphql-wg/blob/21e8ecd30934843cbb175758eaa3d80325cd0929/rfcs/InputUnion.md

from typegraphql-prisma.

geisterfurz007 avatar geisterfurz007 commented on June 12, 2024

There is also the oneOf directive on inputs which is still not part of the official spec but supported by most tooling afaik. Maybe that could work here? I am not sure if that is an option since it would mean an object with two fields instead of a single field passed directly as argument.

from typegraphql-prisma.

andrewleverette avatar andrewleverette commented on June 12, 2024

Is it possible to distinguish between relational types like one-one, one-many, etc? It seems like in the cases of a one-one relationship, the disconnect field could be the boolean and a where input type in the other cases. I could be missing something though.

from typegraphql-prisma.

andrewleverette avatar andrewleverette commented on June 12, 2024

For further information, I upgraded to 0.27.0 and this issue does not exist in that version.

from typegraphql-prisma.

shawnjones253 avatar shawnjones253 commented on June 12, 2024

For further information, I upgraded to 0.27.0 and this issue does not exist in that version.

double-checking, you don't have this problem with 0.27.0?

we do have this problem with:

"typegraphql-prisma": "0.27.0",
"prisma": "4.16.2"

from typegraphql-prisma.

andrewleverette avatar andrewleverette commented on June 12, 2024

@shawnjones253, I confirmed we have the same problem in 0.27.0. There was an issue in my build process that was pulling an older version, so we were getting a false positive. We ended up just reverting 0.25.1.

from typegraphql-prisma.

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.