ysk(0soo)
Lifealong
ysk(0soo)
전체 방문자
오늘
어제
  • 분류 전체보기 (238)
    • Java (50)
      • whiteship-java-study (11)
      • Java (28)
      • time (6)
    • Spring (68)
      • JPA (15)
      • Spring (1)
      • SpringBoot (1)
      • SpringMVC (6)
      • Spring Security (22)
      • Jdbc (1)
      • RestDocs (14)
      • log (6)
    • Kotlin (3)
    • Web (2)
      • nginx (1)
    • Database (14)
      • MySQL (5)
      • PostgreSQL (1)
      • SQL (1)
      • Redis (4)
    • C, C++ (0)
    • Git (1)
    • Docker (2)
    • Cloud (3)
      • AWS (3)
    • 도서, 강의 (0)
      • t5 (0)
    • 기타 (7)
      • 프로그래밍 (1)
    • 끄적끄적 (0)
    • CS (14)
      • 운영체제(OS) (2)
      • 자료구조(Data Structure) (9)
    • 하루한개 (12)
      • 우아한 테크코스-10분테코톡 (12)
    • 스터디 (12)
      • 클린 아키텍처- 로버트마틴 (2)
      • JPA 프로그래밍 스터디 (10)
    • 테스트 (34)
      • JUnit (19)
      • nGrinder (2)
      • JMeter (0)
    • Infra (3)
    • 프로그래머스 백엔드 데브코스 3기 (0)
    • 디자인 패턴 (3)
    • Issue (4)
    • system (1)
      • grafana (0)
      • Prometheus (0)

블로그 메뉴

  • 홈
  • 태그
  • 방명록
  • github

공지사항

인기 글

태그

  • UserDetailsService
  • tree
  • StructuredConcorrency
  • LocalDateTime
  • 트랜잭션
  • 동일성
  • mysql
  • FilterSecurityInterceptor
  • AuthenticationException
  • VirtualThread Springboot
  • restdocs custom
  • 동등성
  • jpa
  • 가상 스레드
  • 동시성 제어
  • node exporter basic auth
  • restdocs enum
  • 가상 스레드 예외 핸들링
  • 정규표현식
  • scope value
  • AccessDecisionManager
  • 인가(Authorization) 처리
  • querydsl
  • nginx basic auth
  • java
  • DataJpaTest
  • junit5
  • 구조화된 동시성
  • nGrinder
  • AccessDecisionVoter 커스텀

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
ysk(0soo)

Lifealong

RestDocs 문서 분리 방법 - adoc, mustache
Spring/RestDocs

RestDocs 문서 분리 방법 - adoc, mustache

2023. 1. 29. 17:43
  • RestDocs 공식문서 - https://docs.spring.io/spring-restdocs/docs/2.0.5.RELEASE/reference/html5/

다음과 같이 User, Post 같이 여러 API들이 한 index.adoc 파일에 존재한다면 파일이 엄청 길어질 수 있어 분리하고

include 하여 사용할 수 있다.

  1. 먼저 분리할 목차에 마우스 커서를 올리고 맥 기준 option + enter를 누르면 다음과 같은 창이 나온다

  1. Extract Include Directive를 클릭하면 인텔리제이가 해당 문서를 분리해준다.
    • src/docs/asciidoc 위치로 해당 API를 빼주게 된다.
  1. 사용할 곳에서 include::filename.adoc[] 을 이용하면 된다.

as-is

.... 위에 더 많이 존재
​
==== request-fail - 존재하지 않는 게시글
​
include::{snippets}/posts-findAll-NotFound/http-response.adoc[]
​
include::{snippets}/posts-findAll-NotFound/response-fields.adoc[]
​
​
​
== Common
=== ErrorResponseFormat
​
include::{snippets}/posts-update-all-FailEmptyValue/http-response.adoc[]
​
include::{snippets}/posts-update-all-FailEmptyValue/response-fields.adoc[]

to-be

==== request-fail - 존재하지 않는 게시글
​
include::{snippets}/posts-findAll-NotFound/http-response.adoc[]
​
include::{snippets}/posts-findAll-NotFound/response-fields.adoc[]
​
​
include::common.adoc[] // << 

분리된 common.adoc

== Common
=== ErrorResponseFormat
​
include::{snippets}/posts-update-all-FailEmptyValue/http-response.adoc[]
​
include::{snippets}/posts-update-all-FailEmptyValue/response-fields.adoc[]
저작자표시 비영리 (새창열림)

'Spring > RestDocs' 카테고리의 다른 글

Restdocs pretty print, header 제거  (0) 2023.01.29
RestDocs Custom - 문서 커스텀  (1) 2023.01.29
Restdocs Enum 공통코드 문서화 방법 - Enum 문서화  (0) 2023.01.29
RestDocs에서 Snippet 파일명 커스텀, Restdocs Link(링크) 걸기  (1) 2023.01.29
IntelliJ Restdocs Unexpected token - .snippet 파일을 AsciiDoc로 인식하지 않을 때  (0) 2023.01.28
    'Spring/RestDocs' 카테고리의 다른 글
    • Restdocs pretty print, header 제거
    • RestDocs Custom - 문서 커스텀
    • Restdocs Enum 공통코드 문서화 방법 - Enum 문서화
    • RestDocs에서 Snippet 파일명 커스텀, Restdocs Link(링크) 걸기
    ysk(0soo)
    ysk(0soo)
    백엔드 개발을 좋아합니다. java kotlin spring, infra 에 관심이 많습니다. email : kim206gh@naver.com github : https://github.com/devysk

    티스토리툴바