mares-swagger-spec-maker
Version:
mares framework ���조에 맞춰서openapi spec을 combine 해주는 모듈입니다.
115 lines (113 loc) • 4.21 kB
JavaScript
const env = process.env.NODE_ENV || 'development';
module.exports = {
openapi: "3.0.0",
servers: [{
url: env === 'development' ? 'http://localhost:8080' : 'https://slogup.com'
}],
info: {
description: 'description',
version: 'version',
title: 'title',
termsOfService: 'http://swagger.io/terms/',
contact: {
email: 'dev@slogup.com'
},
license: {
name: 'Private',
url: 'http://slogup.com'
}
},
components: {
schemas: {
SingleError: {
type: 'object',
description: '단일 에러일 경우 공통 형태',
properties: {
code: {
type: 'string',
description: '에러코드, 영문 숫자 혼합',
example: 'invalidId'
},
msg: {
type: 'string',
description: '에러코드의 국가별 번역 메세지, 헤더의 언어코드를 읽고 해당 언어코드의 해당하는 메세지로 번역. 만일 지원하지 않는 언어코드라면 기본 언어값으로 설정된다.',
example: '잘못된 아이디 입니다.'
}
}
},
MultiError: {
type: 'array',
description: '에러가 여러개 일 경우 배열로 에러 객체가 온다.',
items: {
type: 'object',
properties: {
code: {
type: 'string',
description: '에러코드, 영문 숫자 혼합',
example: 'invalidId'
},
param: {
type: 'string',
description: '어떤 필드에서 에러가 났는지 알려준다.',
example: 'aid'
},
msg: {
type: 'string',
description: '에러코드의 국가별 번역 메세지, 헤더의 언어코드를 읽고 해당 언어코드의 해당하는 메세지로 번역. 만일 지원하지 않는 언어코드라면 기본 언어값으로 설정된다.',
example: '잘못된 아이디 입니다.'
}
}
}
}
},
parameters: {
offsetParam: {
in: 'query',
name: 'offset',
description: '건너띌 row 수, (클라이언트에서 현재까지 로드된 row 수)',
required: false,
schema: {
type: 'integer',
format: 'int32',
default: 0,
minimum: 0
},
example: 0
},
limitParam: {
in: 'query',
name: 'limit',
description: '최대 불러올 데이터 row 수',
required: false,
schema: {
type: 'integer',
format: 'int32'
}
}
},
responses: {
UserError: {
description: '잘못된 요청입니다.',
content: {
'application/json': {
schema: {
$ref: '#/components/schemas/TupleError'
}
}
}
},
Unauthorized: {
description: '인증되지 않았습니다.'
},
Forbidden: {
description: '권한이 없습니다.'
},
NotFound: {
description: '해당 조건에 해당하는 데이터를 찾을 수 없습니다.'
},
ServerError: {
description: '서버 오류입니다.',
}
}
}
};