docs: incorrect configuration in Next.js example
m-abdelwahab opened this issue · 1 comments
m-abdelwahab commented
The following Next.js code example https://the-guild.dev/openapi/fets/server/integrations/nextjs#usage works but TypeScript complains
import { createRouter, Response } from 'fets'
export default createRouter({
swaggerUiEndpoint: '/api/docs',
oasEndpoint: '/api/openapi.json'
}).route({
method: 'GET',
path: '/api/greetings',
schemas: {
responses: {
200: {
type: 'object',
properties: {
message: {
type: 'string'
}
},
required: ['message'],
additionalProperties: false
}
}
} as const,
handler: () => Response.json({ message: 'Hello World!' })
})
Updating it to this fixes the type error
import { createRouter, Response } from 'fets'
export default createRouter({
+ swaggerUI: {
+ endpoint: '/api/docs'
+ },
+ openAPI: {
+ endpoint: '/api/openapi.json'
+ }
}).route({
method: 'GET',
path: '/api/greetings',
schemas: {
responses: {
200: {
type: 'object',
properties: {
message: {
type: 'string'
}
},
required: ['message'],
additionalProperties: false
}
}
} as const,
handler: () => Response.json({ message: 'Hello World!' })
})
ardatan commented
Thanks for the PR! It's merged now!