feat(common): A-2 DTO 검증 인프라 + SDL 동기화 가드 도입#96
Conversation
A-2 검증 전략(class-validator 전면 도입) 인프라. - PaginationInput / CursorInput: 산재된 offset/limit/cursor 검증을 단일 베이스 클래스로 통합. limit 상한 100 운영 보호. - IsDecimalString / IsTimeString: seller 도메인 가격·영업시간 입력의 수동 검증을 데코레이터화. 향후 SDL Input DTO 에서 재사용. - 단위 테스트 36건 동반 (validate 결과 직접 검증)
A-2 전략에 따라 SDL input 정의와 DTO class 의 어긋남을 빌드 시점에 탐지. 마이그레이션 진행 중에는 warning 모드로 정보만 출력하고 CI 를 실패시키지 않는다. 모든 도메인 DTO 화 완료 후 --strict 로 승격하여 필수 status check 로 격상 예정. - scripts/check-graphql-dto-sync.ts: ts-morph 기반 비교 스크립트 - package.json: yarn dto:check 추가 - pr-check.yml: Lint 단계 직후 warning 모드 실행
|
Caution Review failedPull request was closed or merged during review 📝 Walkthrough개요이 PR은 GraphQL SDL과 TypeScript DTO 간 동기화를 자동으로 검사하는 CI 도구를 추가하고, 페이지네이션 및 검증 기능을 위한 공통 DTO와 커스텀 검증기를 새로 도입합니다. 변경 사항GraphQL DTO 동기화 검증 도구
공통 페이지네이션 및 검증 기능
예상 코드 리뷰 노력🎯 3 (보통) | ⏱️ ~20분 관련 가능성 있는 PR
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Coverage report
Test suite run success918 tests passing in 82 suites. Report generated by 🧪jest coverage report action from 6eef859 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6eef859ddd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (WARNING_ONLY) { | ||
| console.warn( | ||
| '\n[warning mode] CI 를 실패시키지 않습니다. 마이그레이션 완료 후 warning 플래그 제거 + --strict 로 승격하세요.', | ||
| ); | ||
| process.exit(0); |
There was a problem hiding this comment.
Fail CI when SDL/DTO mismatches are detected
In warning mode this block always exits with code 0 even after collecting FIELD_MISSING, EXTRA_DTO_FIELD, or REQUIRED_MISMATCH errors, so the new CI step (.github/workflows/pr-check.yml runs yarn dto:check --warning) will not block merges when already-migrated DTOs drift from SDL. That defeats the guardrail for real schema/validation divergence and can let runtime validation mismatches ship unnoticed.
Useful? React with 👍 / 👎.
Summary
PaginationInput/CursorInputbase DTO +IsDecimalString/IsTimeString커스텀 validator 추가. 향후 도메인별 Input class 가 베이스를 상속하여 사용 (offset/limit/cursor/decimal/time 검증 통합)yarn dto:check) 추가. 마이그레이션 진행 중에는 warning 모드로 CI 정보만 출력. 전수 DTO 화 완료 후--strict로 격상 예정배경
A-2 검증 전략(GraphQL Input · REST Body 모두 class + class-validator 로 통일) 도입의 1차 인프라 PR. SDL 단일 소스는 유지하되, codegen interface 는 Resolver 반환 타입용, 검증은 class DTO 경유.
현재 산재된 수동 검증 25곳 이상(
offset/limit,nickname정규식,birthDate,rating,price, 영업시간 등)을 데코레이터로 흡수해갈 예정.후속 작업 (별도 PR)
SellerLoginInput등)dto:checkwarning → strict 승격Test plan
yarn lint통과yarn test918/918 통과 (회귀 없음)yarn dto:check실행: 46 SDL inputs · 2 DTO base · errors 0Summary by CodeRabbit
릴리스 노트
New Features
Tests
Chores