Catch the highlights of GraphQLConf 2023! Click for recordings. Or check out our recap blog post.
Docs
Recipes
OpenAPI (Swagger)

OpenAPI (Swagger)

Thanks to GraphQL’s Type System Sofa is able to generate OpenAPI (Swagger) definitions out of it. Possibilities are endless here. You get all the information you need in order to write your own definitions or create a plugin that follows any specification.

import { useSofa } from 'sofa-api';
 
app.use(
  '/api',
  useSofa({
    schema,
    basePath: '/',
    openAPI: {
      info: {
        title: 'Example API',
        version: '3.0.0',
      }
      endpoint: '/openapi.json',
    },
    swaggerUI: {
      path: '/docs',
    }
  })
);

You can find swagger definitions in /api/openapi.json route.