request — REST request DTO scaffold
Generate a validated request body for an API endpoint, co-located with its controller.
Authority:
AGENTS.mdis binding. Review withkotlin-spring-review.
Reference loading (progressive disclosure): Read principles first, then use the KB index. Load only topic files matching the current task; MUST NOT recursively load the entire KB.
Where it goes
- API module, package
com.example.api.<domain>— co-located with the controller (norequest/subfolder). Nopublickeyword. - Class name
<Action><Entity>Request.
Skeleton (see order/PlaceOrderRequest.kt)
data class <Action><Entity>Request(
@field:NotBlank
val <stringField>: String,
@field:NotNull
val <enumField>: <ProtocolEnum>,
)
Rules (MUST)
data classwithvalproperties.- jakarta Bean Validation with the
@field:site target (Kotlin):@field:NotBlank,@field:NotNull, etc. The controller validates with@RequestBody @Valid. - Identifiers that belong in the URI path (e.g.
memberId) stay out of the body. - Prefer protocol enums from
enumover free-form strings. KDoc per field, in Korean. - 생성 코드에 단일 파라미터 람다가 있으면 중첩되지 않은 경우
it을 쓰고, 중첩 스코프를 구분해야 할 때만 내부 파라미터에 이름을 붙인다. 여러 파라미터가 필요한 API는 예외다.
Verify
Compile with the detected build system (gradle/maven/etc.).
Related
[[response]] · [[enum]]