-
-
Notifications
You must be signed in to change notification settings - Fork 198
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please update example folder for typescript #694
Comments
Can provide a PR please? |
i cant, please help |
Remove |
|
Please read migration.md |
one more question, i ve connected swagger to fastify with swagger ui, define a router with schema, but in swagger doc, it not auto generated this is my config await fastify.register(fastifySwagger, {
swagger: {
info: {
title: ' Swagger',
description: 'Testing swagger API',
version: '0.1.0',
},
host: `${HOST}:${PORT}`,
schemes: ['http'],
consumes: ['application/json'],
produces: ['application/json'],
swagger: '2.0',
},
});
await fastify.register(fastifySwaggerUi, {
routePrefix: '/v1/example/docs',
initOAuth: {},
uiConfig: {
docExpansion: 'full',
deepLinking: false,
},
uiHooks: {
onRequest: function (request, reply, next) {
next();
},
preHandler: function (request, reply, next) {
next();
},
},
staticCSP: true,
transformStaticCSP: (header) => header,
}); and router fastify.get(
'/',
{
schema: {
description: 'This is an endpoint for fetching all users',
tags: ['users'],
response: {
200: {
description: 'Success Response',
type: 'array',
items: {
type: 'object',
properties: {
id: { type: 'number' },
name: { type: 'string' },
age: { type: 'number' },
createdAt: { type: 'string' },
updatedAt: { type: 'string' },
},
},
},
},
},
},
async function (request: FastifyRequest, reply: FastifyReply) {
return fastify.exampleService.getAll();
}
); please advise me |
you need both fastify-swagger and fastify-swagger-ui |
yes, i have |
Please share full config then |
please see above, it's my all configs, or what else ? |
please see above |
here you have a fully working example https://github.com/borjatur/clean-architecture-fastify-mongodb/blob/master/src/infrastructure/http/plugins/docs.ts hope that can help you |
I tried the same and was unable to generate docs automatically for my APIs. |
Everything is working fine for me, so it would be useful to have a reproduction. |
I copied and pasted examples from the documentation, and everything is functioning well: GitHub Link. Similarly, I replicated the contents of the docs.ts file from @borjatur's example, and it is also working smoothly: GitHub Link. |
If there are problems then please open a new issue. |
Prerequisites
馃殌 Feature Proposal
currently im working with fastify swagger and typescript, follow as example folder.
but when use exposeRoute option, it will prompt error
Motivation
No response
Example
The text was updated successfully, but these errors were encountered: