-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #248 from Yanol-Market/feature/common-util
Feature/ Spring REST Docs 공통 설정
- Loading branch information
Showing
6 changed files
with
78 additions
and
34 deletions.
There are no files selected for viewing
This file contains 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 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 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,15 @@ | ||
== 회원가입 | ||
|
||
=== HTTP request fields | ||
include::{snippets}/user/join/success/request-fields.adoc[] | ||
|
||
=== HTTP request | ||
include::{snippets}/user/join/success/http-request.adoc[] | ||
|
||
=== HTTP response fields | ||
|
||
include::{snippets}/user/join/success/response-fields.adoc[] | ||
|
||
=== HTTP request | ||
|
||
include::{snippets}/user/join/success/http-response.adoc[] |
This file contains 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 |
---|---|---|
@@ -1,33 +1,35 @@ | ||
package site.goldenticket.common.config; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import io.restassured.builder.RequestSpecBuilder; | ||
import io.restassured.specification.RequestSpecification; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs; | ||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.restdocs.RestDocumentationContextProvider; | ||
import org.springframework.restdocs.RestDocumentationExtension; | ||
import org.springframework.restdocs.operation.preprocess.OperationRequestPreprocessor; | ||
import org.springframework.restdocs.operation.preprocess.OperationResponsePreprocessor; | ||
import org.springframework.test.web.servlet.MockMvc; | ||
import org.springframework.restdocs.snippet.Attributes.Attribute; | ||
|
||
import static org.springframework.restdocs.operation.preprocess.Preprocessors.*; | ||
import static org.springframework.restdocs.snippet.Attributes.key; | ||
import static org.springframework.restdocs.restassured.RestAssuredRestDocumentation.documentationConfiguration; | ||
|
||
@SpringBootTest | ||
@AutoConfigureMockMvc | ||
@AutoConfigureRestDocs | ||
@ExtendWith(RestDocumentationExtension.class) | ||
public abstract class ApiDocumentation { | ||
public abstract class ApiDocumentation extends ApiTest { | ||
|
||
private static final String BASE_URL = "localhost"; | ||
|
||
@Autowired | ||
protected ObjectMapper objectMapper; | ||
|
||
@Autowired | ||
protected MockMvc mockMvc; | ||
protected RequestSpecification spec; | ||
|
||
@BeforeEach | ||
public void setUpDocs(RestDocumentationContextProvider restDocumentation) { | ||
this.spec = new RequestSpecBuilder() | ||
.addFilter(documentationConfiguration(restDocumentation)) | ||
.build(); | ||
} | ||
|
||
protected OperationRequestPreprocessor getDocumentRequest() { | ||
return preprocessRequest(modifyUris().host(BASE_URL).removePort(), prettyPrint()); | ||
|
@@ -36,20 +38,4 @@ protected OperationRequestPreprocessor getDocumentRequest() { | |
protected OperationResponsePreprocessor getDocumentResponse() { | ||
return preprocessResponse(prettyPrint()); | ||
} | ||
|
||
protected Attribute getTimeFormat() { | ||
return key("format").value("hh:mm"); | ||
} | ||
|
||
protected Attribute getDateFormat() { | ||
return key("format").value("yyyy-MM-dd"); | ||
} | ||
|
||
protected Attribute getPhoneFormat() { | ||
return key("format").value("000-0000-0000"); | ||
} | ||
|
||
protected Attribute getEmailFormat() { | ||
return key("format").value("[email protected]"); | ||
} | ||
} |
This file contains 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 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