MichalLytek / type-graphql

Create GraphQL schema and resolvers with TypeScript, using classes and decorators!
https://typegraphql.com
MIT License
8.03k stars 676 forks source link

SDL converter #251

Open MichalLytek opened 5 years ago

MichalLytek commented 5 years ago

Based on the conversation on the schema first approach (#222), it would be nice to have a website (or as a part of TypeGraphQL CLI - #66) that would convert the schema definition to TypeGraphQL type classes and empty resolvers (without method implementation).

Of course it would be hard to detect common things like Connection or Edge generics so the generator would produce not optimal TypeGraphQL code but it would be still better than rewriting the types by hand.

*Side note: Inspired by Nexus.js SDL converter: https://nexus.js.org/converter

MichalLytek commented 5 years ago

We now have a GraphQL Code Generator plugin for emitting TypeGraphQL type classes from SDL schema 🎉

https://graphql-code-generator.com/docs/plugins/typescript-type-graphql

It might be used by the SDL converter tool on the website.

a-suenami commented 4 years ago

Hi, @MichalLytek Thank you so much for the great library and plugin.

It's just a question but typescript-type-graphql plugin of graphql-code-generator could generate type classes for me, but couldn't generate resolver classes. Can I do that any way?

I tried typescript-resolver plugin but it didn't add the @Resolver annotation so I won't use for type-graphql.

MichalLytek commented 4 years ago

@a-suenami Ask on graphql-code-generator repository for assist with that, I'm not the author of the plugin.

I agree that it would be nice to generate resolvers classes with args that would just throw "not implemented" error in body.

michal239 commented 4 years ago

The graphql-codegen output looks a little messy

Bez tytułu