소스 정보
- 저장소
- sivaprasadreddy/sivalabs-marketplace
- 최근 소스 활동
- 2026년 1월 3일 07:40
- 감지된 SKILL.md 언어
- 영어
- 스타
- 47
- 포크
- 6
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
SOC 직업 분류 기준
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/sivaprasadreddy/sivalabs-marketplace --skill spring-rest-api-creator명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
| name | spring-rest-api-creator |
| description | Creates Spring REST APIs following best practices. |
The following are key principles to follow while creating Spring REST APIs:
@PathVariable and @RequestParam to Value Objects@RequestBody binding to Request Objects with Value Object properties@JsonUnwrapped to map flattened JSON to nested objects@Valid annotationimport org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
@Component
public class StringToEventCodeConverter implements Converter<String, EventCode> {
@Override
public EventCode convert(String source) {
return new EventCode(source);
}
}
This allows Spring MVC to automatically convert path variables like /{eventCode} from String to EventCode:
@GetMapping("/{eventCode}")
ResponseEntity<EventVM> findEventByCode(@PathVariable EventCode eventCode) {
// eventCode is already an EventCode object, not a String
}
Use @JsonValue and @JsonCreator annotations to bind primitives to Request Bodies with Value Objects.
EventCode Value Object:
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import jakarta.validation.constraints.NotBlank;
public record EventCode(
@JsonValue
@NotBlank(message = "Event code cannot be null or empty")
String code
) {
@JsonCreator
public EventCode {
if (code == null || code.trim().isEmpty()) {
throw new IllegalArgumentException("Event code cannot be null");
}
}
public static EventCode of(String code) {
return new EventCode(code);
}
}
CreateEventRequest Request Payload:
record CreateEventRequest(
@Valid EventCode code
// ... other properties
) {
}
Now Spring MVC will automatically bind the code property from the JSON payload to EventCode object.
{
"code": "ABSHDJFSD",
"property-1": "value-1",
"property-n": "value-n"
}
Use @JsonUnwrapped and @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) annotations to map flattened JSON to nested objects.
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
public record EventDetails(
@NotBlank(message = "Title is required")
@Size(min = 3, max = 200, message = "Title must be between 3 and 200 characters")
String title,
@NotBlank(message = "Description is required")
@Size(max = 10000, message = "Description cannot exceed 10000 characters")
String description,
@Size(max = 500, message = "Image URL cannot exceed 500 characters")
@Pattern(regexp = "^https?://.*", message = "Image URL must be a valid HTTP/HTTPS URL")
String imageUrl) {
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
public EventDetails(
@JsonProperty("title") String title,
@JsonProperty("description") String description,
@JsonProperty("imageUrl") String imageUrl
) {
this.title = AssertUtil.requireNotNull(title, "title cannot be null");
this.description = AssertUtil.requireNotNull(description, "description cannot be null");
this.imageUrl = imageUrl;
}
public static EventDetails of(String title, String description, String imageUrl) {
return new EventDetails(title, description, imageUrl);
}
}
CreateEventRequest Request Payload:
record CreateEventRequest(
@Valid EventCode code,
@JsonUnwrapped @Valid EventDetails details
// ... other properties
) {
}
Now Spring MVC will automatically bind the title, description and imageUrl property values
from the JSON payload to EventDetails object.
{
"code": "ABSHDJFSD",
"title": "Spring Boot Workshop",
"description": "Learn Spring Boot best practices",
"imageUrl": "https://example.com/image.jpg",
"property-1": "value-1",
"property-n": "value-n"
}
Create a centralized exception handler that returns ProblemDetail responses.
Create a class GlobalExceptionHandler by following the following key principles:
@RestControllerAdviceResponseEntityExceptionHandlerProblemDetail for RFC 7807 complianceimport dev.sivalabs.meetup4j.shared.DomainException;
import dev.sivalabs.meetup4j.shared.ResourceNotFoundException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.DefaultMessageSourceResolvable;
import org.springframework.core.env.Environment;
import org.springframework.http.*;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import java.time.Instant;
import java.util.Arrays;
import java.util.List;
import static org.springframework.http.HttpStatus.NOT_FOUND;
import static org.springframework.http.HttpStatus.BAD_REQUEST;
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
@RestControllerAdvice
class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);
private final Environment environment;
GlobalExceptionHandler(Environment environment) {
this.environment = environment;
}
@Override
public ResponseEntity<Object> handleMethodArgumentNotValid {
log.error(, ex);
ex.getAllErrors().stream()
.map(DefaultMessageSourceResolvable::getDefaultMessage)
.toList();
ProblemDetail.forStatusAndDetail(BAD_REQUEST, ex.getMessage());
problemDetail.setTitle();
problemDetail.setProperty(, errors);
ResponseEntity.status(UNPROCESSABLE_CONTENT).body(problemDetail);
}
ProblemDetail {
log.info(, e);
ProblemDetail.forStatusAndDetail(BAD_REQUEST, e.getMessage());
problemDetail.setTitle();
problemDetail.setProperty(, List.of(e.getMessage()));
problemDetail;
}
ProblemDetail {
log.error(, e);
ProblemDetail.forStatusAndDetail(NOT_FOUND, e.getMessage());
problemDetail.setTitle();
problemDetail.setProperty(, List.of(e.getMessage()));
problemDetail;
}
ProblemDetail {
logger.error(, e);
;
(isDevelopmentMode()) {
message = e.getMessage();
}
ProblemDetail.forStatusAndDetail(INTERNAL_SERVER_ERROR, message);
problemDetail.setProperty(, Instant.now());
problemDetail;
}
{
List<String> profiles = Arrays.asList(environment.getActiveProfiles());
profiles.contains() || profiles.contains();
}
}
Validation Error (400):
{
"type": "about:blank",
"title": "Validation Error",
"status": 400,
"detail": "Validation failed for argument...",
"errors": [
"Title is required",
"Email must be valid"
]
}
Domain Exception (400):
{
"type": "about:blank",
"title": "Bad Request",
"status": 400,
"detail": "Cannot cancel events that have already started",
"errors": [
"Cannot cancel events that have already started"
]
}
Resource Not Found (404):
{
"type": "about:blank",
"title": "Resource Not Found",
"status": 404,
"detail": "Event not found with code: ABC123",
"errors": [
"Event not found with code: ABC123"
]
}
Internal Server Error (500):
{
"type": "about:blank",
"title": "Internal Server Error",
"status": 500,
"detail": "An unexpected error occurred",
"timestamp": "2024-01-15T10:30:00Z"
}