Skip to content

Commit

Permalink
Add links property type to RouteShorthandOptions interface (#450)
Browse files Browse the repository at this point in the history
* add links property type to RouteShorthandOptions interface

* add response and links related to response

Co-authored-by: Pietro Verdile <pietro.verdile@visto.global>
  • Loading branch information
Pietro Verdile and pverdile committed Aug 5, 2021
1 parent e2175eb commit f8b354b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ declare module 'fastify' {
*/
operationId?: string;
}

interface RouteShorthandOptions {
links?: {
[statusCode: string]: OpenAPIV3.ResponseObject['links'];
}
}
}

export const fastifySwagger: FastifyPluginCallback<SwaggerOptions>;
Expand Down
6 changes: 5 additions & 1 deletion test/types/types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ app.get('/public/route', {
schema: {
description: 'returns 200 OK',
summary: 'qwerty',
security: []
security: [],
response: { 200: {} }
},
links: {
200: {'some-route': { operationId: 'opeId'}}
}
}, (req, reply) => {});

Expand Down

0 comments on commit f8b354b

Please sign in to comment.