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

docs request: two slash and generated schema #1357

Open
Hebilicious opened this issue Dec 6, 2024 · 0 comments
Open

docs request: two slash and generated schema #1357

Hebilicious opened this issue Dec 6, 2024 · 0 comments

Comments

@Hebilicious
Copy link

Hebilicious commented Dec 6, 2024

Hello there,

The new documentation website looks amazing, congratulations !
I have a few suggestions to improve it.

  1. TwoSlash for code blocks

There's an intergration with fumadocs so it shouldn't be hard :
https://fumadocs.vercel.app/docs/ui/twoslash

  1. Show generated schemas everywhere

It would be nice if every code block had some kind of tab to show the generated schema.
For example for the Hello World Example :

import { createYoga } from 'graphql-yoga';
import { createServer } from 'node:http';
import SchemaBuilder from '@pothos/core';
 
const builder = new SchemaBuilder({});
 
builder.queryType({
  fields: (t) => ({
    hello: t.string({
      args: {
        name: t.arg.string(),
      },
      resolve: (parent, { name }) => `hello, ${name || 'World'}`,
    }),
  }),
});
 
const yoga = createYoga({
  schema: builder.toSchema(),
});
 
const server = createServer(yoga);
 
server.listen(3000, () => {
  console.log('Visit http://localhost:3000/graphql');
});

It would show something like this in another tab, or in a collapsable frame :

type Query {
  hello(name: String): String!
}

It's already the case in some places in the docs like here https://pothos-graphql.dev/docs/plugins/errors#example-usage
Ideally you'd want a build step that generate these from the source code.

What do you think ?

@Hebilicious Hebilicious changed the title docs request: more interactivity docs request: two slash and generated schema Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant