mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-24 20:14:35 -04:00
docs: improved auto-generated openapi docs
With these additional annotations the openapi docs under `/apidoc` and `/private/apidoc` will be improved by adding errors that the requests can return Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
2bc8c0d6da
commit
796b8294cf
10 changed files with 183 additions and 34 deletions
|
@ -16,12 +16,15 @@ import {
|
|||
} from '@nestjs/common';
|
||||
import { FileInterceptor } from '@nestjs/platform-express';
|
||||
import {
|
||||
ApiBadRequestResponse,
|
||||
ApiBody,
|
||||
ApiConsumes,
|
||||
ApiCreatedResponse,
|
||||
ApiForbiddenResponse,
|
||||
ApiHeader,
|
||||
ApiInternalServerErrorResponse,
|
||||
ApiNoContentResponse,
|
||||
ApiNotFoundResponse,
|
||||
ApiSecurity,
|
||||
ApiTags,
|
||||
ApiUnauthorizedResponse,
|
||||
|
@ -37,7 +40,10 @@ import { Note } from '../../../notes/note.entity';
|
|||
import { NotesService } from '../../../notes/notes.service';
|
||||
import { User } from '../../../users/user.entity';
|
||||
import {
|
||||
badRequestDescription,
|
||||
forbiddenDescription,
|
||||
internalServerErrorDescription,
|
||||
notFoundDescription,
|
||||
successfullyDeletedDescription,
|
||||
unauthorizedDescription,
|
||||
} from '../../utils/descriptions';
|
||||
|
@ -78,8 +84,13 @@ export class MediaController {
|
|||
description: 'The file was uploaded successfully',
|
||||
type: MediaUploadUrlDto,
|
||||
})
|
||||
@ApiBadRequestResponse({ description: badRequestDescription })
|
||||
@ApiUnauthorizedResponse({ description: unauthorizedDescription })
|
||||
@ApiForbiddenResponse({ description: forbiddenDescription })
|
||||
@ApiNotFoundResponse({ description: notFoundDescription })
|
||||
@ApiInternalServerErrorResponse({
|
||||
description: internalServerErrorDescription,
|
||||
})
|
||||
@UseInterceptors(FileInterceptor('file'))
|
||||
@HttpCode(201)
|
||||
async uploadMedia(
|
||||
|
@ -100,6 +111,9 @@ export class MediaController {
|
|||
@Delete(':filename')
|
||||
@HttpCode(204)
|
||||
@ApiNoContentResponse({ description: successfullyDeletedDescription })
|
||||
@ApiInternalServerErrorResponse({
|
||||
description: internalServerErrorDescription,
|
||||
})
|
||||
@FullApi
|
||||
async deleteMedia(
|
||||
@RequestUser() user: User,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue