Conversation
Document the order users should expect when source, request, transform, virtual, and missing-value decorators interact. Constraint: Keep README guidance aligned across English and Korean root readmes. Rejected: Leaving precedence as implicit behavior | users need clear rules when decorators are combined. Confidence: high Scope-risk: narrow Directive: Keep future binding-order docs using request terminology, not DTO terminology. Tested: pnpm --filter express-cargo test -- --runTestsByPath tests/binding/sourceBinding.test.ts tests/binding/requestBinding.test.ts tests/binding/virtualBinding.test.ts Not-tested: Full workspace build and docs site build were not run for this docs-only change. Co-authored-by: OmX <omx@oh-my-codex.dev>
There was a problem hiding this comment.
Code Review
This pull request adds a new section to both the English and Korean README files explaining the binding order and priority of decorators in bindingCargo(). It details the execution sequence of @Request(), source decorators, and @Virtual() fields, and provides a table outlining behavior for missing values. The review feedback suggests improving consistency in the missing values table by using the phrase 'skips transform and validation' across all entries to accurately reflect the underlying code behavior.
| |--------------------|---------------------------------------------------------------| | ||
| | `@Default(value)` | 기본값을 사용하고, 해당 필드의 transform과 validation을 건너뜁니다. | | ||
| | `@Optional()` | Property를 `null`로 설정하고, 해당 필드의 transform과 validation을 건너뜁니다. | | ||
| | Default/Optional 없음 | required field 에러를 추가하고, 해당 필드의 이후 validator를 건너뜁니다. | |
There was a problem hiding this comment.
다른 행들과의 일관성을 위해 '이후 validator를 건너뜁니다' 대신 'transform과 validation을 건너뜁니다'로 표현하는 것이 더 명확합니다. 실제로 handleMissing 함수가 true를 반환하면 해당 필드에 대한 transformSource와 validateField 호출이 모두 생략되기 때문입니다.
| | Default/Optional 없음 | required field 에러를 추가하고, 해당 필드의 이후 validator를 건너뜁니다. | | |
| | Default/Optional 없음 | required field 에러를 추가하고, 해당 필드의 transform과 validation을 건너뜁니다. | |
References
- 코드는 항상 읽기 쉽고 이해하기 쉬워야 한다는 가독성 원칙을 문서에도 적용하여 일관된 표현을 사용하도록 권장합니다. (link)
| |--------------------|------------------------------------------------------------------------------| | ||
| | `@Default(value)` | Uses the default value and skips transform and validation for that field. | | ||
| | `@Optional()` | Sets the property to `null` and skips transform and validation for that field. | | ||
| | No default/optional | Adds a required-field error and skips later validators for that field. | |
There was a problem hiding this comment.
이 테이블의 다른 행들과 일관성을 유지하기 위해 'skips later validators' 대신 'skips transform and validation'으로 표현하는 것이 좋습니다. 값이 없고 기본값이나 옵셔널 설정이 없는 경우, 해당 필드에 대한 변환(transform) 및 검증(validation) 단계가 모두 건너뛰어집니다.
| | No default/optional | Adds a required-field error and skips later validators for that field. | | |
| | No default/optional | Adds a required-field error and skips transform and validation for that field. | |
References
- 문서의 가독성과 명확성을 위해 표 내의 표현을 일관되게 유지하는 것이 좋습니다. (link)
| 같은 property에 데코레이터를 함께 사용할 때는 아래 규칙을 따릅니다: | ||
|
|
||
| | 조합 | 결과 | | ||
| |-------------------------------------|--------------------------------------------------------------------| | ||
| | `@Request()` + source decorator | `@Request()`가 우선합니다. 해당 property의 source decorator는 바인딩에 사용되지 않습니다. | | ||
| | `@Transform()` + source decorator | Source 값이 먼저 타입 캐스팅되고, 그 다음 `@Transform()`과 validator가 실행됩니다. | | ||
| | `@Virtual()` + source 또는 `@Request()` | 피하는 것이 좋습니다. `@Virtual()`이 마지막에 실행되어 최종 값을 덮어쓸 수 있습니다. | | ||
| | 여러 source decorator | 피하는 것이 좋습니다. Property 하나에는 source decorator 하나만 사용하세요. fallback chain이 아닙니다. | |
There was a problem hiding this comment.
#221 작업이 머지되면 virtual + request와 중복 source 사용, virtual + source, request + source 사용을 막게 되는데, 피하는 것이 아니라 사용이 아예 불가능하다는 걸로 명시하는게 좋지 않을까요?
Separate binding-order guidance into value-present and value-missing paths so readers can see where Default, Optional, and required errors apply. Constraint: Address PR review feedback while keeping duplicate-decorator rules out of this README section. Rejected: Documenting duplicate decorator combinations here | that guidance will be written separately. Confidence: high Scope-risk: narrow Directive: Keep binding-order docs focused on request terminology and runtime order, not DTO terminology. Tested: Not run; README-only wording change. Not-tested: Full workspace build, package tests, and docs site build were not run for this docs-only change. Co-authored-by: OmX <omx@oh-my-codex.dev>
Summary
Tested
Not tested