Fix auto CSV fallback#3536
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (6)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughModifies ChangesCSV auto-detection
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
|
📚 Docs Preview: https://pr-3536.datamodel-code-generator.pages.dev |
Merging this PR will improve performance by 48.32%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | WallTime | test_perf_large_models_pydantic_v2 |
3.6 s | 2.4 s | +51.93% |
| ⚡ | WallTime | test_perf_duplicate_names |
1,057.9 ms | 700 ms | +51.13% |
| ⚡ | WallTime | test_perf_all_options_enabled |
5.5 s | 3.6 s | +50.44% |
| ⚡ | WallTime | test_perf_deep_nested |
5.2 s | 3.4 s | +50.22% |
| ⚡ | WallTime | test_perf_complex_refs |
2 s | 1.3 s | +50.09% |
| ⚡ | WallTime | test_perf_openapi_large |
3 s | 2 s | +49.93% |
| ⚡ | WallTime | test_perf_graphql_style_pydantic_v2 |
803 ms | 537.7 ms | +49.34% |
| ⚡ | WallTime | test_perf_aws_style_openapi_pydantic_v2 |
1.9 s | 1.3 s | +46.19% |
| ⚡ | WallTime | test_perf_stripe_style_pydantic_v2 |
2 s | 1.4 s | +45.45% |
| ⚡ | WallTime | test_perf_kubernetes_style_pydantic_v2 |
2.6 s | 1.8 s | +44.84% |
| ⚡ | WallTime | test_perf_multiple_files_input |
3.4 s | 2.4 s | +42.33% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing fix-auto-csv-fallback (1b96f0b) with main (4f20c04)
Footnotes
-
98 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3536 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 159 160 +1
Lines 34268 34344 +76
Branches 4001 4011 +10
=========================================
+ Hits 34268 34344 +76
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@scripts/build_schema_docs.py`:
- Line 157: The CSV auto-detection description in the InputFileType.CSV entry is
too narrow and should match the actual heuristic used by the detector. Update
the wording in the schema docs generator so it describes any text with at least
two non-empty lines that share the same comma count, and keep the explicit `csv`
mention; use the InputFileType.CSV mapping in build_schema_docs.py as the place
to rephrase it.
In `@src/datamodel_code_generator/__init__.py`:
- Around line 1570-1584: The _looks_like_csv_text helper returns too early after
the first pair of matching comma counts, so it can misclassify multi-line text
as CSV-like before checking the rest. Update the logic in _looks_like_csv_text
to keep scanning all non-empty lines and require every line to match the same
comma count established from the first non-empty line. Preserve the existing
zero-comma rejection and use the current line-count tracking in the function to
validate consistency across the full input.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b9d69192-a6b7-4ff6-9da3-076ca3234450
⛔ Files ignored due to path filters (3)
docs/llms-full.txtis excluded by none and included by nonetests/data/expected/schema_docs/input_format_guide.txtis excluded by!tests/data/**/*.txtand included by nonetests/data/yaml/broken.yamlis excluded by!tests/data/**/*.yamland included by none
📒 Files selected for processing (7)
docs/supported-data-types.mddocs/supported_formats.mdscripts/build_schema_docs.pysrc/datamodel_code_generator/__init__.pytests/main/test_main_csv.pytests/test_infer_input_type.pytests/test_yaml_backend.py
Breaking Change AnalysisResult: Breaking changes detected Reasoning: The core change alters the observable behavior of Content for Release NotesDefault Behavior Changes
Error Handling Changes
This analysis was performed by Claude Code Action |
|
🎉 Released in 0.67.0 This PR is now available in the latest release. See the release notes for details. |
Summary by CodeRabbit