Skip to content

feat: validate decorator rules#232

Open
yuchem2 wants to merge 2 commits into
developfrom
CARGO-418
Open

feat: validate decorator rules#232
yuchem2 wants to merge 2 commits into
developfrom
CARGO-418

Conversation

@yuchem2

@yuchem2 yuchem2 commented Jun 11, 2026

Copy link
Copy Markdown
Member

p1에 해당하는 데코레이터 검증 규칙을 추가합니다.

  • description이 없는 sybmol property 거부
  • source 데코레이터 key가 빈 문자열로 들어온 경우 거부
  • @With, @Without의 대상 필드가 없는 경우 거부
  • 배열이 아닌 필드에 @Each를 적용한 경우 거부
  • 배열이 아닌 필드에 @List를 적용한 경우 거부
  • primitive 필드에 @Type를 적용한 경우 거부

yuchem2 added 2 commits June 11, 2026 21:12
- add basis rule and crossfield rules
- add type-helper rules

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

이번 풀리퀘스트는 스키마 검증을 위한 다양한 신규 규칙(기본 규칙, 교차 필드 참조 규칙, 타입 헬퍼 배치 규칙 및 @each 사용 규칙)과 관련 테스트 코드를 추가합니다. 이를 위해 데코레이터가 실행 인자(args)를 캡처하여 저장하도록 수정되었으며, FieldState 구조에 sourceKey와 siblingFields가 추가되었습니다. 리뷰 피드백에서는 packages/express-cargo/src/rules/crossField.ts 파일 내에서 발생할 수 있는 런타임 에러를 방지하기 위해 applied.args?.[0]과 같이 옵셔널 체이닝을 적용할 것을 권장하고 있습니다.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

function unknownReference(state: FieldState, decoratorName: string): string | null {
for (const applied of state.appliedSelf) {
if (applied.name !== decoratorName) continue
const target = applied.args[0]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

런타임 안정성을 높이고 방어적 프로그래밍(Defensive Programming)을 실천하기 위해, applied.args가 존재하지 않거나 비어있을 가능성에 대비하여 옵셔널 체이닝(?.)을 사용하는 것이 안전합니다.

applied.args[0] 대신 applied.args?.[0]을 사용하여 혹시 모를 런타임 에러를 방지하는 것을 제안합니다.

Suggested change
const target = applied.args[0]
const target = applied.args?.[0]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applied.args는 null혹은 undefined인 경우가 없기 때문에 해당 리뷰를 무시합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant