Browse Source

fix: map swagger.json endpoint

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5444/head
Pranav C 2 years ago
parent
commit
4f7e0a14ff
  1. 7
      packages/nocodb-nest/src/modules/api-docs/api-docs.controller.ts

7
packages/nocodb-nest/src/modules/api-docs/api-docs.controller.ts

@ -1,4 +1,6 @@
import { Controller, Get, Param, Request, Response } from '@nestjs/common'; import { Controller, Get, Param, Request, Response, UseGuards } from '@nestjs/common'
import { GlobalGuard } from '../../guards/global/global.guard'
import { Acl, ExtractProjectIdMiddleware } from '../../middlewares/extract-project-id/extract-project-id.middleware'
import { ApiDocsService } from './api-docs.service'; import { ApiDocsService } from './api-docs.service';
import getSwaggerHtml from './template/swaggerHtml'; import getSwaggerHtml from './template/swaggerHtml';
import getRedocHtml from './template/redocHtml'; import getRedocHtml from './template/redocHtml';
@ -7,6 +9,9 @@ import getRedocHtml from './template/redocHtml';
export class ApiDocsController { export class ApiDocsController {
constructor(private readonly apiDocsService: ApiDocsService) {} constructor(private readonly apiDocsService: ApiDocsService) {}
@Get('/api/v1/db/meta/projects/:projectId/swagger.json')
@UseGuards(ExtractProjectIdMiddleware, GlobalGuard)
@Acl('swaggerJson')
async swaggerJson(@Param('projectId') projectId: string, @Request() req) { async swaggerJson(@Param('projectId') projectId: string, @Request() req) {
const swagger = await this.apiDocsService.swaggerJson({ const swagger = await this.apiDocsService.swaggerJson({
projectId: projectId, projectId: projectId,

Loading…
Cancel
Save