feat(php): add support for deep object query parameters #11765
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.
Description
Refs: Requested by @iamnamananand996
Adds support for deep object query parameters in the PHP SDK generator. Nested objects in query parameters are now encoded using bracket notation (e.g.,
filter[user][name]=john&filter[user][age]=30), matching the OpenAPI 3.0 deepObject serialization style.This brings PHP in line with Python, Java, and C# generators which already support this feature.
Link to Devin run: https://app.devin.ai/sessions/64b3914c128f4cfa957eaab189b9c426
Changes Made
flattenQueryParams()method toRawClient.Template.phpthat recursively flattens nested arrays into query parameter format with bracket notationencodeQuery()to use the new flattening methodfilter[name]=john)filter[user][name]=john)objects[key]=hello&objects[value]=world)Testing
Updates Since Last Revision
Human Review Checklist
flattenQueryParamscorrectly distinguishes between associative arrays (objects) and sequential arrays (lists) usingisSequential()%5Band%5D)