Swgger๋ฅผ ์ฌ์ฉํ์ฌ
REST API๋ฅผ ์์ฑํด๋ณด๊ณ ์ ํ๋ค.
๐
1. Swagger๋?
2. Swagger ๋ฑ๋กํ๊ธฐ
3. Swagger ์์ฑ ๋ฐฉ๋ฒ
4. YAML์ผ๋ก ์์ฑํด ๋ณด๊ธฐ
5. ๋ง๋ฌด๋ฆฌ
1. Swagger๋?
Swagger๋ REST API๋ฅผ ์ค๋ช ํ๊ณ , ๋ฌธ์ํํ๊ณ , ํ ์คํธํ ์ ์๊ฒ ํด์ฃผ๋ ๋๊ตฌ์ด๋ค. Swagger๋ฅผ ์ฌ์ฉํ๋ฉด, ๋ง๋ API์ ๋ช ์ธ์๋ฅผ ์๋์ผ๋ก ๋ง๋ค์ด์ฃผ๊ฑฐ๋ ์ฝ๊ฒ ์์ฑํ ์ ์๋๋ก ๋์์ค๋ค. ์ด๋ Swagger๋ OpenAPI Specification์ด๋ผ๋ ํ์ค ๋ช ์ธ์ ํฌ๋งท์ ์ฌ์ฉํ๋ค. (๊ทธ๋์์ผ๊น, OpenAPI๋ผ๊ณ ๋ถ๋ฅด๋ ๋ฏํ๋ค.)
2. Swagger ๋ฑ๋กํ๊ธฐ.
โก build.gradle์ ๋ค์ด๊ฐ๊ธฐ.

โก dependencies์ ์ฝ๋ ๋ฑ๋กํ๊ธฐ.
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.5.0'

โก ์ฝ๋ผ๋ฆฌ ๋๋ฌ์ ๋ค์ gradle ํ๊ธฐ.
- ์ฒซ ๋ฒ์งธ ๋ฐฉ๋ฒ

- ๋ ๋ฒ์งธ ๋ฐฉ๋ฒ

โก ์ฃผ์์ฐฝ ์๋ ์ค ํ๋๋ฅผ ์ ๋ ฅํ๋ค.
- ์ฃผ๋ก ๋ง์ด ์ฌ์ฉํ๋ ์ฃผ์๋ http://localhost:8080/swagger-ui/index.html ์ด๋ค.
http://localhost:8080/swagger-ui.html
http://localhost:8080/swagger-ui/index.html
http://localhost:8080/swagger-ui/
โก ๊ฒฐ๊ณผ

3. Swagger ์์ฑ ๋ฐฉ๋ฒ
โก ์ปจํธ๋กค๋ฌ๋ DTO ์ฝ๋์ ์ฃผ์(@Operation)์ผ๋ก ์ค๋ช ์ถ๊ฐํ๊ธฐ.
- ์ฝ๋์ ๋ช ์ธ๊ฐ ์๋์ผ๋ก ํญ์ ์ผ์นํ๋ค.
- ์ฝ๋๋ง ๋ฐ๊ฟ๋ ๋ช ์ธ๊ฐ ์ค์๊ฐ์ผ๋ก ๊ฐฑ์ ๋๋ค.
- ๊ด๋ฆฌ๊ฐ ํธํ๊ณ , ํ ๋ด ์ปค๋ฎค๋์ผ์ด์ ๋น์ฉ์ด ๋ฎ๋ค.
@Operation(summary = "ํ์๊ฐ์
", description = "์ ๊ท ์ฌ์ฉ์๋ฅผ ๋ฑ๋กํฉ๋๋ค.")
@PostMapping("/api/join")
public UserResponse join(@RequestBody...) {
}
โก yaml/json ํ์ผ๋ก ์ง์ ๋ช ์ธ๋ฅผ ์์ฑํ๋ค.
- ๋ฐฑ์๋์ ํ๋ก ํธ๊ฐ ์์ ํ ๋ถ๋ฆฌ๋ ๊ฒฝ์ฐ ์ฌ์ฉํ๋ค.
- ๋ฌธ์๋ง ๊ณต์ ํ๋ฉด ์ฌ๋ฌ ์ธ์ด, ํ์์ ๋์ ํ์ฉ ๊ฐ๋ฅํ๋ค.
- ์ฝ๋๊ฐ ๋ณ๊ฒฝ๋๋ฉด ๋ฐ๋ก ์ ๋ฐ์ดํธ๋ฅผ ํด์ค์ผ ํ๋ค.
openapi: 3.0.0
info:
title: join-web
version: 1.0.0
paths:
/api/join:
post:
summary: ํ์๊ฐ์
...
โก ๋์ ํผํฉํ๋ ๋ฐฉ์
- ์ด๊ธฐ API ์ค๊ณ ๋จ๊ณ์๋ yaml ๋ฑ์ผ๋ก ์ด์์ ๋ง๋ ๋ค.
- ๊ฐ๋ฐ ๋จ๊ณ์์ ์ฝ๋๋ก ์ฃผ์์ ๋ ์์ธํ ๋ค๋ ์์ผ๋ก ํผํฉํด์ ์ฌ์ฉํ๋ค.
4. yaml์ผ๋ก ์์ฑํด ๋ณด๊ธฐ.
์ฃผ์์ผ๋ก ๋ค๋ ๊ฒ๊ณผ yaml์ผ๋ก ์์ฑํ๋ ๊ฒ ๋ชจ๋ ํด๋ณผ ๊ฒ์ด๋ค. ์ค๋ฌด์์ ์ด๋ค ๊ฑธ ๋ ์ ํธํ ์ง ๋ชจ๋ฅด๊ธฐ๋ ํ๊ณ , ํ ๋ฒ๋ ๊ฒช์ด๋ณธ ์ ์์ผ๋ ๋ ๋ค ํ๋ฉด์ ๋ฌด์์ด ๋ ํธ๋ฆฌํ๊ณ ๊ฐ ๋ฐฉ๋ฒ์ ์ด๋ค ์ด์ ์ด ์๋์ง ์ง์ ๋๊ปด๋ณผ ๊ฒ์ด๋ค. ๋ฌผ๋ก ์ฒ์ ํด๋ณด๋ ๊ฑฐ๋ผ ํ์ ๋ณ๊ฒฝ๋ ๋ด์ฉ๊ณผ ์๋ชป๋ ๋ด์ฉ์ด ์์ ๊ฒ์ด๋ค.
โก ํ์๊ฐ์ ๊ด๋ จ ์ฝ๋
- ์ผ๋จ ํ์๊ฐ์ ๋ง ํ๋ ๋ถ๋ถ๋ง yaml์ผ๋ก ์์ฑํ๋ค.
- ํด๋น ํ์ผ์ ๋ง๋ค๊ธฐ ์ docs ๋๋ ํฐ๋ฆฌ๋ฅผ ๋ง๋ค์๋ค.
- docs ๋๋ ํฐ๋ฆฌ๋ src์ ๊ฐ์ ์์น์ ์๊ณ , docs์์ File์ ์ด์ด openapi.yaml์ด๋ผ๊ณ ์์ฑํ๋ค.

openapi: 3.0.1
info:
title: ํ์๊ฐ์
API
version: 1.0.0
paths:
/api/register:
post:
summary: ํ์๊ฐ์
description: ์ด๋ฆ, ์์ด๋, ๋น๋ฐ๋ฒํธ, ์ ํ๋ฒํธ, ์๋
์์ผ, ์ด๋ฉ์ผ์ ๋ฐ๋๋ค.
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- name
- userid
- password
- passwordConfirm
- phone
- birth
- email
properties:
name:
type: string
description: ์ด๋ฆ
userid:
type: string
description: ์์ด๋
password:
type: string
format: password
description: ๋น๋ฐ๋ฒํธ
passwordConfirm:
type: string
format: password
description: ๋น๋ฐ๋ฒํธํ์ธ
phone:
type: string
description: ์ ํ๋ฒํธ
birth:
type: string
format: date
description: ์๋
์์ผ(๋ณ๋๊ฐ๋ฅ์ฑ์์)
email:
type: string
format: email
description: ์ด๋ฉ์ผ
responses:
'200':
description: ๊ฐ์
์ฑ๊ณต
content:
application/json:
schema:
type: object
properties:
result:
type: string
example: success
id:
type: integer
example: 1
message:
type: string
example: ํ์๊ฐ์
์ด ์๋ฃ๋์์ต๋๋ค.
'400':
description: ๊ฐ์
์คํจ
content:
application/json:
schema:
type: object
properties:
result:
type: string
example: fail
message:
type: string
example: ์์ด๋๊ฐ ์ค๋ณต์
๋๋ค or ๋น๋ฐ๋ฒํธ๊ฐ ์ผ์นํ์ง ์์ต๋๋ค.
โก ํค์๋ ์ดํด๋ณด๊ธฐ. (์ฐธ๊ณ ๋ก ์ค๋ช ์ด ์๋ฒฝํ์ง ์์ต๋๋ค)
- ๋ช ์ธ์ ์์ฑ ์ ๊ฐ์ฅ ๊ธฐ๋ณธ์ ์ธ YAML ํค์๋์ด๋ค.
- ์ฌ๊ธฐ์ ์ ํ ํค์๋ ์ค ํ์ํ ํค์๋๋ง ์์ฑํ๋ค.
| YAML ํค์๋ | ์๋ฏธ |
| paths | API ์๋ํฌ์ธํธ ๊ฒฝ๋ก๋ฅผ ์ ๋๋ค. |
| summary | ํด๋น ๊ฒฝ๋ก์์ ๋ฌด์จ ์ผ์ ํ๋์ง ์์ฝํ์ฌ ์ ์ด๋๋ค. |
| description | summary๋ ์์ฝํด์ ์ ์์ผ๋ฉด description์ ์ด๋ค ๋ด์ฉ์ธ์ง ์์ธํ๊ฒ ์ ๋๋ค. |
| requestBody | request๋ฅผ ๋ณด๋ผ ๋ Body์ ์ด๋ค ๋ฐ์ดํฐ๊ฐ ๋ค์ด๊ฐ๋์ง ์ ์ํ๋ค. POST, PUT ๋ฑ Body๊ฐ ํ์ํ ๊ฒฝ์ฐ required: true๋ผ๊ณ ์์ฑํ๋ค. |
| content | Body ๋ฐ์ดํฐ๊ฐ ์ด๋ค ํ์ ์ผ๋ก ์ค๊ฐ๋์ง ์ ํ๋ค. json์ด๋ฉด application/json์ผ๋ก ์ ๊ณ form์ด๋ฉด application/x-www-form-urlencoded ๋๋ multipart/form-data๋ก ์ ๋๋ค. |
| schema | Body์ ์ค์ ๋ฐ์ดํฐ ๊ตฌ์กฐ๋ฅผ ์ ๋๋ค. ์๋ฅผ ๋ค๋ฉด ํ์๊ฐ์ ์ ๊ฒฝ์ฐ ์ด๋ฆ, email, ์ ํ๋ฒํธ ๋ฑ ์ด๋ฐ ๊ฒ๋ค์ด Body์ ๋ค์ด๊ฐ๊ฒ ๋๋ค. |
| properties | ๊ฐ์ฒด๊ฐ ์ด๋ค ๊ฐ์ ๊ฐ์ง๊ณ ์๋์ง ์ ๋๋ค. |
| format | ๊ธฐ๋ณธ ํ์ ๋ณด๋ค ๋ ๊ตฌ์ฒด์ ์ธ ๋ฐ์ดํฐ์ ํ์์ ๋ช ์ํ๋ค. |
| $ref | ์ด๋ฏธ ์ ์ํด๋ ๋ฐ์ดํฐ ๊ตฌ์กฐ๋ฅผ ์ฐธ์กฐํด์ ์ฌ์ฌ์ฉํ๋ค. |
| example | ๊ฐ์ ์์๋ฅผ ์ ๋๋ค. |
| reponses | ์๋ต์ ๋ณด๋ธ๋ค. |
- format์ type๋ง์ผ๋ก ๋ถ์กฑํ ๋ฐ์ดํฐ์ ๊ตฌ์ฒด์ ์ธ ํ์์ ์ถ๊ฐ๋ก ๋ช ์ํ๋ค.
| format | ๊ตฌ์ฒด์ ์ธ ํ์ |
| ์ด๋ฉ์ผ ํ์ | |
| date | ๋ ์ง(YYYY-MM-DD) |
| date-time | ๋ ์ง/์๊ฐ(ISO 8601) |
| password | ๋น๋ฐ๋ฒํธ |
| int64 | 64๋นํธ ์ ์ |
โก ์ฝ๋๋ฅผ ๋ถ๋ถ์ ์ผ๋ก ์ดํด๋ณด๊ธฐ
- ์์ฒญ
paths:
/api/register:
post:
summary: ํ์๊ฐ์
description: ์ด๋ฆ, ์์ด๋, ๋น๋ฐ๋ฒํธ, ์ ํ๋ฒํธ, ์๋
์์ผ, ์ด๋ฉ์ผ์ ๋ฐ๋๋ค.
requestBody:
required: true
paths์ /api/register๋ผ๋ ๊ฒฝ๋ก๋ฅผ ๋ฃ์๋ค. post๋ HTTP ๋ฉ์๋ ๋ฐฉ์์ผ๋ก GET, POST, PUT ๋ฑ ๋ค์ํ ๋ฐฉ์ ์ค์ POST ๋ฐฉ์์ ์ ํํ๋ค. summary๋ ๊ฐ๋ตํ๊ฒ ์ด๋ค ๊ธฐ๋ฅ์ ํ๋์ง ์ ์๊ณ , description์ ๊ตฌ์ฒด์ ์ธ ์ค๋ช ์ ์ ์๋ค. ๋ฌผ๋ก ์ด ๋ถ๋ถ์ ํจ์คํด๋ ์๊ด์๋ค. GET ๋ฐฉ์์ ์ฟผ๋ฆฌ์คํธ๋ง(URL)์ ๋ด์ฉ์ ๋ฃ์ด ๋ณด๋ธ๋ค. ๊ทธ๋์ ๋ณด์์ ์ข์ง ์๋ค. ํ์๊ฐ์ ์ ๋ณด์์ด ํ์ํ๊ธฐ ๋๋ฌธ์ Body์ ๋ด์ฉ์ ๋ฃ์ด ์ ๋ฌํ๋ POST ๋ฐฉ์์ ์ ํํ๋ค.(๋ฌผ๋ก POST ๋ฐฉ์์ผ๋ก ์ ๋ฌํ๋ค๊ณ ๋ณด์์ด ์๋ฒฝํ ๊ฑด ์ ๋ ์๋๋ค. ์ํธํ๊ฐ ํ์ํ๋ค) ๊ทธ๋์ requestBody์์ required ๋ถ๋ถ์ true๋ผ๊ณ ์ ์๋ค. ์ ๋ณด๋ฅผ ์ฐพ์๋ณด๋ฉด required: true๋ฅผ ์ ์ง ์์๋ ๋ฑํ ๋ฌธ์ ๋ ์๋ ๊ฒ ๊ฐ๋ค. (๋ฐ๋์ ์ ๋ ฅํด์ผ ํ๋ค๊ณ ์๋ฆฌ๋ ์ ๋์ ์ญํ ๋ง ํ๋ ๊ฒ ๊ฐ๋ค)
content:
application/json:
schema:
type: object
required:
- name
- userid
- password
content์๋ ์ด๋ค ํ์ ์ผ๋ก ์ค๊ฐ์ง ์ ํ๋ ๊ฒ์ผ๋ก ์ฌ๊ธฐ์๋ json์ด๋ผ๊ณ ์ ์๋ค. form ๋ฐฉ์์ ๋ณดํต ํ ์คํธ์ ํ์ผ ๋ฐ์ดํฐ๊ฐ ํจ๊ป ์ ์กํ ๋ ์ฌ์ฉํ๋๋ฐ, ํ์๊ฐ์ ์ ํ ์คํธ ๋ฐ์ดํฐ๋ง ์ค๊ฐ๋ฉด ๋๋๊น json์ผ๋ก ์ง์ ํ๋ค. schema๋ Body์ ์ค์ ๋ฐ์ดํฐ ๊ตฌ์กฐ๋ฅผ ์ ๋๋ค. ํ์๊ฐ์ ์ ํ ๊ฒฝ์ฐ Body์ ์ฌ ๋ฐ์ดํฐ๋ค์ ์ด๋ฆ, ์์ด๋ ๋น๋ฐ๋ฒํธ ๋ฑ์ด ์๋ค. required์ ๊ผญ ํ์ํ ๊ฒ๋ค์ด ๋ฌด์์ธ์ง ์ ์๋ค. ๊ทธ๋ฌ๋ฉด type: object๋ ๋ญ๊น? ํ์๊ฐ์ ์ ์ฌ๋ฌ ๊ฐ์ ํ ๋ฒ์ ์ฃผ๊ณ ๋ฐ์ ๋ { "name": "sori", "userid":"sori123" }์ด๋ฐ ์์ ํํ๋ฅผ ๊ฐ์ง๋ค. ์ค๊ดํธ๋ก ๋ฌถ์ฌ์๊ณ ์ฌ๋ฌ ๊ฐ์ ํค:๊ฐ์ด ์์ผ๋ก ๋ค์ด๊ฐ์ object ํํ๊ฐ ๋๋ค.
properties:
name:
type: string
description: ์ด๋ฆ
userid:
type: string
description: ์์ด๋
password:
type: string
format: password
description: ๋น๋ฐ๋ฒํธ
properties๋ ๊ฐ์ฒด๊ฐ ์ด๋ค ๊ฐ์ ๊ฐ์ง๊ณ ์๋์ง ์ ๋๋ค. name๊ณผ userid, password๋ string ํ์ ์ด๋ค. ๊ทธ์ค password๋ format์ ํตํด ๊ตฌ์ฒด์ ์ธ ํ์ ์ ๋ช ์ํ ์ ์๋ค. OpenAPI(Swagger)์์ format: password๋ก ํ๋ฉด ์ ๋ ฅ์ฐฝ์ด ๋น๋ฐ๋ฒํธ์ฒ๋ผ ๋ณด์ธ๋ค. ์ฌ์ฉ์๊ฐ ํ ์คํธํ ๋, ๋น๋ฐ๋ฒํธ๊ฐ ๋ ธ์ถ๋์ง ์๋๋ก ํด์ค๋ค.
- ์๋ต
responses:
'200':
description: ๊ฐ์
์ฑ๊ณต
content:
application/json:
schema:
type: object
properties:
result:
type: string
example: success
id:
type: integer
example: 1
message:
type: string
example: ํ์๊ฐ์
์ด ์๋ฃ๋์์ต๋๋ค.
responses๋ ์๋ต์ผ๋ก '200'์ด๋ ์ํ ์ฝ๋๋ฅผ ์ ์๋ค. content์ schema๋ ๋์ผํ๊ฒ ์ ์ด์ฃผ์๋ค. ์ค์ body ๋ด์ฉ์๋ result์ id ๊ทธ๋ฆฌ๊ณ message๊ฐ ๋ค์ด๊ฐ๋ค. result๋ ์๋ต์ํ๊ฒฐ๊ณผ์ด๋ฉฐ, id๋ ๋ก๊ทธ์ธํ ๋ ์ฐ๋ ์์ด๋๊ฐ ์๋ ๋ฐ์ดํฐ๋ฒ ์ด์ค์์ ์๋์ผ๋ก ๋ถ์ฌํ๋ ๊ณ ์ ํ ์ซ์์ด๋ค. ํ์๊ฐ์ ์ด ์ฑ๊ณต์ด ๋๋์ง ์ฌ์ฉ์์๊ฒ ์๋ฆฌ๊ธฐ ์ํ message๊น์ง ๋ฃ์๋ค. ํ์๊ฐ์ ์ด ์๋ฃ๋์์ต๋๋ค๋ผ๋ ๋ฌธ๊ตฌ๋ ์ฌ์ฉ์๊ฐ ์ง์ ๋ณด๊ฒ ๋ ๊ฒ์ด๋ค.
'400':
description: ๊ฐ์
์คํจ
content:
application/json:
schema:
type: object
properties:
result:
type: string
example: fail
message:
type: string
example: ์์ด๋๊ฐ ์ค๋ณต์
๋๋ค or ๋น๋ฐ๋ฒํธ๊ฐ ์ผ์นํ์ง ์์ต๋๋ค.
๊ฐ์ ์ด ์คํจํ์ ๋ '400'์ด๋ ์๋ต์ฝ๋๋ฅผ ๋ณด๋ด๋ฉฐ, result์ fail์ ๋ด์ ์๋ฒ์์ ํ๋ก ํธ๋ก ๋ณด๋ผ ๊ฒ์ด๋ค. ๊ทธ๋ฆฌ๊ณ ์ฌ์ฉ์์๊ฒ ํ์๊ฐ์ ์ด ์ ๋๋ก ๋์ง ์์ ์ด์ ๋ฅผ message์ ๋ด์ ๋ณด๋ธ๋ค.
โก Swagger Editor ์ฌ์ฉํ๊ธฐ.
- ์ฝ๋๋ฅผ ๋ณต๋ถํ์ฌ ์ฌ์ฉํ ์ ์๋ค.
Swagger Editor
editor.swagger.io
5. ๋ง๋ฌด๋ฆฌ
YAML์ผ๋ก OpenAPI(Swagger)๋ฅผ ์์ฑํด ๋ดค๋ค. ์ฒ์ ์์ฑํด ๋ณด๋ ๊ฑฐ๋ผ ๋ง๋์ง๋ ์ ๋ชจ๋ฅด๊ฒ ๋ค. ์๋ง ํ๋ฆฐ ๋ถ๋ถ์ด๋ ๋นผ๋จน์ ๋ถ๋ถ์ด ๋ง์์ ์ถํ์ ์์ ์ ํ์ง ์์๊น ์๊ฐํ๋ค. ์ผ๋จ์ ํ์๊ฐ์ ํ๋ ๋ถ๋ถ๋ง ์์ฑํ๋๋ฐ, ๊ฐํธ ํ์๊ฐ์ , ๋ก๊ทธ์ธ ๋ฑ ๋ค๋ฅธ ํํธ๋ ๋์ค์ ํด๋ณด๋๋ก ํ ๊ฒ์ด๋ค. (๋๋ฌด ํ๋ค์๋ค...)
์๋์ ์ถ์ฒ๋ฅผ ๋จ๊ฒจ๋๊ฒ ์ต๋๋ค.
๋ธ๋ก๊ทธ์ ์ ๊ฐ ์ต๋ํ ์ดํดํ ๋ด์ฉ๊น์ง๋ง ์ ๋ ๊ฑฐ๋ผ
์ถ์ฒ์ ๋ค์ด๊ฐ์๋ฉด ๋ ๋ง์ ๋ด์ฉ์ด ์์ด ๊ณต๋ถํ์๋๋ฐ ๋์ ๋์ค ๊ฒ๋๋ค.
๐ชฝ
ํ๋ฆฐ ๋ด์ฉ์ด ์๋ค๋ฉด ๋๊ธ๋ก ์๋ ค์ฃผ์ธ์
https://swagger.io/specification/v3/
OpenAPI Specification - Version 2.0 | Swagger
OpenAPI Specification (fka Swagger RESTful API Documentation Specification) Version 2.0 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted
swagger.io
Swagger API ๋ช ์ธ ๋ง๋๋ ๋ฒ 1 - Swagger Hub์์ yaml ํ์ผ ์์ฑ
https://app.swaggerhub.com/search ์์ Create New > Create New API๋ฅผ ๋๋ฌ์ ํ๋์ ํ๋ก์ ํธ๋ฅผ ์์ฑํด ๋ณธ๋ค. ์ฒ์์๋ ์๋ฌด๊ฒ๋ ๋ณ๊ฒฝํ์ง ์๊ณ , name๋ง ์ถ๊ฐํ์ฌ์ ์์ฑํด๋ณธ๋ค. (Template: Petstore๋ผ๋
velog.io
TIL > API ๋ฌธ์ ์์ฑํ๊ธฐ (swagger)
์ ๊ฐ ๊ณต๋ถํ ๊ฒ์ ๋จ์ํ ๊ธฐ๋ก(๋ณด์ฌ์ฃผ๊ธฐ)ํ๊ธฐ ์ํด ์์ฑํ์์ต๋๋ค!!!!!!!!! ์๋์ ์๊ตฌ์ฌํญ์ ๋ํด์ Swagger ์ yaml ํ์์ผ๋ก OpenAPI ๋ช ์ธ์๋ฅผ ์์ฑํ์์ต๋๋ค. - ์กฐํ ๋ธ๋ก๊ทธ ๊ธ ์ ์ฒด ์กฐํ ํน์ ๋ธ
sororiri.tistory.com
FormData์ JSON(body)์ ์ฐจ์ด์ : ์ธ์ ์ด๋ค ๋ฐฉ์์ ์ฌ์ฉํด์ผ ํ ๊น?
body๋ฅผ FormData๋ก ๋ฐ๊ฟ ๋์ ์ฐจ์ด์ ๊ทธ์ ๋ฐ๋ฅธ ์ฅ๋จ์ ์ ์ฃผ๋ก ๋ฐ์ดํฐ ์ ์ก ๋ฐฉ์๊ณผ ํ์ผ ์ ์ก ํ์์ฑ์ ๋ฐ๋ผ ๋ฌ๋ผ์ง๋ค. <span style="color:์ ์ก ํ์: ๋ฐ์ดํฐ๋ JSON ํ์์ผ๋ก ์ ์ก์ด ๋ฐฉ์์์๋ ์ผ๋ฐ์ ์ผ
velog.io
Swagger API Yaml ๊ธฐ๋ณธ ํ์ผ ์์ฑ
Yaml ํ์ผ ์์ฑ
velog.io
[Swagger] ์คํ๋ง 3.x Swagger ์ ์ฉ(With. SpringDocs)
์คํ๋ง ๋ฒ์ ์ด 3.x๋๋ก ๋์ด์ค๋ฉด์ ๊ธฐ์กด์ ์ฌ์ฉํ๋ Springfox๊ฐ ํธํ์ด ๋์ง์๋ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ํด๊ฒฐ์ ์ํ SpringDocs ์ฌ์ฉ๋ฒ์ ๋ํ ๊ฐ์ด๋ ํฌ์คํ ์์ ์คํ๋ง 2.x๋์์ ์ฌ์ฉํ๋ Springfox ๋ผ์ด
infinitecode.tistory.com
Swagger๋ฅผ ์ด์ฉํ API ๋ฌธ์ ์๋ํ
API ๋ฌธ์ ์๋ํ ํ๋ ์์ํฌ์ธ Swagger๋ฅผ ํ์ตํ๊ณ ํ์ฉํด๋ณด์. 1. Swagger๋? ์ฒ์ ๊ฐ๋ฐํ๊ฑฐ๋ ํน์ ์ ์ง๋ณด์๋ฅผ ์งํํ ๋, API ์๋ฒ๊ฐ ์ด๋ค Spec์ ๊ฐ์ง ๋ฐ์ดํฐ๋ฅผ ์ฃผ๊ณ ๋ฐ๋์ง์ ๋ํ ๋ฌธ์์์ ์ด ๊ผญ ํ
jjingho.tistory.com