Skip to content

docs request: two slash and generated schema #1357

@Hebilicious

Description

@Hebilicious

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions