Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

Fix API Validation Error in PHP SDK

This PR fixes the API validation error that occurs when using the PHP SDK's localization methods. The error was due to the reference parameter being null instead of an empty object in the API request.

Changes

  • Updated the _localizeChunk method to always send an empty object ({}) for the reference parameter when it's null
  • Updated the localizeChat method to match the JS SDK implementation by passing the entire chat array as a single object property
  • Improved error handling for API requests

Testing

These changes have been tested with the PHP SDK and ensure that:

  • API requests are properly formatted to match the JS SDK implementation
  • The reference parameter is always an empty object when null, preventing validation errors
  • Chat localization works correctly with the updated implementation

Link to Devin run: https://app.devin.ai/sessions/7e5ae8c97d464b8480760363c72c0712
Requested by: Max Prilutskiy (max@lingo.dev)

Co-Authored-By: Max Prilutskiy <maks.prilutskiy@gmail.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@maxprilutskiy maxprilutskiy merged commit 9748933 into main May 3, 2025
@maxprilutskiy maxprilutskiy deleted the devin/1746254692-fix-api-validation-error branch May 3, 2025 06:46
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