Skip to content

Conversation

@iamnamananand996
Copy link
Member

Description

Refs: Related to PHP implementation in #11765

Adds deep object query parameter encoding support to the Rust SDK generator. This enables nested objects to be serialized using bracket notation (e.g., filter[name]=john&filter[age]=30) following the OpenAPI 3.0 deepObject serialization style.

Link to Devin run: https://app.devin.ai/sessions/64b3914c128f4cfa957eaab189b9c426
Requested by: @iamnamananand996

Changes Made

  • Added serialize_deep_object<T> method to QueryBuilder for encoding nested objects with bracket notation
  • Added serialize_deep_object_array<T> method for handling arrays of nested objects
  • Added flatten_json_value helper function that recursively flattens JSON values into query parameter format
  • Added json_value_to_string helper for converting JSON primitives to strings
  • Added comprehensive unit tests covering:
    • Simple nested objects
    • Deeply nested objects
    • Arrays (exploded format)
    • Arrays of objects
    • Mixed nested objects with arrays
    • None/null value handling

Testing

  • Unit tests added/updated
  • Manual testing completed

Human Review Checklist

  • Verify flatten_json_value correctly handles recursive object/array structures
  • Confirm the bracket notation format matches OpenAPI deepObject serialization spec
  • Note: This PR adds the capability to QueryBuilder but does not update the generator to automatically use these methods - that would be a follow-up change

@devin-ai-integration
Copy link
Contributor

🤖 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

@github-actions
Copy link
Contributor

🌱 Seed Test Selector

Select languages to run seed tests for:

  • Python
  • TypeScript
  • Java
  • Go
  • Ruby
  • C#
  • PHP
  • Swift
  • Rust
  • OpenAPI
  • Postman

How to use: Click the ⋯ menu above → "Edit" → check the boxes you want → click "Update comment". Tests will run automatically and snapshots will be committed to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants