π μμ€ν λ©μμ§: μ΄ Skillμ΄ νΈμΆλλ©΄
[SEMO] Skill: sync-openapi νΈμΆ - {API κ²½λ‘}μμ€ν λ©μμ§λ₯Ό 첫 μ€μ μΆλ ₯νμΈμ.
Sync OpenAPI Skill
core-interface OpenAPI μ€νμ κΈ°λ°μΌλ‘ API ꡬν κ°μ΄λ
Background
core-interface (OpenAPI 3.1 Spec)
β (Single Source of Truth)
ββββββ΄βββββ
β β
core-backend cm-template
(Spring Boot) (Next.js)
When to Use
- API Controller ꡬν μ
- Request/Response DTO μμ± μ
- API μλ΅ νμ νμΈ μ
- v0.4.x CODE λ¨κ³
Quick Start
# OpenAPI μ€ν μ 체 μ‘°ν
gh api repos/semicolon-devteam/core-interface/contents/openapi-spec.json \
--jq '.content' | base64 -d
# νΉμ Path μ‘°ν (jq νμ)
gh api repos/semicolon-devteam/core-interface/contents/openapi-spec.json \
--jq '.content' | base64 -d | jq '.paths["/api/v1/posts"]'
DTO Naming Convention
| OpenAPI Operation | Request DTO | Response DTO | |-------------------|-------------|--------------| | createPost | CreatePostRequest | CreatePostResponse | | getPost | - | GetPostResponse | | updatePost | UpdatePostRequest | UpdatePostResponse | | deletePost | - | - | | listPosts | - | PagedPostsResponse |
ApiResponse Pattern
sealed class ApiResponse<T> {
data class Success<T>(
val success: Boolean = true,
val data: T,
val message: String? = null,
val timestamp: Instant = Instant.now()
)
data class PagedSuccess<T>(
val success: Boolean = true,
val data: List<T>,
val pagination: Pagination,
val message: String? = null,
val timestamp: Instant = Instant.now()
)
data class Error(
val success: Boolean = false,
val message: String,
val errorCode: String? = null,
val fieldErrors: Map<String, String>? = null,
val timestamp: Instant = Instant.now()
)
}
Output Format
[SEMO] Skill: sync-openapi νΈμΆ - {endpoint}
## API Spec: POST /api/v1/posts
### Request
```json
{
"title": "string",
"content": "string"
}
Response (201)
{
"success": true,
"data": {
"id": "uuid",
"title": "string",
"content": "string",
"createdAt": "datetime"
}
}
DTO Suggestion
data class CreatePostRequest(
val title: String,
val content: String
)
data class CreatePostResponse(
val id: UUID,
val title: String,
val content: String,
val createdAt: Instant
)
## Critical Rules
1. **Always check spec first**: ꡬν μ core-interface νμΈ νμ
2. **Follow DTO naming**: Operation ID prefix κ·μΉ μ€μ
3. **Polymorphic responses**: discriminator ν¨ν΄ μ¬μ©
4. **Error responses**: νμ€ ErrorResponse νμ
## Related Skills
- `implement` - v0.4.x CODE λ¨κ³μμ μ¬μ©
- `scaffold-domain` - Controller μμ± μ μ°Έμ‘°
## Related Resources
- **Swagger UI**: https://core-interface-ashen.vercel.app/
- **Repository**: https://github.com/semicolon-devteam/core-interface
## References
- [DTO Patterns](references/dto-patterns.md)
- [Polymorphic Types](references/polymorphic-types.md)