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

Generated schemas for multiple instances are same #205

Closed
Fyzu opened this issue Apr 7, 2019 · 10 comments
Closed

Generated schemas for multiple instances are same #205

Fyzu opened this issue Apr 7, 2019 · 10 comments
Labels

Comments

@Fyzu
Copy link
Contributor

Fyzu commented Apr 7, 2019

I'm submitting a...


[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

I'm using multiple GraphQL instances with code first pattern.

Example:

GraphQLModule.forRoot({
      path: '/graphql',
      include: [CatModule],
      autoSchemaFile: 'graphql/schema.graphql',
    }),
    GraphQLModule.forRoot({
      path: '/admin-graphql',
      include: [CatAdminModule],
      autoSchemaFile: 'graphql/admin-schema.graphql',
    }),

It will generate same schemas, include all resolvers and types in project.

Expected behavior

Generated schemas include only declared modules.

Environment


Nest version: 6.0.5

 
For Tooling issues:
- Node version: v11.11.0
- Platform:  Mac

Others:

@Fyzu
Copy link
Contributor Author

Fyzu commented Apr 7, 2019

This cannot be fixed until the metadata collection logic has been rewritten in type-graphql

MichalLytek/type-graphql#183

@Fyzu
Copy link
Contributor Author

Fyzu commented Apr 7, 2019

Started working on it there MichalLytek/type-graphql#304

@regnerisch
Copy link

Facing the same Issue.

@evilsprut
Copy link

evilsprut commented Aug 15, 2019

@Fyzu maybe you have a temporary workaround until the type-graphql author solves the problem?

@Fyzu
Copy link
Contributor Author

Fyzu commented Aug 18, 2019

@bukhalo don't use type-graphql, author doesn't accept any contribution and wants money for work ¯_(ツ)_/¯

@MichalLytek
Copy link

MichalLytek commented Aug 25, 2019

author doesn't accept any contribution

Only 37 merged PRs ¯_(ツ)_/¯
https://github.com/MichalLytek/type-graphql/pulls?utf8=✓&q=is%3Apr+sort%3Aupdated-desc+is%3Amerged+label%3A"Community++%3Afamily_man_girl%3A"+

wants money for work

How the open source developers dare to want money for maintaining the open source project that many companies uses! Scandal! 🙈

As I said in that issue, I can't accept a PR with a complete rewrite of the core done by an external contributor. And as I'm preparing a complete rewrite with monorepo, I won't double my work to rewrite the pipeline now and then rewrite again e.g. to add proper plugins support.

For now you can use your fork and publish it on npm as @fyzu/type-graphql or just wait ™ for the vNext release.

@Fyzu
Copy link
Contributor Author

Fyzu commented Aug 26, 2019

Only 37 merged PRs ¯_(ツ)_/¯

25 of them are about documentation
https://github.com/MichalLytek/type-graphql/pulls?q=is%3Apr+sort%3Aupdated-desc+is%3Amerged+label%3A%22Community++%3Afamily_man_girl%3A%22+label%3A%22Documentation+%3Abook%3A%22

How the open source developers dare to want money for maintaining the open source project that many companies uses! Scandal! 🙈

what a problem, to let community contribute to project? many devs wanna use and move forward projects like that, without "donate money", only "donate" their own time

@MichalLytek
Copy link

25 of them are about documentation

So 37-25 = 12 PR of features -> "doesn't accept any contribution"? 😄

what a problem, to let community contribute to project?

There are 6 issues that are open for help but nobody wants to make a PR 😞
https://github.com/MichalLytek/type-graphql/issues?q=is%3Aopen+is%3Aissue+label%3A"Help+Wanted+%3Asos%3A"

I will reverse your question:
What a problem to create your own fork and only "donate" your own time? If you have time and better ideas, you can even name it better-type-graphql, provide integration with Nest and use it!

If you think that TypeGraphQL is overrated, there are plenty similar project that you can contribute too if you don't want your own OSS project:
https://github.com/ts-graphql/ts-graphql
https://github.com/RaccoonCH/Rakkit
https://github.com/prismake/typegql

maybe you have a temporary workaround until the type-graphql author solves the problem?

@bukhalo It's tracked by #110 - you need to have imports separation in your app and run two node processes:
MichalLytek/type-graphql#110 (comment)

@dmytropaduchak
Copy link

dmytropaduchak commented Nov 23, 2019

its work for me, just add validation rule to GqlModuleOptions:

resolverValidationOptions: {
  allowResolversNotInSchema: true,
}

full example:

const GRAPHQL_OPTIONS: GqlModuleOptions = {
  debug: true,
  playground: true,
  tracing: true,
  introspection: true,
  installSubscriptionHandlers: true,
  resolverValidationOptions: {
    allowResolversNotInSchema: true,
  },
  context: ({ req }) => ({ req }),
};
@Module({
  imports: [
    GraphQLModule.forRootAsync({
      imports: [ConfigModule, ResolverModule1, ResolverModule2],
      useFactory: async (configService: ConfigService) => ({
        path: configService.find('GRAPHQL_ADMIN_PATH') || GRAPHQL_ADMIN_PATH,
        typePaths: [GRAPHQL_TYPE_ADMIN_PATH],
        ...GRAPHQL_OPTIONS,
      }),
      inject: [ConfigService],
    }),
    GraphQLModule.forRootAsync({
      imports: [ConfigModule, ResolverModule3, ResolverModule4],
      useFactory: async (configService: ConfigService) => ({
        path: configService.find('GRAPHQL_PATH') || GRAPHQL_PATH,
        typePaths: [GRAPHQL_TYPE_PATH],
        ...GRAPHQL_OPTIONS,
      }),
      inject: [ConfigService],
    }),
    TypeORMModule, 
  ],
})
export class AppModule {}

@kamilmysliwiec
Copy link
Member

Let's track this here #721

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants