Repository navigation
[스웨거] 일부 API 문서화 및 설정 변경 #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
fed45d5
#18 docs: 응원 문구, 포인트 관련 컨트롤러
jongeuni ab85450
#18 docs: 목표 생성 컨트롤러
jongeuni d7065ae
#18 docs: 목표 생성, 수정, 조회 컨트롤러
jongeuni b710f47
#18 fix: Path 수정
jongeuni d1d1301
#18 docs: swagger에 token 설정
jongeuni 5486ce1
refactor: resolve arg에 반환값 설정
jongeuni 4331bb7
#18 docs: 사용자 정보 애노테이션 스웨거에 노출 안 되도록 추가
jongeuni 06431eb
#18 docs: 사용자 가입일 조회 유저 컨트롤러에 추가
jongeuni 4f035d6
#18 docs: 사용자 가입일 조회 path 추가
jongeuni c24d7b3
#21 fix: resolve 함수에서 Object -> UUID 넘기도록 수정
jongeuni deab0eb
#21 fix: IdRs -> CreateIdRs로 제한
jongeuni db934ca
#21 fix: 코드 리뷰 반영 (필드명, 리턴 타입 수정)
jongeuni 9db7e45
#21 fix: Phrase -> CheerPhrase로 명확화
jongeuni 0bfff50
#21 refactor: 가입일 조회 URI 변경
jongeuni 5645ca8
#21 refactor: List null 처리 @ JsonSetter로 변경
jongeuni 8b6daf2
#21 refactor: Rs 네이밍에 Read 제거
jongeuni 74f7a71
fix: gradle jar 삭제
jongeuni 9c1f37b
Merge branch 'refs/heads/main' into feature/goal-docs
jongeuni d9241fa
bootjar 아닌 build 사용하도록 변경
jongeuni e1c7f76
cache disabled 설정
jongeuni 345485c
cache disabled 설정 삭제
jongeuni f276849
fix: Rs Controller에 반영
jongeuni 9300e5e
Merge remote-tracking branch 'origin/feature/goal-docs' into feature/…
jongeuni 763eea7
#18 feat: 더미 데이터 추가
jongeuni dde37cd
refactor: isMonthSetting -> isPeriodByMonth
jongeuni 19f7203
#3 fix: Docker file 수정
jongeuni 6f1362e
delete: 사용자 가입일 조회 API 삭제
jongeuni dd3bb2e
refactor: read -> get 메서드 네이밍 변경 및 컨트롤러 메서드 이름 명확화
jongeuni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file was deleted.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
motimo-api/src/main/java/kr/co/api/cheer/CheerController.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| package kr.co.api.cheer; | ||
|
|
||
| import kr.co.api.cheer.docs.CheerControllerSwagger; | ||
| import kr.co.api.cheer.rqrs.CheerPhraseRs; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/v1/cheers") | ||
| public class CheerController implements CheerControllerSwagger { | ||
|
|
||
| @GetMapping | ||
| public CheerPhraseRs getCheerPhrase() { | ||
| return new CheerPhraseRs("오늘도 파이팅이에요!"); | ||
| } | ||
| } |
11 changes: 11 additions & 0 deletions
11
motimo-api/src/main/java/kr/co/api/cheer/docs/CheerControllerSwagger.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package kr.co.api.cheer.docs; | ||
|
|
||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||
| import kr.co.api.cheer.rqrs.CheerPhraseRs; | ||
|
|
||
| @Tag(name = "응원 API", description = "응원 관련 API 목록입니다") | ||
| public interface CheerControllerSwagger { | ||
| @Operation(summary = "응원 문구 조회 API", description = "응원 문구를 랜덤 조회합니다.") | ||
| CheerPhraseRs getCheerPhrase(); | ||
| } |
9 changes: 9 additions & 0 deletions
9
motimo-api/src/main/java/kr/co/api/cheer/rqrs/CheerPhraseRs.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package kr.co.api.cheer.rqrs; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
|
|
||
| public record CheerPhraseRs( | ||
| @Schema(description = "응원 문구", example = "목표는 멀어도 나는 계속 가는중") | ||
| String cheerPhrase | ||
| ) { | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
motimo-api/src/main/java/kr/co/api/goal/GoalController.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| package kr.co.api.goal; | ||
|
|
||
| import kr.co.api.goal.docs.GoalControllerSwagger; | ||
| import kr.co.api.goal.rqrs.*; | ||
| import kr.co.api.security.annotation.AuthUser; | ||
| import org.springframework.http.HttpStatus; | ||
| import org.springframework.web.bind.annotation.*; | ||
|
|
||
| import java.time.LocalDate; | ||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
| import java.util.UUID; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/v1/goals") | ||
| public class GoalController implements GoalControllerSwagger { | ||
|
|
||
| @ResponseStatus(HttpStatus.CREATED) | ||
| @PostMapping | ||
| public GoalIdRs createGoal(@RequestBody GoalCreateRq rq) { | ||
| return new GoalIdRs(UUID.randomUUID().toString()); | ||
| } | ||
|
|
||
| @PutMapping("/{id}") | ||
| public void updateGoal(@PathVariable String id, GoalUpdateRq rq) { | ||
| } | ||
|
|
||
| @GetMapping | ||
| public GoalListRs getGoalList(@AuthUser UUID userId) { | ||
| List<GoalItemRs> items = new ArrayList<>(); | ||
| items.add(new GoalItemRs("첫번째 목표", LocalDate.now(), 50)); | ||
| items.add(new GoalItemRs("자격증 따기", LocalDate.of(2026, 2, 10), 20)); | ||
| items.add(new GoalItemRs("노래 만들기", LocalDate.now(), 100)); | ||
| return new GoalListRs( | ||
| items | ||
| ); | ||
| } | ||
| } |
22 changes: 22 additions & 0 deletions
22
motimo-api/src/main/java/kr/co/api/goal/docs/GoalControllerSwagger.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package kr.co.api.goal.docs; | ||
|
|
||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||
| import kr.co.api.goal.rqrs.GoalCreateRq; | ||
| import kr.co.api.goal.rqrs.GoalIdRs; | ||
| import kr.co.api.goal.rqrs.GoalListRs; | ||
| import kr.co.api.goal.rqrs.GoalUpdateRq; | ||
|
|
||
| import java.util.UUID; | ||
|
|
||
| @Tag(name = "목표 API", description = "목표 관련 API 목록입니다") | ||
| public interface GoalControllerSwagger { | ||
| @Operation(summary = "목표 생성 API", description = "목표를 생성합니다.") | ||
| GoalIdRs createGoal(GoalCreateRq rq); | ||
|
|
||
| @Operation(summary = "목표 수정 API", description = "목표를 수정합니다.") | ||
| void updateGoal(String id, GoalUpdateRq rq); | ||
|
|
||
| @Operation(summary = "목표 목록 API", description = "목표 목록을 조회합니다.") | ||
| GoalListRs getGoalList(UUID userId); | ||
| } |
33 changes: 33 additions & 0 deletions
33
motimo-api/src/main/java/kr/co/api/goal/rqrs/GoalCreateRq.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| package kr.co.api.goal.rqrs; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonSetter; | ||
| import com.fasterxml.jackson.annotation.Nulls; | ||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import jakarta.validation.constraints.NotNull; | ||
| import jakarta.validation.constraints.Size; | ||
|
|
||
| import java.time.LocalDate; | ||
| import java.util.List; | ||
|
|
||
| public record GoalCreateRq( | ||
| @NotNull | ||
| @Size(min = 1, max = 20) | ||
| @Schema(description = "목표 이름", example = "자격증 따기") | ||
| String title, | ||
|
|
||
| @NotNull | ||
| @Schema(description = "개월 수로 기간 설정 여부") | ||
| boolean isPeriodByMonth, | ||
|
|
||
| @Size(min = 1, max = 12) | ||
| @Schema(description = "목표 개월 수") | ||
| Integer month, | ||
|
|
||
| @Schema(description = "목표 완료 날짜", format = "date") | ||
| LocalDate dueDate, | ||
|
|
||
| @Schema(description = "세부 목표 목록") | ||
| @JsonSetter(nulls = Nulls.AS_EMPTY) | ||
| List<SubGoalCreateRq> subGoals | ||
| ) { | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package kr.co.api.goal.rqrs; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
|
|
||
| public record GoalIdRs( | ||
| @Schema(description = "생성된 아이디") | ||
| String id | ||
| ) { | ||
| } |
17 changes: 17 additions & 0 deletions
17
motimo-api/src/main/java/kr/co/api/goal/rqrs/GoalItemRs.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| package kr.co.api.goal.rqrs; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
|
|
||
| import java.time.LocalDate; | ||
|
|
||
| public record GoalItemRs( | ||
| @Schema(description = "목표 이름", example = "자격증 따기") | ||
| String title, | ||
|
|
||
| @Schema(description = "목표 완료 날짜", type = "date") | ||
| LocalDate dueDate, | ||
|
|
||
| @Schema(description = "목표 달성률 (%)", example = "24.5") | ||
| float progress | ||
| ) { | ||
| } |
11 changes: 11 additions & 0 deletions
11
motimo-api/src/main/java/kr/co/api/goal/rqrs/GoalListRs.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package kr.co.api.goal.rqrs; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record GoalListRs( | ||
| @Schema(description = "목표 목록") | ||
| List<GoalItemRs> goals | ||
| ) { | ||
| } |
30 changes: 30 additions & 0 deletions
30
motimo-api/src/main/java/kr/co/api/goal/rqrs/GoalUpdateRq.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package kr.co.api.goal.rqrs; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import jakarta.validation.constraints.NotNull; | ||
| import jakarta.validation.constraints.Size; | ||
|
|
||
| import java.time.LocalDate; | ||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
| import java.util.Objects; | ||
|
|
||
| public record GoalUpdateRq( | ||
| @NotNull | ||
| @Size(min = 1, max = 20) | ||
| @Schema(description = "목표 이름", example = "자격증 따기") | ||
| String title, | ||
|
|
||
| @NotNull | ||
| @Schema(description = "목표 완료 날짜", format = "date") | ||
| LocalDate dueDate, | ||
|
|
||
| @Schema(description = "세부 목표 목록") | ||
| List<SubGoalUpdateRq> subGoals | ||
| ) { | ||
| public GoalUpdateRq { | ||
| if (Objects.isNull(subGoals)) { | ||
| subGoals = new ArrayList<>(); | ||
| } | ||
| } | ||
| } |
17 changes: 17 additions & 0 deletions
17
motimo-api/src/main/java/kr/co/api/goal/rqrs/SubGoalCreateRq.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| package kr.co.api.goal.rqrs; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import jakarta.validation.constraints.NotNull; | ||
| import jakarta.validation.constraints.Size; | ||
|
|
||
| public record SubGoalCreateRq( | ||
| @NotNull | ||
| @Size(min = 1, max = 20) | ||
| @Schema(description = "세부 목표 이름", example = "책 한 권 읽기") | ||
| String title, | ||
|
|
||
| @Size(min = 1, max = 3) | ||
| @Schema(description = "세부 목표 중요도 (상: 1, 하:3)") | ||
| int importance | ||
| ) { | ||
| } |
20 changes: 20 additions & 0 deletions
20
motimo-api/src/main/java/kr/co/api/goal/rqrs/SubGoalUpdateRq.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package kr.co.api.goal.rqrs; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import jakarta.validation.constraints.NotNull; | ||
| import jakarta.validation.constraints.Size; | ||
|
|
||
| public record SubGoalUpdateRq( | ||
| @Schema(description = "수정할 세부 목표 아이디") | ||
| String id, | ||
|
|
||
| @NotNull | ||
| @Size(min = 1, max = 20) | ||
| @Schema(description = "세부 목표 이름", example = "책 한 권 읽기") | ||
| String title, | ||
|
|
||
| @Size(min = 1, max = 3) | ||
| @Schema(description = "세부 목표 중요도 (상: 1, 하:3)") | ||
| int importance | ||
| ) { | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기서
Integer사용한 이유는 목표 개월수가 없을수도 있어서 일까요?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
맞습니다...!