Skip to content

Commit

Permalink
chore: update swagger setting (#46)
Browse files Browse the repository at this point in the history
chore/update swagger setting

Co-authored-by: shl0501 <[email protected]>
  • Loading branch information
shl0501 and shl0501 authored Nov 8, 2024
1 parent b9324aa commit 4dcfef7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion apps/server/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async function bootstrap() {
const config = new DocumentBuilder().setTitle('API Documentation').setDescription('NestJs API documentation').setVersion('1.0').build();

const document = SwaggerModule.createDocument(app, config);
SwaggerModule.setup('api-docs', app, document);
SwaggerModule.setup('api/docs', app, document);

await app.listen(process.env.PORT ?? 3000);
}
Expand Down
14 changes: 12 additions & 2 deletions apps/server/src/users/swagger/check-duplication.swagger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,19 @@ export const CheckDuplicationSwagger = {
example: { type: 'success', data: { exists: 'true || false' } },
},
}),

ApiResponse400: ApiResponse({
status: 400,
description: '잘못된 요청: email 또는 nickname 하나만 제공해야 합니다.',
description: '잘못된 요청 (유효성 검사 실패)',
schema: {
example: {
type: 'fail',
error: {
message: {
errorType1: '이메일 또는 닉네임 하나만 요청해 주세요.',
errorType2: '올바른 이메일 형식이어야 합니다.',
},
},
},
},
}),
};
11 changes: 6 additions & 5 deletions apps/server/src/users/swagger/create-user.swagger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ export const CreateUserSwagger = {
schema: {
example: {
type: 'fail',
error: '잘못된 요청입니다. 필드를 확인하세요.',
message: {
email: '이메일 형식이 올바르지 않습니다.',
nickname: '닉네임은 최소 3자 이상이어야 합니다.',
password: '비밀번호는 최소 8자 이상이어야 합니다.',
error: {
message: {
email: '이메일 형식이 올바르지 않습니다.',
nickname: '닉네임은 최소 3자 이상이어야 합니다.',
password: '비밀번호는 최소 8자 이상이어야 합니다.',
},
},
},
},
Expand Down

0 comments on commit 4dcfef7

Please sign in to comment.