| name | api-doc-maintainer |
| description | Keep this Spring Boot project's Scalar/OpenAPI documentation accurate when REST or SSE endpoints, controller annotations, request/response DTOs, status codes, ErrorCode entries, auth/security exposure, or API examples are added or changed. Use when adding a new endpoint, changing an existing endpoint contract, reviewing API docs, fixing Scalar or /v3/api-docs output, or updating OpenAPI annotations. |
API Doc Maintainer
Use this skill when endpoint behavior or API documentation can change.
Core Rules
- Treat the generated
/v3/api-docs output as the source of truth for Scalar, not just the annotations.
- Document only implemented HTTP/SSE APIs. Do not put gRPC proto methods into OpenAPI unless they are exposed through HTTP.
- Keep controller examples tied to
OpenApiConfig reusable examples and OpenApiConstants name/ref constants.
- Do not hardcode raw JSON response examples directly in controller annotations.
- Keep admin Thymeleaf or HTML screens hidden with
@Hidden; expose only JSON admin APIs.
Endpoint Documentation Checklist
For every new or changed endpoint:
- Add or update
@Tag and @Operation with Korean summaries/descriptions that match the real behavior.
- Add
@ApiResponse entries for the actual success, redirect, stream, auth, validation, and domain-error statuses.
- For JSON endpoints, set
produces = [MediaType.APPLICATION_JSON_VALUE].
- For endpoints with JSON request bodies, set
consumes = [MediaType.APPLICATION_JSON_VALUE].
- For redirect endpoints, document the real redirect status such as
302 and do not call it 200 OK.
- For SSE endpoints, use
produces = [MediaType.TEXT_EVENT_STREAM_VALUE] and document text/event-stream.
- For authenticated endpoints, document
401 with the Unauthorized example unless the endpoint has a more specific auth error.
- For request syntax and semantic validation, split
400 and 422 when the implementation does.
Parameters And DTOs
- For GET query DTOs, make Scalar show each query parameter separately.
- If
@ParameterObject renders as a single request object, hide the DTO parameter and document each query parameter explicitly with @Parameter.
- Include
required, description, schema, allowed enum values, min/max, and examples when relevant.
- For request body DTOs, prefer DTO-level
@Schema annotations for fields that need examples, min/max, or business constraints.
- Keep documented field names aligned with Jackson binding, including custom enum codes and value objects.
Error Examples
- Reuse
OpenApiConfig component examples created from CommonResponse.emptySuccess() and CommonResponse.failure(ErrorCode...).
- Add new examples by registering them in
OpenApiConfig and adding matching name/ref constants in OpenApiConstants.
- In controller annotations, reference examples with both
name and ref.
- Never leave generated response content as
"example": null.
- Prefer concrete examples for common cases:
- auth failure:
SECURITY_401_001, AUTH_401_002, or SSO-specific errors
- request syntax failure:
COMMON_400_002
- request meaning failure:
COMMON_422_001
- domain validation failure: the owning domain
ErrorCode
Security And Exposure
- If adding public docs paths, keep
SecurityConfig and AuthPolicyResolver aligned.
- Keep
/scalar, /scalar/**, /v3/api-docs, /v3/api-docs/**, and /v3/api-docs.yaml routed through ApiDocAccessFilter.
- Keep API docs exposure controlled only by Redis key
admin:api-docs:enabled; missing Redis key or Redis lookup failure means disabled.
- Do not disable Springdoc or Scalar with profile properties if runtime admin toggling is expected.
- Verify authenticated business APIs still require authentication at runtime; documentation access rules must not weaken API auth.
Verification Workflow
- Run the narrow compile check:
.\gradlew.bat classes
- When practical, start the app on a temporary port such as
18082 and fetch /v3/api-docs.
- Inspect the generated JSON for:
- expected path and method entries
- no unintended admin HTML paths
- query parameters shown as individual fields, not a single
request object
- no
example: null under application/json
- expected component examples present
- JSON endpoints using
application/json
- SSE endpoints using
text/event-stream
- docs paths returning
404 when Redis toggle is missing or false
- Run the narrowest relevant tests first, then broader tests if the local DB and external services are available.
- If full tests cannot run because Postgres, Redis, or gRPC dependencies are unavailable, report that clearly.