Need to add support for GraphQL (Code First) schema generation using @nrwl/node libraries
See original GitHub issueDescription
Trying to achieve the GraphQL code first schema generation using @nrwl/node libraries. Say for example, we want to segregate all the entities in to separate library of its own kind so that the same classes can be used across the projects and at the same time can be decorated with @ObjectType as well as @Entity decorators for graphql and typeorm to coexist.
However as these libraries will not be compiled into the respective js files per entity (or combined for that matter).
autoSchemaFile: '/schema.gql',
The above would result into the following error.
GraphQLError [Object]: Query root type must be provided.
as the following
import { AuthEntity } from '@nx-ws/shared/data-access';
is the classes within the library are not treated same as the class, when they are under the same project.
Shouldn’t there be a way to compile these entities prior to the other projects and entities be stitched to one schema.gql
!!!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:19
@vespertilian ,
That’s alright, I can understand, we all have some real world projects to work on. Me also kind of tide up with something. BTW, I tried changing (hard-coding) the compilerOptions - Path of out dir etc,last weekend, however still getting same/similar issue. Once I’ll get some handful amount of bandwidth I’ll jump on to it.
Thanks for kicking back on this thread, it makes me feel alive.
-N Baua
@nguyennhattan1398
So I just use GraphQL code-gen to generate the types for my frontend, from my backend code. So they are separate projects and only linked when I rebuild the type definitions via GraphQL Codegen.
Would have been nice to just use the classes directly but this works well enough for now. GraphQL Codegen also will generate types for your queries so you probably want it anyway.
https://github.com/nrwl/nx-apollo-example