fix: handle null values in fixture JSON parsing#1545
Open
tadhgdowdall wants to merge 5 commits intostripe:masterfrom
Open
fix: handle null values in fixture JSON parsing#1545tadhgdowdall wants to merge 5 commits intostripe:masterfrom
tadhgdowdall wants to merge 5 commits intostripe:masterfrom
Conversation
Collaborator
|
@tadhgdowdall hey this caused the linter to fail. If you can fix that we can merge after! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reviewers
r? @
cc @stripe/developer-products
Summary
I created this fix based on a previous unmerged PR and a bug which still has not been fixed
Github Issue: 1447
Fixes an issue where
nullvalues in Stripe CLI fixtures were silently dropped instead of being sent to the API.Previously, fields set to
nullwere omitted from the request, causing existing values to persist or defaults to be applied. This made it impossible to explicitly clear fields using fixtures.This change updates
ParseMapForFormDataandParseArrayForFormDatato serializenullvalues as empty form fields (""), aligning with Stripe’s API behavior where empty values indicate unsetting a field.Adds tests to verify null value handling in both simple maps and nested arrays.
Testing API Requests
1. Created temporary test fixture file (
test-null-fields.json)2. Run the fixture
Output:
3. Retrieve the customer
Before Fix Results
line2andstateare bothnull, the null values were droppedAfter Fix Results
line2andstateare now empty strings"", the null values were properly sent as empty form fields