Skip to content

Commit 2a1e79f

Browse files
Add validation for coupon description in BmsCoupon model
- Introduced a new field validator for the "description" field in the BmsCoupon class. - Ensures that the description is limited to a maximum of 12 characters, enhancing input validation and error handling.
1 parent c04acf0 commit 2a1e79f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

solapi/model/kakao/bms/bms_coupon.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,12 @@ def validate_coupon_title(cls, v: Optional[str]) -> Optional[str]:
5353
'"OOO UP 쿠폰" (7자 이내)'
5454
)
5555
return v
56+
57+
@field_validator("description")
58+
@classmethod
59+
def validate_coupon_description(cls, v: Optional[str]) -> Optional[str]:
60+
if v is None:
61+
return v
62+
if len(v) > 12:
63+
raise ValueError("쿠폰 설명은 최대 12자 이하로 입력해주세요.")
64+
return v

0 commit comments

Comments
 (0)