Skip to content

Commit

Permalink
feat: api restdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
alstn113 committed Dec 28, 2024
1 parent ffb2999 commit 8895a57
Show file tree
Hide file tree
Showing 12 changed files with 8,049 additions and 4 deletions.
25 changes: 22 additions & 3 deletions server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,32 @@ dependencies {
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
}

tasks.named('test') {
outputs.dir snippetsDir

test {
useJUnitPlatform()
outputs.dir snippetsDir
}

tasks.named('asciidoctor') {
asciidoctor {
inputs.dir snippetsDir
configurations 'asciidoctorExt'
dependsOn test
baseDirFollowsSourceFile()
}

bootJar {
dependsOn asciidoctor
from("${asciidoctor.outputDir}/html5") {
into 'static/docs'
}
}

tasks.register('copyDocument', Copy) {
dependsOn asciidoctor
from file("build/docs/asciidoc")
into file("src/main/resources/static/docs")
}

build {
dependsOn copyDocument
}
9 changes: 9 additions & 0 deletions server/src/docs/asciidoc/auth.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
== Auth API

=== 나의 정보 조회

operation::api/v1/auth/get-my-info[]

=== 로그아웃

operation::api/v1/auth/logout[]
37 changes: 37 additions & 0 deletions server/src/docs/asciidoc/exam.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
== Exam API

=== 출제된 시험 요약 목록 조회

operation::api/v1/exams/get-published-exam-summaries[]

=== 내가 출제한 시험 요약 목록 조회

operation::api/v1/exams/get-my-exam-summaries[]

=== 시험 상세 조회

operation::api/v1/exams/get-exam-detail[]

=== 시험 상세 정보와 답안을 함께 조회

operation::api/v1/exams/get-exam-detail-with-answers[]

=== 시험 생성

operation::api/v1/exams/create-exam[]

=== 시험 출제

operation::api/v1/exams/publish[]

=== 시험 문제 수정

operation::api/v1/exams/questions[]

=== 시험 제목 수정

operation::api/v1/exams/update-title[]

=== 시험 설명 수정

operation::api/v1/exams/update-description[]
12 changes: 12 additions & 0 deletions server/src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
:doctype: book
:source-highlighter: highlightjs
:toc: left
:toclevels: 2
:sectlinks:

= Fluffy API 문서

include::auth.adoc[]
include::oauth2.adoc[]
include::exam.adoc[]
include::submission.adoc[]
9 changes: 9 additions & 0 deletions server/src/docs/asciidoc/oauth2.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
== OAuth2 API

=== OAuth2 로그인 페이지로 리다이렉트

operation::api/v1/auth/oauth2/redirect[]

=== OAuth2 로그인 콜백 처리

operation::api/v1/auth/oauth2/callback[]
13 changes: 13 additions & 0 deletions server/src/docs/asciidoc/submission.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
== Submission API

=== 시험 제출 요약 목록 조회

operation::api/v1/exams/get-submission-summaries[]

=== 시험 제출 상세 조회

operation::api/v1/exams/get-submission-detail[]

=== 시험 제출

operation::api/v1/exams/submit[]
632 changes: 632 additions & 0 deletions server/src/main/resources/static/docs/auth.html

Large diffs are not rendered by default.

2,241 changes: 2,241 additions & 0 deletions server/src/main/resources/static/docs/exam.html

Large diffs are not rendered by default.

3,323 changes: 3,323 additions & 0 deletions server/src/main/resources/static/docs/index.html

Large diffs are not rendered by default.

659 changes: 659 additions & 0 deletions server/src/main/resources/static/docs/oauth2.html

Large diffs are not rendered by default.

1,091 changes: 1,091 additions & 0 deletions server/src/main/resources/static/docs/submission.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void getMyInfo() throws Exception {
content().json(objectMapper.writeValueAsString(response))
)
.andDo(document(
"api/v1/auth/me",
"api/v1/auth/get-my-info",
responseFields(
fieldWithPath("id").description("사용자 식별자"),
fieldWithPath("email").description("사용자 이메일"),
Expand Down

0 comments on commit 8895a57

Please sign in to comment.