Document FlowDefinition fields in the JSON schema#6198
Conversation
📝 WalkthroughWalkthroughRefactors all Pydantic model field declarations in ChangesFlowDefinition Pydantic Field metadata enrichment
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
69e5eb5 to
b69e5cc
Compare
3e57230 to
51d0ce4
Compare
adcebc8 to
5efd07c
Compare
Add a description and examples to every FlowDefinition field and standardize on `typing.Literal`, so the generated JSON schema documents itself — each action discriminator, state branch, and config option explains what it is and shows a realistic value. Examples live on individual fields only, never at the model level, which keeps the schema readable for tooling that renders field-level help. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
51d0ce4 to
fbf5570
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/crewai/tests/test_flow_definition.py`:
- Around line 82-83: In the test_flow_definition.py file, replace the hardcoded
anyOf index selection at line 82 with logic that finds the correct schema branch
by checking for the presence of the "discriminator" key instead of relying on
anyOf[0]. Iterate through the anyOf list and select the branch that contains the
"discriminator" property so the test validates behavior independently of
Pydantic's branch ordering.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 1f6f3787-067b-4b67-8666-14c3f9da45cd
📒 Files selected for processing (2)
lib/crewai/src/crewai/flow/flow_definition.pylib/crewai/tests/test_flow_definition.py
Adds a
descriptionandexamplesto every FlowDefinition field so the generated JSON schema documents itself.