Skip to content

Send multipart arrays as repeated fields in cURL and Try it - #61

Merged
glenn-jocher merged 1 commit into
mainfrom
fix/multipart-array-fields
Nov 26, 2026
Merged

glenn-jocher merged 1 commit into
mainfrom
fix/multipart-array-fields

Conversation

@glenn-jocher

@glenn-jocher glenn-jocher commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

A multipart upload with {"tags":["blue","green"]} produced one text field containing the JSON array. Both the copied cURL command and the documentation’s Send request button now send one part per tag, in order.

Input Before After
Two tags tags=["blue","green"] tags=blue and tags=green
Empty tags array One tags=[] part Zero tag parts
Object field One JSON-encoded part One JSON-encoded part

The two documentation paths reuse the form entry serializer. URL-encoded objects still expand into individual keys, multipart objects stay under their field name, and a selected file is sent once.

Verified with a loopback HTTP receiver and a real Chromium session on the built example site. The displayed cURL and the browser request carried both tag parts, a file and a literal @literal text value. Generation, typecheck, lint, knip, all 21 tests, the production build, Python compilation and Ruff passed.

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Updated cURL generation and the documentation’s Send request behavior to serialize multipart array values as repeated fields in input order.

📊 Key Changes

  • Reused the form-entry serializer for generated cURL and browser requests, emitting one field per array item.
  • Kept multipart objects as one JSON-encoded field, while URL-encoded objects continue to expand into individual keys.
  • Empty arrays produce no fields, and selected files are added once.

🎯 Purpose & Impact

  • Multipart uploads with array values now send separate parts for each item in both request workflows, instead of one part containing a JSON array.

@UltralyticsAssistant UltralyticsAssistant added bug Something isn't working fixed Bug has been resolved labels Nov 26, 2026
@UltralyticsAssistant

Copy link
Copy Markdown
Member

👋 Hello @glenn-jocher, thank you for submitting a ultralytics/openapi 🚀 PR! This automated message confirms your contribution was received, and an Ultralytics engineer will assist with the review. To ensure a seamless integration of your work, please review the following checklist:

  • ✅ Define a Purpose: Clearly explain the purpose of your fix or feature in your PR description, and link to any relevant issues. Ensure your commit messages are clear, concise, and adhere to the project's conventions.
  • ✅ Synchronize with Source: Confirm your PR is synchronized with the ultralytics/openapi main branch. If it's behind, update it by clicking the 'Update branch' button or by running git pull and git merge main locally.
  • ✅ Ensure CI Checks Pass: Verify all Ultralytics Continuous Integration (CI) checks are passing. If any checks fail, please address the issues.
  • ✅ Update Documentation: Update the relevant documentation for any new or modified features.
  • ✅ Add Tests: If applicable, include or update tests to cover your changes, and confirm that all tests are passing.
  • ✅ Sign the CLA: Please ensure you have signed our Contributor License Agreement if this is your first Ultralytics PR; the CLA check will comment with signing instructions if needed.
  • ✅ Minimize Changes: Limit your changes to the minimum necessary for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." — Bruce Lee

For more guidance, please refer to our Contributing Guide. Don't hesitate to leave a comment if you have any questions. Thank you for contributing to Ultralytics! 🚀

@UltralyticsAssistant UltralyticsAssistant left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 PR Review

Made with ❤️ by Ultralytics Actions

Reviewed the multipart and URL-encoded serialization changes in lib/openapi.ts and traced their cURL and Try it call paths. The repeated-field behavior is consistent, and I found no concrete regressions. LGTM.

@glenn-jocher
glenn-jocher merged commit 9810331 into main Nov 26, 2026
7 checks passed
@glenn-jocher
glenn-jocher deleted the fix/multipart-array-fields branch November 26, 2026 20:15
@UltralyticsAssistant

Copy link
Copy Markdown
Member

🎉 This PR has been merged—thank you, @glenn-jocher, for aligning cURL and browser requests to send multipart array values as repeated fields in input order.

“Alone we can do so little; together we can do so much.” — Helen Keller

Sharing the form-entry serializer keeps multipart array handling consistent across both workflows.

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

Labels

bug Something isn't working fixed Bug has been resolved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants