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

Feature request: nexus-graphql plugin #180

Closed
swcho opened this issue Jul 11, 2019 · 3 comments
Closed

Feature request: nexus-graphql plugin #180

swcho opened this issue Jul 11, 2019 · 3 comments
Labels
note/duplicate This issue existed already type/discussion Discussion about proposals, etc.

Comments

@swcho
Copy link

swcho commented Jul 11, 2019

First of all, thank you for providing stunning solution.

I'd like to share my use case and if possible, I'd like to get some advice or relevant implementation plan.

Basic idea is to have some kind of nexus-prisma like plugin for normal graphql schema file.

Here is my use case.

  • I have swagger.json and it defines legacy internal APIs.
  • Generate normal graphql schema file with swagger-to-graphql
  • Generate TypeScripts definitions from normal graphql schema file with graphql-code-generator
  • Generate nexus wrapper codes from normal graphql schema file like nexus-prisma does.
  • Use nexus for code first graphql server with resolver to legacy API endpoint

I tried this idea with next fork from nexus-prisma
https://github.com/swcho/nexus-prisma/tree/study/examples-gql

And unable to running as nexus-prisma complains as below

Error: prismaObjectType can only be used by `makePrismaSchema`

I understand nexus-prisma is not intended to be used this way.

Thus, I wander if it is possible to have official plugin for normal graphql schema file.
Maybe, it's some what conflicts interest for prisma as a company.
But, let say if nexus could be a front end solution for legacy REST api or graphql with this kind of plugin,
it could have more chance to adapt prisma solution I hope.

Thank you.

@swcho swcho changed the title Feature request: graphql-code-generator plugin Feature request: nexus-graphql plugin Jul 11, 2019
@swcho
Copy link
Author

swcho commented Jul 21, 2019

I'd like to share my PoC for nexus-graphql forked from nexus-prisma.

It provides wrapper by generating definition from graphql schema.

https://github.com/swcho/nexus-graphql

@jasonkuhrt
Copy link
Member

Hey @swcho 👋

Thanks for reaching out with this idea.

Basic idea is to have some kind of nexus-prisma like plugin for normal graphql schema file.

We absolutely want nexus to have plugins, have you taken a look at #200 yet?

Thus, I wander if it is possible to have official plugin for normal graphql schema file.

Could you just generate a data-loader aware client from you swagger, then use it to implement nexus resolvers?

Are you interested in having the models in swagger be forwarded to the GraphQL Schema like prisma-nexus does (in its case, forward Prisma schemas to the GraphQL API via .model)?

Maybe, it's some what conflicts interest for prisma as a company.

Not really :) While Prisma is focused on abstracting the database layer we fully expect to be running in polyglot architectures where there data is coming from a mix of sources. We want nexus to be great at this and nexus-prisma to mesh well with GraphQL API entities which are composites from multiple sources, not just Prisma. Integration and flexibility are key for many use-cases.

it could have more chance to adapt prisma solution I hope.

👍 😊

@jasonkuhrt jasonkuhrt added the type/discussion Discussion about proposals, etc. label Sep 2, 2019
@jasonkuhrt
Copy link
Member

Hey @swcho I think we can treat this as a duplicate to #98. Pleaes bring your ideas for a plugin system there 🙏.

@jasonkuhrt jasonkuhrt added the note/duplicate This issue existed already label Sep 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
note/duplicate This issue existed already type/discussion Discussion about proposals, etc.
Projects
None yet
Development

No branches or pull requests

2 participants