Skip to content

Fix --use-generic-container-types documentation#2835

Merged
koxudaxi merged 2 commits intomainfrom
fix/use-generic-container-types-docs
Dec 28, 2025
Merged

Fix --use-generic-container-types documentation#2835
koxudaxi merged 2 commits intomainfrom
fix/use-generic-container-types-docs

Conversation

@koxudaxi
Copy link
Copy Markdown
Owner

@koxudaxi koxudaxi commented Dec 28, 2025

Summary by CodeRabbit

Release Notes

  • Documentation
    • Updated --use-generic-container-types option documentation to provide clearer guidance on container type choices, including refined examples and import recommendations.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 28, 2025

📝 Walkthrough

Walkthrough

Documentation and user-facing descriptions for the --use-generic-container-types option have been updated across multiple files. The guidance now recommends generic/abstract container types (Sequence, Mapping, FrozenSet) instead of typing.Dict/List, with clarification on conditional imports from collections.abc or typing.

Changes

Cohort / File(s) Summary
Documentation Updates
docs/cli-reference/quick-reference.md, docs/cli-reference/typing-customization.md, docs/python-version-compatibility.md
Updated descriptions and examples for --use-generic-container-types option; shifted from typing.Dict/List guidance to abstract container types (Sequence, Mapping, FrozenSet); added clarification on import source (collections.abc vs typing) and examples reflecting generic types.
Source Option Description
src/datamodel_code_generator/prompt_data.py
Updated OPTION_DESCRIPTIONS value for --use-generic-container-types from "Use typing.Dict/List instead of dict/list for container types." to "Use generic container types (Sequence, Mapping) for type hinting."
Test Documentation
tests/main/jsonschema/test_main_jsonschema.py
Updated test docstring to reflect revised guidance on generic/abstract container types and conditional import behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A container's a container, whether generic or concrete,
We've updated the guidance to make it more neat,
Sequence and Mapping now take the stage,
Abstract types flourish on documentation's page! 📚✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: updating documentation for the --use-generic-container-types option across multiple files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/use-generic-container-types-docs

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Dec 28, 2025

CodSpeed Performance Report

Merging #2835 will not alter performance

Comparing fix/use-generic-container-types-docs (54eba7e) with main (45fac78)

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

Summary

✅ 11 untouched
⏩ 98 skipped1

Footnotes

  1. 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
Copy link
Copy Markdown

codecov Bot commented Dec 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.52%. Comparing base (45fac78) to head (54eba7e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2835   +/-   ##
=======================================
  Coverage   99.52%   99.52%           
=======================================
  Files          90       90           
  Lines       13999    13999           
  Branches     1668     1668           
=======================================
  Hits        13932    13932           
  Misses         36       36           
  Partials       31       31           
Flag Coverage Δ
unittests 99.52% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
docs/cli-reference/quick-reference.md (1)

45-45: Quick reference text is fine; optional alignment with full docs

The new description is clear and matches the high-level intent. If you want tighter alignment with the detailed docs and test docstring, you could optionally:

  • Mention that it uses abstract containers and include FrozenSet, e.g.
    “Use abstract container types (Sequence, Mapping, FrozenSet) for type hinting.”

This is purely a wording polish; current text is acceptable as-is.

Also applies to: 302-302

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 45fac78 and 54eba7e.

📒 Files selected for processing (5)
  • docs/cli-reference/quick-reference.md
  • docs/cli-reference/typing-customization.md
  • docs/python-version-compatibility.md
  • src/datamodel_code_generator/prompt_data.py
  • tests/main/jsonschema/test_main_jsonschema.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: combine coverage
🔇 Additional comments (4)
tests/main/jsonschema/test_main_jsonschema.py (1)

1109-1115: Docstring accurately reflects --use-generic-container-types behavior

The updated docstring clearly explains use of abstract containers (Sequence, Mapping, FrozenSet) and the collections.abc vs typing import behavior, and it aligns with the PR’s documentation changes. No further changes needed.

docs/cli-reference/typing-customization.md (1)

2795-2800: LGTM! Documentation accurately describes the flag's behavior.

The updated description correctly clarifies that --use-generic-container-types generates abstract container types (Sequence, Mapping, FrozenSet) instead of concrete types (list, dict, set). The note about conditional imports from collections.abc vs typing based on the --use-standard-collections flag is a helpful addition.

src/datamodel_code_generator/prompt_data.py (1)

114-114: LGTM! Help text updated for consistency.

The updated option description correctly reflects the flag's behavior and is consistent with the documentation changes in the other files.

docs/python-version-compatibility.md (1)

158-176: LGTM! Clear and accurate documentation updates.

The updated description and examples correctly explain that --use-generic-container-types uses abstract container types (Sequence, Mapping, FrozenSet) instead of concrete types. The clarification about conditional imports from collections.abc when combined with --use-standard-collections is helpful, and the benefits section provides good context for when to use this option.

@koxudaxi koxudaxi merged commit 0f06a7d into main Dec 28, 2025
38 checks passed
@koxudaxi koxudaxi deleted the fix/use-generic-container-types-docs branch December 28, 2025 13:10
@github-actions
Copy link
Copy Markdown
Contributor

Breaking Change Analysis

Result: No breaking changes detected

Reasoning: This PR only corrects documentation to accurately describe what the --use-generic-container-types flag already does. The changes are limited to: (1) markdown documentation files updating descriptions and examples, (2) a help text string in prompt_data.py, and (3) a test docstring. No code generation logic, CLI behavior, default values, or API was changed. The flag behavior itself remains unchanged - the documentation was simply incorrect before and is now fixed to accurately describe that the flag uses Sequence/Mapping (not Dict/List as previously documented).


This analysis was performed by Claude Code Action

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 1, 2026

🎉 Released in 0.51.0

This PR is now available in the latest release. See the release notes for details.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant