hayes / pothos

Pothos GraphQL is library for creating GraphQL schemas in typescript using a strongly typed code first approach
https://pothos-graphql.dev
ISC License
2.36k stars 164 forks source link

Mixed types with values in docs #620

Open ChromeGG opened 2 years ago

ChromeGG commented 2 years ago

The types are mixed with values in this docs https://pothos-graphql.dev/docs/plugins/smart-subscriptions

const builder = new SchemaBuilder({
  plugins: [SmartSubscriptionsPlugin],
  smartSubscriptions: {
    debounceDelay: number | null;
    subscribe: (
      name: string,
      context: Context,
      cb: (err: unknown, data?: unknown) => void,
    ) => Promise<void> | void;
    unsubscribe: (name: string, context: Context) => Promise<void> | void;
  },
});

btw. I'm struggling with working example with yoga graphQL. It will be nice to have working example and more documentation.

TY & GJ, I love this lib ❤️

hayes commented 2 years ago

Subscriptions are definitely something that we need better examples of. The types are there in the docs because creating a good relevant example was pretty complicated.

There is a more complete example in the tests: https://github.com/hayes/pothos/tree/149eb3ea286f747c7bc9391bce467b7a8bb813de/packages/plugin-smart-subscriptions/tests/example

The actual schema has a bunch of things to test specific patterns, and isn't a great example of how to structure things, but it might still be helpful.