Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | 1x 1x 1x 1x 1x 1x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x | import swagger from '@fastify/swagger';
import swaggerUi from '@fastify/swagger-ui';
import type {FastifyInstance, FastifyPluginOptions} from 'fastify';
import fp from 'fastify-plugin';
export default fp<{version: string}>(async function swaggerPlugin(
fastify: FastifyInstance,
{version}: FastifyPluginOptions,
) {
await fastify.register(swagger, {
openapi: {
info: {
title: 'api',
version,
},
components: {
securitySchemes: {
'blong-login': {
flows: {
authorizationCode: {
authorizationUrl: '/rpc/login/form',
scopes: {
api: 'Public API',
},
tokenUrl: '/rpc/login/token',
},
},
type: 'oauth2',
},
},
},
},
});
await fastify.register(swaggerUi, {
initOAuth: {
usePkceWithAuthorizationCodeGrant: true,
scopes: ['api'],
clientId: 'demo',
},
});
});
|