Share resolved request example values - #34
Conversation
|
👋 Hello @glenn-jocher, thank you for submitting a
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
left a comment
There was a problem hiding this comment.
🔍 PR Review
Made with ❤️ by Ultralytics Actions
Reviewed the 29-line change in lib/openapi.ts. The tuple-prefix fix is sound, and the shared resolved-value path is correct for JSON/multipart bodies. One bounded compatibility regression remains for generated non-string text/* request examples; otherwise the change is focused and low risk.
💬 Posted 1 inline comment
- 📝 LOW
lib/openapi.ts:540This changes the fallback behavior for non-stringtext/*request bodies. Previously,requestBodyExampleserialized generated object/array/null values to JSON text before Python samples passed them asbody=...; now the resolved value is emitted directly, so a text body with an object/array schema becomescontent=bodywith a dict/list, and a schema-less body becomescontent=None. Preserve the text-media serialization for the fallback path while retaining direct values for JSON, multipar…
UltralyticsAssistant
left a comment
There was a problem hiding this comment.
🔍 PR Review 2
Made with ❤️ by Ultralytics Actions
Since review 1, the text/* fallback regression is addressed by retaining requestBodyExample serialization and adding focused coverage. The direct resolved-value reuse and maxItems-bounded prefixItems change remain correct, with no new concrete regressions found. LGTM.
|
🎉 PR #34 has been merged—thank you @glenn-jocher!
This focused update gives Python request samples a single resolved-value path, avoids unnecessary JSON round trips, centralizes example resolution, and keeps generated prefix items within |
Summary
maxItemswill discardThis is an output-preserving owner-level simplification identified during an independent Claude Code review of #33.
Validation
bun run test(19 tests, 358 assertions)bun run typecheckbun run lintbun run knipbun run build🛠️ PR Summary
Made with ❤️ by Ultralytics Actions
🌟 Summary
Python request samples now reuse resolved request example values directly, while shared example resolution avoids discarded tuple prefixes and duplicated precedence logic.
📊 Key Changes
pythonCodeSampleto use the resolved request body value instead of serializing and parsing a generated JSON string.requestBodyExampleValuelogic for resolving media examples, schemas, and authored examples;requestBodyExamplenow formats that value for string output.prefixItemsexamples to the array’smaxItemsbefore filling remaining entries.🎯 Purpose & Impact
maxItemsremoves.