UNPKG

mares-swagger-spec-maker

Version:

mares framework ���조에 맞춰서openapi spec을 combine 해주는 모듈입니다.

385 lines (383 loc) 17.2 kB
const spec = { '/{version}/templates': { get: { tags: ['template'], summary: '템플릿 내역 확인', operationId: 'findTemplate', description: 'template은 문자 발송을 위한 문자의 내용 및 형태를 의미한다. 해당 API는 template list를 얻어온다.', parameters: [{ $ref: '#/components/parameters/offsetParam' }, { $ref: '#/components/parameters/limitParam' }, { in: 'query', name: 'templateKey', description: '템플릿의 키 겁색 (prefix 검색 가능)', required: false, schema: { type: 'string', example: 'templateKey123' } }, { in: 'query', name: 'templateTitle', description: '템플릿의 제목 겁색 (prefix 검색 가능)', required: false, schema: { type: 'string', example: '고객 문자발송' } }, { in: 'query', name: 'sort', description: '해당 템플릿 row의 정렬 방식 선택', required: false, schema: { type: 'string' } }], responses: { '200': { description: '불러오기 성공', content: { 'application/json': { schema: { type: 'object', properties: { rows: { type: 'array', items: { $ref: '#/components/schemas/TemplateDomain' }, description: '도메인 배열' }, count: { type: 'integer', description: '해당 조건에 해당하는 전체 도메인 카운트' } } } } } }, '400': { $ref: '#/components/responses/UserError' }, '401': { $ref: '#/components/responses/Unauthorized' }, '403': { $ref: '#/components/responses/Forbidden' }, '404': { $ref: '#/components/responses/NotFound' } } }, post: { tags: ['template'], summary: '템플릿 생성', operationId: 'createTemplate', description: '템플릿을 생성한다.', requestBody: { description: '템플릿을 생성하기 위한 객체정보', required: true, content: { 'application/json': { schema: { type: 'object', required: [ 'key', 'title', 'body' ], properties: { authorId: { type: 'integer', description: '템플릿 작성자 id', example: 2 }, key: { type: 'string', description: '템플릿 키값', example: 'templateKey123' }, title: { type: 'string', description: '템플릿 제목', example: '인증번호' }, body: { type: 'string', description: '템플릿 내용', example: '인증번호 문자 입니다. 인증번호는 :keyword: 입니다.' }, memo: { type: 'string', description: '해당 템플릿의 메모', example: '고객 이벤트 문자입니다.' }, replacements: { type: 'array', description: '변환자 정보의 배열', items: { type: 'object', properties: { title: { type: 'string', example: '인증번호', description: '변환자의 제목', nullable: false }, maxByte: { type: 'integer', example: '최대길이', description: '변환자의 최대길이 (바이트)', nullable: true }, default: { type: 'string', example: '기본 변환값', description: '변환자의 기본값, 변환자를 넣지 않는 경우 기본으로 대치됨', nullable: true }, isEssential: { type: 'boolean', example: true, description: '변환자가 필수값인지 여부, 해당값이 필수인데 변환자를 넣지 않으면 문자 발송이 되지 않음', default: false, nullable: false }, keyword: { type: 'string', example: 'auth_number', description: '변환자의 매직키워드, 해당 키워드는 자동으로 양끝에 \':\' 문자가 붙는다. (auth_number -> :auth_number:)', nullable: false } } } } } } } } }, responses: { '200': { description: '템플릿 생성 성공', content: { 'application/json': { schema: { type: 'object', properties: { row: { $ref: '#/components/schemas/TemplateDomain' } } } } } }, '400': { $ref: '#/components/responses/UserError' }, '401': { $ref: '#/components/responses/Unauthorized' }, '403': { $ref: '#/components/responses/Forbidden' } } } }, '/{version}/templates/{id}': { get: { tags: ['template'], summary: '단일 템플릿 정보 획득', operationId: 'findTemplateById', description: '해당 아이디의 단일 템플릿을 얻어온다.', parameters: [{ in: 'path', name: 'id', description: '템플릿 id', required: true, schema: { type: 'integer', example: 1 } }], responses: { '200': { description: '불러오기 성공', content: { 'application/json': { schema: { type: 'object', properties: { row: { $ref: '#/components/schemas/MessageDomain' } } } } } }, '400': { $ref: '#/components/responses/UserError' }, '401': { $ref: '#/components/responses/Unauthorized' }, '403': { $ref: '#/components/responses/Forbidden' }, '404': { $ref: '#/components/responses/NotFound' } } }, delete: { tags: ['template'], summary: '단일 템플릿 제거', operationId: 'removeTemplateById', description: '해당 아이디의 단일 템플릿을 제거한다.', parameters: [{ in: 'path', name: 'id', description: '템플릿 id', required: true, schema: { type: 'integer', example: 1 } }], responses: { '204': { description: '템플릿 제거 성공' }, '400': { $ref: '#/components/responses/UserError' }, '401': { $ref: '#/components/responses/Unauthorized' }, '403': { $ref: '#/components/responses/Forbidden' }, '404': { $ref: '#/components/responses/NotFound' } } }, put: { tags: ['template'], summary: '단일 템플릿 수정', operationId: 'updateTemplateById', description: '해당 아이디의 단일 템플릿을 수정한다.', requestBody: { description: '템플릿을 수정하기 위한 객체정보. 키값은 수정이 되지 않는다.', required: true, content: { 'application/json': { schema: { type: 'object', required: [ 'title', 'body' ], properties: { authorId: { type: 'integer', description: '템플릿 작성자 id', example: 2 }, title: { type: 'string', description: '템플릿 제목', example: '인증번호' }, body: { type: 'string', description: '템플릿 내용', example: '인증번호 문자 입니다. 인증번호는 :keyword: 입니다.' }, memo: { type: 'string', description: '해당 템플릿의 메모', example: '고객 이벤트 문자입니다.' }, replacements: { type: 'array', description: '변환자 정보의 배열', items: { type: 'object', properties: { title: { type: 'string', example: '인증번호', description: '변환자의 제목', nullable: false }, maxByte: { type: 'integer', example: '최대길이', description: '변환자의 최대길이 (바이트)', nullable: true }, default: { type: 'string', example: '기본 변환값', description: '변환자의 기본값, 변환자를 넣지 않는 경우 기본으로 대치됨', nullable: true }, isEssential: { type: 'boolean', example: true, description: '변환자가 필수값인지 여부, 해당값이 필수인데 변환자를 넣지 않으면 문자 발송이 되지 않음', default: false, nullable: false }, keyword: { type: 'string', example: 'auth_number', description: '변환자의 매직키워드, 해당 키워드는 자동으로 양끝에 \':\' 문자가 붙는다. (auth_number -> :auth_number:)', nullable: false } } } } } } } } }, responses: { '200': { description: '템플릿 생성 성공', content: { 'application/json': { schema: { type: 'object', properties: { row: { $ref: '#/components/schemas/TemplateDomain' } } } } } }, '400': { $ref: '#/components/responses/UserError' }, '401': { $ref: '#/components/responses/Unauthorized' }, '403': { $ref: '#/components/responses/Forbidden' } } } } }; module.exports = spec;