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
10 changes: 0 additions & 10 deletions .github/workflows/auto-assign-workflow.yaml

This file was deleted.

1 change: 1 addition & 0 deletions example/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ val snippetsDir by extra { file("build/generated-snippets") }
dependencies {
implementation(projects.mockmvc)
implementation(libs.spring.boot.starter.web)
implementation(libs.spring.boot.starter.validation)

testImplementation(libs.spring.boot.starter.test)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* Korest Docs
*
* Copyright 2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.github.lcomment.example

import jakarta.annotation.PostConstruct
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,35 @@
/*
* Korest Docs
*
* Copyright 2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.github.lcomment.example.controller

import io.github.lcomment.example.dto.request.ExampleMultipartRequest
import io.github.lcomment.example.dto.request.ExampleRequest
import io.github.lcomment.example.dto.response.ApiResponse
import io.github.lcomment.example.dto.response.ExampleResponse
import io.github.lcomment.example.service.ExampleService
import jakarta.validation.Valid
import org.springframework.http.MediaType
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.ModelAttribute
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RestController

@RestController
Expand All @@ -20,4 +45,26 @@ class ExampleController(

return ApiResponse.success(data)
}

@PostMapping("/example/{id}")
fun post(
@PathVariable id: Long,
@RequestBody @Valid request: ExampleRequest,
): ApiResponse<Unit> {
exampleService.post(request)

return ApiResponse.success()
}

@PostMapping(
"/example",
consumes = [MediaType.MULTIPART_FORM_DATA_VALUE],
produces = [MediaType.APPLICATION_JSON_VALUE],
)
fun saveImages(
@ModelAttribute @Valid request: ExampleMultipartRequest,
// @RequestParam message: String,
): ApiResponse<Unit> {
return ApiResponse.success()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package io.github.lcomment.example.dto.request

import jakarta.validation.constraints.NotBlank
import org.springframework.web.multipart.MultipartFile

data class ExampleMultipartRequest(
val images: List<MultipartFile> = emptyList(),
@field:NotBlank
var message: String? = null,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Korest Docs
*
* Copyright 2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.github.lcomment.example.dto.request

import jakarta.validation.constraints.NotBlank

data class ExampleRequest(
@field:NotBlank
val example: String? = null,
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
/*
* Korest Docs
*
* Copyright 2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.github.lcomment.example.dto.response

import io.github.lcomment.example.enums.ReturnCode
import com.fasterxml.jackson.annotation.JsonInclude

@JsonInclude(JsonInclude.Include.NON_NULL)
data class ApiResponse<T>(
val code: String,
val message: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* Korest Docs
*
* Copyright 2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.github.lcomment.example.dto.response

data class ArrayResponse(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* Korest Docs
*
* Copyright 2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.github.lcomment.example.dto.response

import java.time.LocalDate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* Korest Docs
*
* Copyright 2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.github.lcomment.example.dto.response

import io.github.lcomment.example.enums.ExampleEnum
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* Korest Docs
*
* Copyright 2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.github.lcomment.example.dto.response

data class NumberResponse(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* Korest Docs
*
* Copyright 2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.github.lcomment.example.enums

enum class ExampleEnum {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* Korest Docs
*
* Copyright 2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.github.lcomment.example.enums

enum class ReturnCode(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
/*
* Korest Docs
*
* Copyright 2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.github.lcomment.example.service

import io.github.lcomment.example.dto.request.ExampleRequest
import io.github.lcomment.example.dto.response.ExampleResponse
import org.springframework.stereotype.Service

Expand All @@ -9,4 +28,10 @@ class ExampleService {
fun get(): ExampleResponse {
return ExampleResponse()
}

fun post(
request: ExampleRequest,
) {
// do nothing
}
}
Loading