Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: fields that are set to 0 are erroneously removed from request payload #370

Conversation

andy-liuu
Copy link
Contributor

@andy-liuu andy-liuu commented Sep 23, 2024

WHY are these changes introduced?

  • There are some endpoints where a param's value of 0 is a valid use case
    • e.g. InventoryLevel (for a specific location id and item id) can be set to zero using the REST admin api directly, but not using the PHP library

Fixes #271

WHAT is this pull request doing?

  • edit the param filter that's clearing out params set to zero so that only empty string params are filtered out
  • unit test

Type of change

  • Patch: Bug (non-breaking change which fixes an issue)
  • Minor: New feature (non-breaking change which adds functionality)
  • Major: Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have added a changelog entry, prefixed by the type of change noted above
  • I have added/updated tests for this change
  • I have updated the documentation for public APIs from the library (if applicable)

@andy-liuu andy-liuu self-assigned this Sep 23, 2024
@andy-liuu andy-liuu marked this pull request as ready for review September 23, 2024 19:45
src/Rest/Base.php Show resolved Hide resolved
tests/Clients/BaseRestResourceTest.php Outdated Show resolved Hide resolved
CHANGELOG.md Show resolved Hide resolved
Copy link
Contributor

@lizkenyon lizkenyon left a comment

Choose a reason for hiding this comment

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

Thank you! ⭐

@andy-liuu andy-liuu merged commit 50aeb6a into main Sep 24, 2024
7 checks passed
@andy-liuu andy-liuu deleted the andy-liuu/Fields-that-are-set-to-0-are-erroneously-removed-from-request-payload--#271 branch September 24, 2024 14:38
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.

Fields that are set to 0 are erroneously removed from request payload $params
2 participants