📝 Introduce auto generate API doc

This commit is contained in:
Baptiste Arnaud
2022-11-22 17:30:20 +01:00
parent 04af489119
commit 11695efb57
60 changed files with 1480 additions and 914 deletions

View File

@@ -1,4 +1,4 @@
import { getAuthenticatedUser } from '@/features/auth'
import { getAuthenticatedUser } from '@/features/auth/api'
import { inferAsyncReturnType } from '@trpc/server'
import * as trpcNext from '@trpc/server/adapters/next'

View File

@@ -0,0 +1,15 @@
import { generateOpenApiDocument } from 'trpc-openapi'
import { writeFileSync } from 'fs'
import { appRouter } from './routers/v1/_app'
const openApiDocument = generateOpenApiDocument(appRouter, {
title: 'Builder API',
version: '1.0.0',
baseUrl: 'https://app.typebot.io/api/v1',
docsUrl: 'https://docs.typebot.io/api',
})
writeFileSync(
'./openapi/builder.json',
JSON.stringify(openApiDocument, null, 2)
)

View File

@@ -1,5 +1,5 @@
import { resultsRouter } from '@/features/results/api'
import { router } from '../trpc'
import { router } from '../../trpc'
export const appRouter = router({
results: resultsRouter,