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.
Addresses: https://github.com/Shopify/shopify-functions/issues/394
This PR introduces a new function, minify_json, aimed at standardizing the handling of JSON data across our system's backend and Function Runner components. The primary goal is to ensure that JSON data is consistently processed in its minified form, promoting efficiency and reducing discrepancies in data handling practices between different environments.
Background:
Currently, there is an inconsistency in how JSON data is managed between our backend and the function-runner. The backend measures the size of JSON strings using
.bytesize
on minified strings. Function runner has been handling JSON data without explicit minifying the input, potentially leading to larger data sizes - could lead to issues with difference of partner machinesChanges:
add a
minify_json
Function: This function takes a byte slice as input and performs the following operations:serde_json::Value
to validate the JSON structure.serde_json::Value
-> back into a byte vector (minifying the JSON)serde_json::Value
^ might be a better way to do this 🤔
Next Steps: