Repository navigation
List union body key sets in generated Python docstrings - #55
glenn-jocher merged 3 commits into
Conversation
|
👋 Hello @JaviChulvi, 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 Python docstring union rendering and shared schema helper/type update. The new filtering can misdocument valid schemas using boolean or referenced not subschemas; otherwise, the change follows the existing union-detection path.
💬 Posted 1 inline comment
- 📝 LOW
lib/generators/python.ts:214This treats any emptynotvalue as forbidding the key. A validnot: falseschema has no enumerable keys but allows the property, so the generated docs omit an accepted field. Conversely,not: { $ref: ... }referencing an empty schema is not resolved here and remains listed even though it forbids all values. Resolve and classify thenotsubschema—including boolean schemas—before filtering;JsonSchema.notshould also allow boolean schemas.
UltralyticsAssistant
left a comment
There was a problem hiding this comment.
🔍 PR Review 2
Made with ❤️ by Ultralytics Actions
Since review 1, the not filter now handles boolean schemas and resolves referenced schemas, addressing the earlier finding. The Python docstring rendering and shared union detection look correct; no remaining actionable issues. LGTM.
glenn-jocher
left a comment
There was a problem hiding this comment.
LGTM at 5f13eab. Cold full-diff review: shared union fields now use the existing object-schema composition owner; no application-specific logic or remaining findings. Verified 20 tests, deterministic regeneration, typecheck, lint, knip, build, Python compilation and Ruff, plus generated Platform body help and a shared-required-field probe.
Why
The Platform agent (AutoTrain) runs
ul cloud. In chat analytics (2,236 calls, 2026-09-10 to 2026-09-23), about 75 help calls (3.4%) went to operations that take abody=union:datasets create-batch27,datasets ingest26,models create22.For these arguments the generated docstring, and so CLI help, showed only
body (dict[str, Any]). Those help calls taught nothing, and agents guessed bodies. For example, they sentingestwith"split", which the API silently ignores; the real key istargetSplit.Change
Arguments whose schema is a union of objects now list each accepted object, with
?for optional keys and literal values:not: trueor an emptynot, after resolving$ref) are left out.pythonType.Evaluation
modelId: "yolo26s.pt"still need the skill'sul://example.Union help also preserves shared properties and required fields declared alongside the union.