Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/deploy-to-mavencentral.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: GitHub 리포지토리 체크아웃
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: JDK 17 설치
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
distribution: 'adopt'
java-version: '17'
- name: Gradle 애드온 준비하기
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
- name: 프로젝트 빌드
run: |
chmod +x gradlew
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
project-version: ${{ steps.recognize-project-version.outputs.project-version }}
steps:
- name: GitHub 리포지토리 체크아웃
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: 프로젝트 버전 인식
id: recognize-project-version
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pull-request-coverage-report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
pull-requests: write
steps:
- name: GitHub 리포지토리 체크아웃
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: JDK 17 설치
uses: actions/setup-java@v4
uses: actions/setup-java@v5
with:
distribution: 'adopt'
java-version: '17'
- name: Gradle 애드온 준비하기
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
- name: 커버리지 측정 및 리포트 생성
run: |
chmod +x gradlew
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import org.springframework.restdocs.RestDocumentationContextProvider
import org.springframework.restdocs.RestDocumentationExtension
import org.springframework.test.web.servlet.MockMvc
import org.springframework.web.context.WebApplicationContext
import org.springframework.web.method.support.HandlerMethodArgumentResolver

@ExtendWith(RestDocumentationExtension::class)
abstract class Documentify {
Expand Down Expand Up @@ -61,20 +60,6 @@ abstract class Documentify {
standalone(provider, standaloneContext)
}

fun standalone(
provider: RestDocumentationContextProvider,
controllers: List<Any>,
controllerAdvices: List<Any>,
argumentResolvers: List<HandlerMethodArgumentResolver>
) {
val standaloneContext = StandaloneMvcContextEnvironment
.standaloneEnvironment(provider)
.controllers(controllers)
.controllerAdvices(controllerAdvices)
.argumentResolvers(argumentResolvers)
standalone(provider, standaloneContext)
}

fun webApplicationContext(
provider: RestDocumentationContextProvider,
context: WebApplicationContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package io.github.bgmsound.documentify.mvc.environment

import io.github.bgmsound.documentify.core.environment.AbstractStandaloneContextEnvironment
import io.github.bgmsound.documentify.mvc.MvcDocumentContextEnvironment
import org.springframework.format.support.FormattingConversionService
import org.springframework.boot.convert.ApplicationConversionService
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
import org.springframework.restdocs.RestDocumentationContextProvider
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration
Expand Down Expand Up @@ -36,7 +36,7 @@ class StandaloneMvcContextEnvironment private constructor(
.standaloneSetup(*controllers.toTypedArray())
.setControllerAdvice(*controllerAdvices.toTypedArray())
.setCustomArgumentResolvers(*argumentResolvers.toTypedArray())
.setConversionService(FormattingConversionService().apply {
.setConversionService(ApplicationConversionService().apply {
converters.forEach { converter ->
addConverter(converter)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,6 @@ abstract class Documentify {
standalone(provider, standaloneContext)
}

fun standalone(
provider: RestDocumentationContextProvider,
controllers: List<Any>,
controllerAdvices: List<Any>,
argumentResolvers: List<HandlerMethodArgumentResolver>
) {
val standaloneContext = standaloneEnvironment(provider)
.controllers(controllers)
.controllerAdvices(controllerAdvices)
.argumentResolvers(argumentResolvers)
standalone(provider, standaloneContext)
}

fun applicationContext(
provider: RestDocumentationContextProvider,
applicationContext: ApplicationContext
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.github.bgmsound.documentify.sample.mvc.controller

import org.slf4j.LoggerFactory
import org.springframework.format.annotation.DateTimeFormat
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController
import java.time.LocalDateTime

@RestController
@RequestMapping("/date-parse-sample")
class DateParseSampleController {
private val logger = LoggerFactory.getLogger(DateParseSampleController::class.java)

@GetMapping
fun dateParseSample(
@RequestParam("time", required = false)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") time: LocalDateTime?
) {
logger.info("Parsed time: {}", time)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package io.github.bgmsound.documentify.sample.mvc.documentation

import io.github.bgmsound.documentify.mvc.Documentify
import io.github.bgmsound.documentify.sample.mvc.controller.DateParseSampleController
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.springframework.restdocs.RestDocumentationContextProvider

class DateParseSampleDocs : Documentify() {
private val api = DateParseSampleController()

@BeforeEach
fun setUp(provider: RestDocumentationContextProvider) {
standalone(provider) {
controller(api)
}
}

@Test
fun dateParseSampleApi() {
documentation("Date Parse Sample API") {
information {
description("this is Date Parse Sample API description")
tag("date-parse")
}
requestLine(io.github.bgmsound.documentify.core.specification.schema.Method.GET, "/date-parse-sample") {
queryParameter("time", "time", "2024-01-01 12:00:00")
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.github.bgmsound.documentify.sample.reactive.controller

import org.slf4j.LoggerFactory
import org.springframework.format.annotation.DateTimeFormat
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController
import java.time.LocalDateTime

@RestController
@RequestMapping("/date-parse-sample")
class DateParseSampleController {
private val logger = LoggerFactory.getLogger(DateParseSampleController::class.java)

@GetMapping
fun dateParseSample(
@RequestParam("time", required = false)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") time: LocalDateTime?
) {
logger.info("Parsed time: {}", time)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package io.github.bgmsound.documentify.sample.reactive.documentation

import io.github.bgmsound.documentify.reactive.Documentify
import io.github.bgmsound.documentify.sample.reactive.controller.DateParseSampleController
import kotlinx.coroutines.test.runTest
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.springframework.restdocs.RestDocumentationContextProvider

class DateParseSampleDocs : Documentify() {
private val api = DateParseSampleController()

@BeforeEach
fun setUp(provider: RestDocumentationContextProvider) {
standalone(provider) {
controller(api)
}
}

@Test
fun dateParseSampleApi() = runTest {
documentation("Date Parse Sample API") {
information {
description("this is Date Parse Sample API description")
tag("date-parse")
}
requestLine(io.github.bgmsound.documentify.core.specification.schema.Method.GET, "/date-parse-sample") {
queryParameter("time", "time", "2024-01-01 12:00:00")
}
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
project.name=documentify

project.group=io.github.bgmsound
project.version.id=1.3.8
project.version.id=1.3.9
project.artifact=documentify

project.description=Documentify is a tool to generate API documentation from source code.
Expand Down
Loading