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

Allowing composite types #298

Open
Weakky opened this issue Jun 24, 2019 · 1 comment
Open

Allowing composite types #298

Weakky opened this issue Jun 24, 2019 · 1 comment
Labels
needs/use-cases More motivating examples needed to understand/appreciate idea/tradeoffs type/feat Add a new capability or enhance an existing one

Comments

@Weakky
Copy link
Member

Weakky commented Jun 24, 2019

Description

So far, nexus-prisma was working on the assumption that your prisma models would match your graphql type name. That limitation has already been removed, but we'd like to go one step further, by enabling the ability to "stitch" resolvers from several models.

Use-case

It might be that you have several users models (Customer, Admin, Moderator...), but that you'd like to expose them all as on single GraphQL object type.

Rough proposal

export const User = objectType({
  name: 'User',
  definition(t) {
    t.models.Customer.something()
    t.models.Admin.somethingElse()
    t.models.Moderator.somethingElseElse()
  }
})

Side notes

That is also be related to #302 as we'll need to handle backingTypes.

@Weakky Weakky added the v2 label Jun 24, 2019
@jasonkuhrt jasonkuhrt added type/feat Add a new capability or enhance an existing one needs/use-cases More motivating examples needed to understand/appreciate idea/tradeoffs and removed v2 labels Sep 5, 2019
@jasonkuhrt
Copy link
Contributor

Lets gather more use-cases. Feels like something that is powerful in concept but whose utility is highly coupled to situation/context. I'm lacking the imagination to think of such situations right now :)

I wonder if composites in practice would be more likely to mash disparate models together rather than your current example of closely related things put under a generalized type. Really not sure... 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs/use-cases More motivating examples needed to understand/appreciate idea/tradeoffs type/feat Add a new capability or enhance an existing one
Projects
None yet
Development

No branches or pull requests

2 participants