Skip to content

Conversation

@dinhsan2000
Copy link
Contributor

@dinhsan2000 dinhsan2000 commented Dec 10, 2025

Updated the validation for sticker.cateId to explicitly check for undefined or null values, ensuring that zero or falsy values are not incorrectly rejected.

What does this PR do?

  • This PR updates the validation logic for sticker.cateId to explicitly check for undefined or null values. This ensures that valid values such as 0 or other falsy numbers are no longer incorrectly rejected during validation.

Reason for this PR

  • Previously, the validation used a generic falsy check, causing 0—a valid category ID—to be treated as invalid. This led to incorrect validation errors and prevented stickers belonging to category ID 0 from being processed.
  • The updated validation improves accuracy and prevents unintended rejections.

How did you verify your code works?

  • All related features have been fully tested
  • Unit tests have been updated/created if needed
  • No lint/format errors
  • Documentation has been updated if needed
  • Code changes

Related Issue (if any)

  • N/A or link to issue here.

Testing Instructions

  • Attempt to create or update a sticker with the following cateId values:
  • 0 (should be accepted)
  • 1 or other valid numbers (should be accepted)
  • null or undefined (should be rejected)
  • Run the test suite to confirm all unit tests pass.
  • Validate that no lint or formatting errors occur during the build process.
  • Example payload
{
    "id": 1,
    "cateId": 0,
    "type": 2
}

Updated the validation for sticker.cateId to explicitly check for undefined or null values, ensuring that zero or falsy values are not incorrectly rejected.
Added a comment noting that sticker.cateId can sometimes be 0, which is considered invalid. This provides context for the existing validation check.
@RFS-ADRENO RFS-ADRENO merged commit 3e8a8f8 into RFS-ADRENO:main Dec 12, 2025
2 checks passed
trinhsytuan added a commit to trinhsytuan/zca-js that referenced this pull request Dec 18, 2025
chore: Improve sticker cateId validation in sendSticker (RFS-ADRENO#233)
QuocMinh pushed a commit to QuocMinh/zca-js-vnzl that referenced this pull request Jan 11, 2026
* chore: Improve sticker cateId validation in sendSticker

Updated the validation for sticker.cateId to explicitly check for undefined or null values, ensuring that zero or falsy values are not incorrectly rejected.

* chore; Add comment about invalid sticker.cateId value

Added a comment noting that sticker.cateId can sometimes be 0, which is considered invalid. This provides context for the existing validation check.
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.

2 participants