Comments (10)
Since 5.1.0 you can restrict modules that should be included in the lookup process. For instance, if you want only resolvers from CatsModule
and DogsModule
to be included, simply pass them into include
array:
GraphQLModule.forRoot({
typePaths: ['./**/*.graphql'],
include: [CatsModule, DogsModule],
}),
from graphql.
Thanks for repo @Rockson. Just fixed the issue, update your graphql package into 5.3.1!
from graphql.
There is one more problem. Before I have used GraphQLFactory.createSchema, for create schema with custom settings.
const typeDefs = this.graphQLFactory.mergeTypesByPaths('src/admin/**/*.graphql');
const resolverValidationOptions: IResolverValidationOptions = {allowResolversNotInSchema: true};
const schema = this.graphQLFactory.createSchema({typeDefs, resolverValidationOptions});
But for now this method dropped.
from graphql.
So, I have two modules: SiteModule and AdminModule. Each of them imports GraphQLModule. AdminModule also imports AuthModule with some, for example, AuthResolver in providers. SiteModule sees AuthResolver too, but in *.graphql files inside SiteModule there isn't mutation which exists in AuthResolver.
For now if in root-module I import so:
imports: [
SiteModule,
AdminModule,
],
I get error: Error: "Mutation" defined in resolvers, but not in schema
. If I change order:
imports: [
AdminModule,
SiteModule,
],
I don't get errors during start of application, but I get 404, when I try to get /site
.
I think we need a way to pass resolverValidationOptions
here or reimplement ResolversExplorerService
.
from graphql.
@kamilmysliwiec thanks for your work! I think, in some cases include
property can be useful, but not in my. Let's imagine, we have CatsModule with CatsResolver. In CatsResolver there is queries for getting one or many cats. Also in the same resolver there is a mutation for editing of cat. Queries enabled for all users, but mutation only for administrators. So we don't need include information about mutation in schema of public API, but we have to include CatsModule for both endpoint.
from graphql.
@kamilmysliwiec I Can't make it work with forRootAsync
This works
GraphQLModule.forRoot({
typePaths: ['./admin/**/*.graphql'],
include: [AdminModule],
path: '/admin'
}),
GraphQLModule.forRoot({
typePaths: ['./client/**/*.graphql'],
include: [ClientModule],
path: '/client'
}),
this doesn't, only the admin endpoint is available
GraphQLModule.forRootAsync({
imports: [ConfigModule],
useExisting: AdminGqlConfigService,
}),
GraphQLModule.forRootAsync({
imports: [ConfigModule],
useExisting: ClientGqlConfigService,
}),
ConfigModule: https://gitlab.com/fabio.rizzello.lav/nest-graphql-multiple-endpoints-forRootasync-issue/blob/master/src/app/config.module.ts
Here is the demo repo:
https://gitlab.com/fabio.rizzello.lav/nest-graphql-multiple-endpoints-forRootasync-issue
Start the server: /gqladmin is available but /gqlclient returns 404
I'm using nest 5.3.0
from graphql.
Have you tried updating all packages to recent patch versions?
from graphql.
My package json
"@nestjs/common": "^5.3.7",
"@nestjs/core": "^5.3.7",
"@nestjs/graphql": "^5.3.0",
I removed node_modules and then installed dependencies again
The problem persists
from graphql.
@kamilmysliwiec
Has I've written in gitter, I think there is a problem when including the endpoint's modules
Here is the repo updated https://gitlab.com/fabio.rizzello.lav/nest-graphql-multiple-endpoints-forRootasync-issue
Is similar to the previous one I've only implemented the resovler viewer inside the clientResolver
https://gitlab.com/fabio.rizzello.lav/nest-graphql-multiple-endpoints-forRootasync-issue/blob/master/src/gql/client/client.resolver.ts
Looks like nest doesn't register the resolver because the function isn't called
from graphql.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
from graphql.
Related Issues (20)
- TypeScript definitions generated with wrong case HOT 2
- `GraphQLModule` should throw an error if schema files are not found HOT 2
- Expose GraphQLModule options and gqlSchemaHost to support Serverless
- How to send partial data with error object using @Context
- CustomScalar parseLiteral doesn't allow null return type HOT 2
- Unable to Specify forRoutes Argument When Assigning Middleware to '/graphql' Endpoint
- ResolveField shouldn't be called when the field already has a value HOT 1
- Support for Custom Fields Decorators in Mapped types
- Extend `dateScalarMode` and `numberScalarMode` to allow custom scalars to be used by default
- Subscription graphql this on resolve does not access services being injected in the constructor HOT 1
- Support for @defer directive in GraphQL HOT 2
- @nestjs/graphql compatibility with ts-morph 22.0.0 HOT 1
- Regular Expression Denial of Service (ReDoS) vulnerability HOT 2
- Feat | clarifying `DefinitionsGeneratorOptions#defaultTypeMapping` supported types
- Incomplete schema produced with code-first approach: directives are omitted HOT 1
- @nestjs/graphql depends on vulnerable version of ws HOT 1
- Upgrade WS dependency - ws affected by a DoS when handling a request with many HTTP headers HOT 3
- v12.2.0 - Error: Schema must contain uniquely named types but contains multiple types named "DateTime"
- npm warn deprecated @apollo/[email protected] HOT 1
- Allow sortSchema via GraphQLDefinitionsFactory HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql.