fix: replace deprecated JSON encoding - #635
Open
NabDevs wants to merge 2 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v11 #635 +/- ##
=========================================
Coverage 68.23% 68.23%
Complexity 1363 1363
=========================================
Files 83 83
Lines 3752 3752
=========================================
Hits 2560 2560
Misses 1192 1192 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR removes usage of the deprecated GuzzleHttp\Utils::jsonEncode() helper from generated PHP API clients by switching to native json_encode(..., JSON_THROW_ON_ERROR), and updates the OpenAPI generator template plus tests to enforce the change.
Changes:
- Replace deprecated
\GuzzleHttp\Utils::jsonEncode()calls in generated API request builders withjson_encode(..., JSON_THROW_ON_ERROR). - Add test coverage to ensure generated clients no longer reference the deprecated helper and that invalid JSON payloads now throw
JsonException. - Introduce/override the OpenAPI Generator
api.mustachetemplate to generate the new encoding behavior and documentJsonException.
Reviewed changes
Copilot reviewed 2 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/Client/GeneratedJsonEncodingTest.php | Adds a safety test to ensure generated API classes don’t contain deprecated Utils::jsonEncode calls. |
| test/Client/Generated/CoreApi/ShipmentApiPostShipmentsTest.php | Adds a regression test asserting JsonException on invalid JSON payload encoding. |
| src/Client/Generated/OrderApi/Api/DefaultApi.php | Replaces deprecated JSON encoding helper with native json_encode(..., JSON_THROW_ON_ERROR) and documents JsonException. |
| src/Client/Generated/IamApi/Api/DefaultApi.php | Updates JSON encoding of form params to native json_encode(..., JSON_THROW_ON_ERROR) and documents JsonException. |
| src/Client/Generated/CoreApiPrivate/Api/ShippingRuleApi.php | Updates JSON encoding of form params/body to native json_encode(..., JSON_THROW_ON_ERROR) and documents JsonException. |
| src/Client/Generated/CoreApi/Api/WebhookApi.php | Updates JSON encoding of form params/body to native json_encode(..., JSON_THROW_ON_ERROR) and documents JsonException. |
| src/Client/Generated/CoreApi/Api/ShipmentApi.php | Updates JSON encoding of form params/body to native json_encode(..., JSON_THROW_ON_ERROR) and documents JsonException. |
| src/Client/Generated/CoreApi/Api/NotificationApi.php | Updates JSON encoding of form params/body to native json_encode(..., JSON_THROW_ON_ERROR) and documents JsonException. |
| src/Client/Generated/CoreApi/Api/DefaultApi.php | Updates JSON encoding of form params to native json_encode(..., JSON_THROW_ON_ERROR) and documents JsonException. |
| openapi/templates/api.mustache | Overrides generator template to emit native JSON encoding with JSON_THROW_ON_ERROR and add JsonException to docs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
FreekVR
approved these changes
Aug 7, 2026
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.
Replaces deprecated
GuzzleHttp\Utils::jsonEncode()calls with nativejson_encode(..., JSON_THROW_ON_ERROR)in the generated API clients and OpenAPI template.Resolves INT-1795