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

Support for Apollo client schema generation #291

Closed
quentinus95 opened this issue Mar 27, 2019 · 6 comments
Closed

Support for Apollo client schema generation #291

quentinus95 opened this issue Mar 27, 2019 · 6 comments
Labels
Duplicate 🔑 This issue or pull request already exists

Comments

@quentinus95
Copy link

This may be related to #197.

So Apollo Client now supports client-side schema.
https://blog.apollographql.com/announcing-apollo-client-2-5-c12230cabbb7

Could / does type-graphql support generating client side schema extensions ? It would be awesome!

As always, thanks for your work.

@quentinus95
Copy link
Author

Note that I already share my type-graphql classes with my frontend, the only warning I get is
warning in ./node_modules/type-graphql/helpers/loadResolversFromGlob.js
Critical dependency: the request of a dependency is an expression

But I guess the question here is how to support the new extend keyword (maybe through class inheritance?).

@MichalLytek
Copy link
Owner

MichalLytek commented Mar 27, 2019

Yeah, apollo-link-state = Apollo Client 2.5 client-side schema, so it's a duplicate of #197 🔒

You should try buildTypeDefsAndResolvers and the dirty hack or webpack alias for glob package.

@MichalLytek MichalLytek added the Duplicate 🔑 This issue or pull request already exists label Mar 27, 2019
@quentinus95
Copy link
Author

@19majkel94 thanks for your answer, what about support for the extend keyword?

@MichalLytek
Copy link
Owner

@quentinus95 See #228.
If you thinking about extending type from server schema, it might be super tricky with graphql-js. Maybe in the future I will support printing arbitrary typeDefs, not the entire printed schema.

@iEricKoh
Copy link

@19majkel94 I am gong to try it with apollo client side schema, I was wondering is it possible to combine two typeDefs together when calling buildTypeDefsAndResolvers.

// client schema type extend from server schema
export const typeDefs = gql`
  extend type Product {
    selectedOptions: String!
  }
`

// types define by type-graphql
@ObjectType()
export default class Counter {
  @Field()
  value!: number;
}

@MichalLytek
Copy link
Owner

You can use whatever you want from the broad GraphQL ecosystem, you're not coupled to TypeGraphQL using buildTypeDefsAndResolvers:
https://www.apollographql.com/docs/graphql-tools/schema-stitching#adding-resolvers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate 🔑 This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants