nexus-plugin-prisma icon indicating copy to clipboard operation
nexus-plugin-prisma copied to clipboard

inputObjectTypes exposed all fields

Open Bjoernstjerne opened this issue 5 years ago • 2 comments

I like the approach to white listen fields in ObjectTypes, why do InputObjectTypes includes all fields? For now I have to rewrite all InputTypes:

import {inputObjectType} from "nexus";

export const UserUpdateInput = inputObjectType({
    name: "UserUpdateInput",
    definition(t){
        t.string('email', {required: false})
    }
})

It would be very nice to have something like this:

import {inputObjectType} from "nexus";

export const UserUpdateInput = inputObjectType({
    name: "UserUpdateInput",
    definition(t){
        t.model('User').email()
    }
})

Bjoernstjerne avatar Oct 22 '19 09:10 Bjoernstjerne

@mazzaker is there a workaround ? This is what prevents us from migrating to prisma 2...

durdenx avatar Jan 22 '21 11:01 durdenx

@durdenx We rewrite all inputTypes, using only nexus without nexus-prisma-plugin. I changed the generator from https://github.com/paljs/prisma-tools to our needs (folder structure, one file per Input).

Bjoernstjerne avatar Jan 28 '21 12:01 Bjoernstjerne