Skip to content

docs: Comprehensive documentation improvements with CLI reference enhancements#2681

Merged
koxudaxi merged 20 commits intomainfrom
docs/comprehensive-improvements
Dec 18, 2025
Merged

docs: Comprehensive documentation improvements with CLI reference enhancements#2681
koxudaxi merged 20 commits intomainfrom
docs/comprehensive-improvements

Conversation

@koxudaxi
Copy link
Copy Markdown
Owner

@koxudaxi koxudaxi commented Dec 18, 2025

Summary

  • Add new documentation pages for better user guidance
  • Improve CLI reference with cross-linking and manual docs support
  • Reorganize navigation structure for better discoverability

Summary by CodeRabbit

  • Documentation

    • Added CI/CD Integration, One-liner Usage, Utility Options, Model Reuse, Module Exports, Type Mappings, Python Version Compatibility, OpenAPI Options, plus many cross-reference updates and a reorganized site navigation.
  • User-facing CLI

    • Documented utility flags (--help, --version, --debug, --no-color, --profile) and profile usage; clarified dataclass flag naming (now reflected as frozen-dataclasses) and updated examples.

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

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 18, 2025

Warning

Rate limit exceeded

@koxudaxi has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 3 minutes and 32 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 0dcbda1 and 4b33c50.

📒 Files selected for processing (2)
  • docs/cli-reference/general-options.md (8 hunks)
  • scripts/build_cli_docs.py (14 hunks)

Walkthrough

This PR reorganizes and expands documentation, adds manual/utility CLI docs and top-of-file metadata tags, updates mkdocs navigation, and extends the docs build tooling to detect and integrate manual docs. It also renames/aliases a CLI-docs constant to MANUAL_DOCS and updates tests and tooling to match. No runtime behavior changes.

Changes

Cohort / File(s) Summary
New Guides & Navigation
docs/ci-cd.md, docs/oneliner.md, docs/model-reuse.md, docs/openapi-options.md, docs/type-mappings.md, docs/python-version-compatibility.md, docs/module-exports.md, docs/what_is_the_difference_between_v1_and_v2.md, docs/index.md, README.md, mkdocs.yaml
Added many new doc pages and examples; reorganized site nav (grouped Usage sections, added Integration and Utility Options) and updated README/index links.
Utility Options & Manual CLI docs
docs/cli-reference/utility-options.md, docs/cli-reference/manual/debug.md, docs/cli-reference/manual/help.md, docs/cli-reference/manual/no-color.md, docs/cli-reference/manual/profile.md, docs/cli-reference/manual/version.md
Introduced a centralized Utility Options page and separate manual pages for --debug, --help, --no-color, --profile, and --version with usage, examples and notes.
CLI Reference Cross-refs & Quick refs
docs/cli-reference/{field-customization.md,general-options.md,index.md,model-customization.md,openapi-only-options.md,quick-reference.md,template-customization.md,typing-customization.md}
Inserted many "See also" cross-references and added utility options into indices and quick-reference listings.
Docs Metadata Comments
docs/{aliases.md,custom-formatters.md,custom_template.md,field-constraints.md,formatting.md,pyproject_toml.md}
Added top-of-file HTML metadata comments (<!-- related-cli-options: ... -->) to associate pages with CLI options for discovery.
Manuals & Utility Integration in Build
scripts/build_cli_docs.py
Extended docs generator to scan for related-cli-options tags, read/generate manual docs, expose MANUAL_OPTION_DESCRIPTIONS, add CLI_OPTIONS_TAG_PATTERN, MANUAL_DOCS_DIR, DOCS_ROOT, new helpers, and propagate manual docs into index/quick-reference/category generation; conditionally writes utility-options.md.
CLI options module
src/datamodel_code_generator/cli_options.py
Replaced EXCLUDED_FROM_DOCS with MANUAL_DOCS (kept alias), added is_manual_doc(), added deprecated is_excluded_from_docs() wrapper, and exposed manual-option descriptions.
Tests & test infra
tests/cli_doc/{test_cli_doc_coverage.py,test_cli_options_sync.py}, tests/conftest.py, tests/main/{jsonschema/test_main_jsonschema.py,graphql/test_main_graphql.py}, tests/main/graphql/test_main_graphql.py
Updated tests to use MANUAL_DOCS, renamed/adjusted test strings, added aliases marker validation in conftest.py, added specialized-enum tests, and replaced --frozen with --frozen-dataclasses in affected GraphQL tests.
Small docs & metadata edits
docs/faq.md, docs/cli-reference/* (various), other docs files listed in summary
Various cross-reference insertions, minor formatting adjustments, and metadata comments across many docs pages.

Sequence Diagram(s)

sequenceDiagram
    participant Docs as Markdown files
    participant Build as scripts/build_cli_docs.py
    participant CLIOpts as src/datamodel_code_generator/cli_options.py
    participant Site as Generated docs (mkdocs)

    Docs->>Build: scan for <!-- related-cli-options: ... --> tags
    Build->>CLIOpts: import MANUAL_DOCS & MANUAL_OPTION_DESCRIPTIONS
    Build->>Build: read_manual_docs() -> manual_docs
    Build->>Build: scan_docs_for_cli_option_tags() -> option_related_pages
    Build->>Build: generate_manual_docs_section(manual_docs)
    Build->>Build: generate_index_page(..., manual_docs)
    Build->>Build: generate_quick_reference(..., manual_docs)
    Build->>Site: write_or_check utility-options.md and updated category pages
    Note right of Site: mkdocs.yaml nav entries updated for Utility Options & Integration
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Focus review on: scripts/build_cli_docs.py (regex/tag scanning, new helpers, integration points), src/datamodel_code_generator/cli_options.py (MANUAL_DOCS, aliases, new functions), mkdocs.yaml nav changes, and tests updates (conftest.py marker validation and renamed imports).
  • Pay special attention to exported symbols, public API surface changes, and conditional generation/write behavior in the build script.

Possibly related PRs

Poem

🐰 I hopped through docs with a tiny thump,

Wove manual pages and a utility stump.
CI, one-liners, options neat and clear,
Build script scanned tags — the site drew near.
Hop on, coder, carrots for good cheer! 🥕

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 summarizes the primary change: comprehensive documentation improvements with CLI reference enhancements, matching the substantive changes throughout the PR.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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.

@koxudaxi koxudaxi marked this pull request as ready for review December 18, 2025 09:08
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Dec 18, 2025

CodSpeed Performance Report

Merging #2681 will not alter performance

Comparing docs/comprehensive-improvements (4b33c50) with main (18ee0c0)

Summary

✅ 52 untouched
⏩ 10 skipped1

Footnotes

  1. 10 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.

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: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/cli-reference/general-options.md (1)

1238-1245: Minor typo in pyproject link text

The link text reads pyprojecttoml Configuration but should likely be pyproject.toml Configuration to match the page title and other docs, while keeping the target ../pyproject_toml.md.

🧹 Nitpick comments (6)
docs/model-reuse.md (3)

91-91: Add language specifiers to fenced code blocks.

Multiple code blocks are missing language specifiers (e.g., bash, python). This improves readability and syntax highlighting in documentation.

🔎 Example fixes for code block language specifiers:
- Line 91:
- ```
+ ```
+ 
  models/
  ├── __init__.py
  ├── user.py        # imports from shared
  ├── order.py       # imports from shared
  └── shared.py      # SharedModel defined once
- ```
+ ```

- Line 98:
- ```
+ ```python
  # models/user.py
  from .shared import SharedModel
  ...
- ```
+ ```

- Similarly for lines 131, 226, 235: add appropriate language tags

As per markdownlint standards, fenced code blocks should specify a language for proper syntax highlighting.

Also applies to: 98-98, 131-131, 226-226, 235-235


216-216: Consider indented code block style in admonition.

Line 216 uses indented code formatting within a !!! tip admonition. Verify this is intentional, as the linter expects fenced code blocks. If this is part of an admonition, the current format may be acceptable, but consider updating for consistency.


214-214: Replace weak intensifier "very" with more specific language.

Line 214 uses "very large schemas"—consider replacing with a more precise term (e.g., "massive," "complex," "thousands-of-definitions schemas").

tests/cli_doc/test_cli_options_sync.py (1)

3-7: Update summary docstring to match MANUAL_DOCS terminology

The bullets still reference EXCLUDED_FROM_DOCS, but the tests and implementation now use MANUAL_DOCS. Please update items 2 and 3 to mention MANUAL_DOCS so the description matches the actual checks.

docs/cli-reference/general-options.md (1)

1392-1399: Apply same pyproject.toml spelling in other “See also” links

The same pyprojecttoml Configuration text appears in other “See also” lines; consider standardizing them to pyproject.toml Configuration for consistency.

Also applies to: 1600-1607

scripts/build_cli_docs.py (1)

657-660: Remove unnecessary empty pass statement.

Line 659 contains an empty pass statement that serves no purpose. If this is meant to be a placeholder for future validation logic, add a comment; otherwise, remove the conditional block entirely.

🔎 Apply this diff:
     schema_version = collection.get("schema_version", 0)
-    if schema_version != 1:
-        pass
-
     items = collection.get("items", [])
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 18ee0c0 and 02fbdb6.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (33)
  • README.md (2 hunks)
  • docs/aliases.md (1 hunks)
  • docs/ci-cd.md (1 hunks)
  • docs/cli-reference/field-customization.md (4 hunks)
  • docs/cli-reference/general-options.md (6 hunks)
  • docs/cli-reference/index.md (6 hunks)
  • docs/cli-reference/manual/debug.md (1 hunks)
  • docs/cli-reference/manual/help.md (1 hunks)
  • docs/cli-reference/manual/no-color.md (1 hunks)
  • docs/cli-reference/manual/profile.md (1 hunks)
  • docs/cli-reference/manual/version.md (1 hunks)
  • docs/cli-reference/model-customization.md (8 hunks)
  • docs/cli-reference/openapi-only-options.md (1 hunks)
  • docs/cli-reference/quick-reference.md (5 hunks)
  • docs/cli-reference/template-customization.md (6 hunks)
  • docs/cli-reference/utility-options.md (1 hunks)
  • docs/custom-formatters.md (1 hunks)
  • docs/custom_template.md (1 hunks)
  • docs/faq.md (1 hunks)
  • docs/field-constraints.md (1 hunks)
  • docs/formatting.md (1 hunks)
  • docs/index.md (1 hunks)
  • docs/model-reuse.md (1 hunks)
  • docs/oneliner.md (1 hunks)
  • docs/pyproject_toml.md (1 hunks)
  • docs/what_is_the_difference_between_v1_and_v2.md (1 hunks)
  • mkdocs.yaml (1 hunks)
  • scripts/build_cli_docs.py (13 hunks)
  • src/datamodel_code_generator/cli_options.py (3 hunks)
  • tests/cli_doc/test_cli_doc_coverage.py (3 hunks)
  • tests/cli_doc/test_cli_options_sync.py (3 hunks)
  • tests/conftest.py (2 hunks)
  • tests/main/jsonschema/test_main_jsonschema.py (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
scripts/build_cli_docs.py (1)
src/datamodel_code_generator/cli_options.py (4)
  • OptionCategory (18-27)
  • get_canonical_option (245-256)
  • get_option_meta (280-292)
  • is_manual_doc (265-268)
tests/cli_doc/test_cli_doc_coverage.py (1)
src/datamodel_code_generator/cli_options.py (1)
  • get_all_canonical_options (260-262)
🪛 LanguageTool
docs/cli-reference/general-options.md

[style] ~1681-~1681: Using many exclamation marks might seem excessive (in this case: 33 exclamation marks for a text that’s 7574 characters long)
Context: ... and Deduplication](../model-reuse.md) !!! tip "Usage" ```bash datamodel-...

(EN_EXCESSIVE_EXCLAMATION)

docs/ci-cd.md

[style] ~193-~193: Using many exclamation marks might seem excessive (in this case: 12 exclamation marks for a text that’s 3170 characters long)
Context: ...generator files: ^schemas/ ``` !!! note "Installing the hook" Ensure `...

(EN_EXCESSIVE_EXCLAMATION)

docs/cli-reference/manual/debug.md

[style] ~15-~15: Using many exclamation marks might seem excessive (in this case: 6 exclamation marks for a text that’s 279 characters long)
Context: ...--debug - the option documented here !!! warning "Requires extra dependency" ...

(EN_EXCESSIVE_EXCLAMATION)

docs/cli-reference/openapi-only-options.md

[style] ~930-~930: Using many exclamation marks might seem excessive (in this case: 15 exclamation marks for a text that’s 3552 characters long)
Context: ... Constraints](../field-constraints.md) !!! tip "Usage" ```bash datamodel-...

(EN_EXCESSIVE_EXCLAMATION)

docs/cli-reference/utility-options.md

[style] ~148-~148: Using many exclamation marks might seem excessive (in this case: 21 exclamation marks for a text that’s 1680 characters long)
Context: ...d version of datamodel-code-generator. !!! tip "Usage" ```bash datamodel-...

(EN_EXCESSIVE_EXCLAMATION)

docs/cli-reference/manual/no-color.md

[style] ~16-~16: Using many exclamation marks might seem excessive (in this case: 6 exclamation marks for a text that’s 300 characters long)
Context: ...no-color` - the option documented here !!! note "Environment variable" You ca...

(EN_EXCESSIVE_EXCLAMATION)

docs/oneliner.md

[style] ~201-~201: Using many exclamation marks might seem excessive (in this case: 15 exclamation marks for a text that’s 2716 characters long)
Context: ...enerator` | Traditional installation | !!! tip "When to use each method" - **u...

(EN_EXCESSIVE_EXCLAMATION)

docs/cli-reference/manual/profile.md

[style] ~9-~9: Using many exclamation marks might seem excessive (in this case: 3 exclamation marks for a text that’s 383 characters long)
Context: ...onfiguration](../../pyproject_toml.md) !!! tip "Usage" ```bash datamodel-...

(EN_EXCESSIVE_EXCLAMATION)

docs/cli-reference/manual/version.md

[style] ~6-~6: Using many exclamation marks might seem excessive (in this case: 3 exclamation marks for a text that’s 168 characters long)
Context: ...d version of datamodel-code-generator. !!! tip "Usage" ```bash datamodel-...

(EN_EXCESSIVE_EXCLAMATION)

docs/cli-reference/manual/help.md

[style] ~8-~8: Using many exclamation marks might seem excessive (in this case: 3 exclamation marks for a text that’s 207 characters long)
Context: ...and default values. Aliases: -h !!! tip "Usage" ```bash datamodel-...

(EN_EXCESSIVE_EXCLAMATION)

docs/model-reuse.md

[style] ~214-~214: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...on | !!! tip "Performance tip" For very large schemas, combine --reuse-model with `...

(EN_WEAK_ADJECTIVE)

🪛 markdownlint-cli2 (0.18.1)
docs/cli-reference/general-options.md

1170-1170: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1170-1170: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1244-1244: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1244-1244: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1364-1364: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1364-1364: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1398-1398: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1398-1398: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1606-1606: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1606-1606: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1680-1680: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1680-1680: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)

docs/oneliner.md

76-76: Code block style
Expected: fenced; Actual: indented

(MD046, code-block-style)


86-86: Code block style
Expected: fenced; Actual: indented

(MD046, code-block-style)


101-101: Code block style
Expected: fenced; Actual: indented

(MD046, code-block-style)


111-111: Code block style
Expected: fenced; Actual: indented

(MD046, code-block-style)


121-121: Code block style
Expected: fenced; Actual: indented

(MD046, code-block-style)


175-175: Code block style
Expected: fenced; Actual: indented

(MD046, code-block-style)

docs/model-reuse.md

91-91: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


98-98: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


131-131: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


216-216: Code block style
Expected: fenced; Actual: indented

(MD046, code-block-style)


226-226: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


235-235: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

docs/index.md

149-149: Code block style
Expected: indented; Actual: fenced

(MD046, code-block-style)

🪛 Ruff (0.14.8)
tests/cli_doc/test_cli_options_sync.py

47-47: Unused noqa directive (non-enabled: PLR6301)

Remove unused noqa directive

(RUF100)


59-59: Unused noqa directive (non-enabled: PLR6301)

Remove unused noqa directive

(RUF100)

scripts/build_cli_docs.py

222-222: Unused noqa directive (non-enabled: PLR0912, PLR0914, PLR0915)

Remove unused noqa directive

(RUF100)


725-725: Unused noqa directive (non-enabled: T201)

Remove unused noqa directive

(RUF100)

⏰ 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). (20)
  • GitHub Check: py312-isort6 on Ubuntu
  • GitHub Check: 3.12 on Ubuntu
  • GitHub Check: py312-isort7 on Ubuntu
  • GitHub Check: py312-pydantic1 on Ubuntu
  • GitHub Check: py312-black23 on Ubuntu
  • GitHub Check: py312-black22 on Ubuntu
  • GitHub Check: 3.9 on Ubuntu
  • GitHub Check: 3.11 on Ubuntu
  • GitHub Check: py312-isort5 on Ubuntu
  • GitHub Check: 3.10 on Ubuntu
  • GitHub Check: 3.10 on macOS
  • GitHub Check: 3.14 on Ubuntu
  • GitHub Check: 3.13 on Ubuntu
  • GitHub Check: 3.13 on macOS
  • GitHub Check: dev
  • GitHub Check: type
  • GitHub Check: docs
  • GitHub Check: pkg_meta
  • GitHub Check: benchmarks
  • GitHub Check: Analyze (python)
🔇 Additional comments (49)
docs/cli-reference/openapi-only-options.md (1)

929-929: Verify relative link path to field-constraints documentation.

The "See also" reference uses a relative path ../field-constraints.md. Please confirm that docs/field-constraints.md exists and the link is valid given the file structure.

docs/aliases.md (1)

1-1: Metadata comment format is consistent.

The related-cli-options metadata follows the established pattern. Ensure the metadata list matches the actual CLI options documented or referenced in this file.

docs/formatting.md (1)

1-1: Metadata comment appropriately identifies formatter-related CLI option.

The single related-cli-option (--formatters) is accurate for this formatting guide. Metadata placement and format are consistent with other documentation files.

docs/cli-reference/template-customization.md (6)

474-474: Verify relative link to custom-formatters documentation.

The "See also" reference at line 474 uses ../custom-formatters.md. Confirm this file exists in the docs/ directory relative to docs/cli-reference/template-customization.md.


550-550: Verify relative link path consistency.

Two references to ../custom-formatters.md appear in this file (lines 474 and 550). Ensure the path is consistent and valid.


612-612: Verify relative link to custom templates documentation.

The "See also" reference uses ../custom_template.md (with underscore). Confirm the filename is correct and the file exists.


1223-1223: Verify relative link to CI/CD integration documentation.

The "See also" reference at line 1223 uses ../ci-cd.md. Confirm this file exists in the docs/ directory and the link is valid.


1572-1572: Verify relative link to custom templates documentation (second occurrence).

Another "See also" reference to ../custom_template.md at line 1572. Ensure consistency with the path used elsewhere in this file and verify the file exists.


1934-1934: Verify multiple relative links in consolidated reference section.

Line 1934 contains two "See also" links to ../formatting.md and ../ci-cd.md. Confirm both files exist at those relative paths.

docs/cli-reference/manual/debug.md (1)

1-22: New utility option documentation is well-structured and informative.

The --debug documentation clearly explains the option's purpose, includes practical usage examples, and warns users about the required debug extra dependency. The structure and formatting are consistent with other documentation in the project.

docs/pyproject_toml.md (1)

1-1: Related CLI options metadata is accurate and comprehensive.

The four listed options (--ignore-pyproject, --generate-pyproject-config, --generate-cli-command, --profile) are all appropriately related to pyproject.toml configuration and appear in the file content.

docs/cli-reference/manual/no-color.md (1)

1-23: New utility option documentation provides clear guidance with environment variable support.

The --no-color documentation effectively explains the option, provides usage examples, and importantly documents the NO_COLOR environment variable alternative. This is practical information for users integrating with CI/CD systems.

docs/cli-reference/manual/version.md (1)

1-19: New utility option documentation is concise and complete.

The --version documentation appropriately keeps content brief for this simple option, provides a clear usage example, and shows sample output format. Structure is consistent with other utility option documentation.

docs/what_is_the_difference_between_v1_and_v2.md (2)

1-1: Verify related-cli-options metadata usage.

The HTML comment <!-- related-cli-options: ... --> appears to be a new pattern for cross-reference support. Confirm this is supported by the documentation build system (scripts/build_cli_docs.py or similar).


192-202: LGTM on decision tree diagram.

The Mermaid flowchart provides excellent guidance for users selecting an output model type. The decision logic is clear and covers all major use cases well.

docs/index.md (2)

149-151: Verify code block formatting style.

The linter flags line 149 as having an incorrect code block style (indented vs. fenced). The block appears correctly formatted as a fenced code block. If this is showing as an issue, verify the markdown parsing is correct for your toolchain. If intentional indentation is needed within a list context, this may be expected.


145-162: LGTM on new CI/CD and one-liner documentation sections.

The addition of --check example with disable-timestamp and the new cross-references to ci-cd.md and oneliner.md guide users effectively toward important use cases. Navigation improvements are excellent.

tests/cli_doc/test_cli_options_sync.py (1)

79-97: MANUAL_DOCS coverage logic looks correct

The new MANUAL_DOCS usage (manual = MANUAL_DOCS, covered = documented | manual) and the failure message for missing options are coherent and match the intended “documented or manually documented” invariant. No changes needed here.

README.md (1)

27-32: Nice navigation upgrades for CI/CD and one‑liners

The added CI/CD and one‑liner links, plus the --check quick recipe and pointer to the CI/CD doc, make the main README much more discoverable. No issues from a docs or accuracy standpoint.

Also applies to: 187-193

docs/cli-reference/manual/profile.md (1)

1-43: --profile manual doc is clear and consistent

The description, pyproject.toml example, and usage snippets accurately reflect how --profile works with [tool.datamodel-codegen.profiles.<name>]. No changes needed.

docs/cli-reference/general-options.md (2)

1164-1171: Good CI/CD cross‑link for --check

The new “See also: CI/CD Integration” link is well placed and accurately highlights CI use of --check. Looks good.


1674-1681: Cross‑links for model reuse and output types are helpful

The new “See also” references to Model Reuse/Deduplication and Output Model Types nicely surface deeper docs from these general options. No issues.

Also applies to: 4009-4012

docs/oneliner.md (1)

1-205: Comprehensive and accurate one‑liner usage guide

The uvx/pipx, stdin, clipboard, and API examples are well put together and match the actual CLI behavior. This page will be very useful for quick, non‑installed workflows.

docs/cli-reference/manual/help.md (1)

1-28: --help manual documentation matches CLI behavior

The description, alias list, usage example, and sample output align with the current datamodel-codegen --help. No changes needed.

docs/cli-reference/model-customization.md (2)

1203-1212: Good cross‑link from --collapse-root-models to model reuse

The added “See also: Model Reuse and Deduplication” is a sensible cross‑reference for this option and should help readers discover the reuse docs. Looks good.


1361-1362: Output‑model and CI/CD “See also” links are well chosen

The new “See also: Output Model Types” and “See also: Model Reuse and Deduplication / CI/CD Integration” lines around --dataclass-arguments, --frozen-dataclasses, --keyword-only, --output-model-type, --reuse-model, --reuse-scope, and --target-python-version are accurate and improve navigability without duplicating content.

Also applies to: 2386-2387, 2633-2634, 2965-2966, 3208-3211, 3321-3324, 4011-4012

docs/cli-reference/quick-reference.md (1)

148-157: Utility options section and index entries look correct

The new Utility Options category and the added alphabetical entries for --debug, --help, --no-color, --profile, and --version all point to the right anchors and describe the options consistently with the CLI help. No changes needed.

Also applies to: 182-183, 203-204, 214-215, 222-223, 265-265

tests/conftest.py (2)

42-46: LGTM! New aliases parameter properly integrated.

The aliases parameter addition to the cli_doc marker declaration is well-documented and follows the existing parameter pattern. The docstring clearly explains its purpose for alternative option names.


133-139: LGTM! Comprehensive validation for aliases parameter.

The validation logic correctly:

  • Allows None values (aliases are optional)
  • Enforces list type when aliases are provided
  • Validates all items are strings

This follows the same validation pattern as other list parameters like related_options.

mkdocs.yaml (1)

71-94: LGTM! Improved navigation structure enhances discoverability.

The reorganization of the Usage section into logical groups (Input Formats, Output Customization, Templates and Formatting, Integration) significantly improves documentation navigation. The new "Utility Options" entry is appropriately placed in the CLI Reference section.

docs/cli-reference/index.md (1)

18-18: LGTM! Utility Options category properly integrated into CLI reference index.

All utility option links correctly point to the new utility-options.md page with appropriate anchors. The category table entry is consistent with other categories.

Also applies to: 54-54, 87-87, 107-108, 121-121, 179-179

docs/cli-reference/utility-options.md (1)

1-164: LGTM! Comprehensive utility options documentation.

The new utility options documentation is thorough and well-structured:

  • Clear descriptions for each option
  • Practical usage examples with annotations
  • Helpful notes about requirements (e.g., debug extra, NO_COLOR env var)
  • Related configuration examples (pyproject.toml profiles)

The documentation format is consistent with other CLI reference pages and follows Material for MkDocs conventions effectively.

docs/ci-cd.md (1)

1-292: LGTM! Excellent CI/CD integration documentation.

This comprehensive guide covers all major CI/CD scenarios:

  • Clear explanation of --check flag behavior with exit codes
  • Best practice recommendation for pyproject.toml configuration
  • Examples for GitHub Actions, pre-commit hooks, GitLab CI, and Makefiles
  • Multi-profile usage patterns
  • Practical troubleshooting section

The examples are production-ready and the advice to use disable-timestamp = true and pin Python versions is valuable for reproducible builds.

tests/main/jsonschema/test_main_jsonschema.py (3)

1774-1789: LGTM! Well-documented specialized enum test.

The new test properly documents --use-specialized-enum with:

  • Clear cli_doc marker with related options
  • Descriptive docstring explaining StrEnum/IntEnum generation
  • Appropriate test implementation for Python 3.11+ targets

1804-1824: LGTM! Complementary test for disabling specialized enums.

The test for --no-use-specialized-enum correctly:

  • Documents the disable path with cli_doc marker
  • Explains the flag generates standard Enum instead of specialized types
  • Mirrors the positive test structure

897-897: LGTM! Aliases feature properly demonstrated.

The aliases=["--capitalise-enum-members"] entry demonstrates the new aliasing feature for UK/US spelling variants of the option. This is a good example of the aliases parameter usage.

src/datamodel_code_generator/cli_options.py (3)

45-56: LGTM! Clear rename with backward compatibility.

The rename from EXCLUDED_FROM_DOCS to MANUAL_DOCS better reflects the purpose (options with hand-written documentation). The backward compatibility alias ensures existing code continues to work.


156-156: LGTM! New option properly registered.

The --use-specialized-enum option is correctly added to CLI_OPTION_META with the appropriate TYPING category.


265-277: LGTM! Well-designed API evolution.

The new is_manual_doc() function has a clearer name than the old is_excluded_from_docs(). The backward compatibility wrapper with deprecation note in the docstring provides a smooth migration path.

tests/cli_doc/test_cli_doc_coverage.py (1)

21-21: LGTM! Test coverage updated for MANUAL_DOCS.

All references to the renamed symbol are updated consistently:

  • Import changed to MANUAL_DOCS
  • Test method renamed for clarity (test_documented_options_not_manual)
  • Failure messages updated to reference MANUAL_DOCS
  • Documentation calculation uses new symbol name

Also applies to: 82-89, 107-107

scripts/build_cli_docs.py (9)

34-54: LGTM!

The imports and constants are well-defined. The regex pattern correctly captures CLI options from HTML comment tags in the format <!-- related-cli-options: --option1, --option2 -->.


68-112: LGTM!

The function correctly scans markdown files for CLI option tags, properly excludes auto-generated content, and normalizes option names to their canonical forms.


237-239: LGTM!

Good defensive coding practice to use .get() for safe dictionary access, consistent with other kwargs access patterns in the function.


260-264: LGTM!

The "See also" section correctly generates cross-references to related manual documentation pages with proper relative paths.


401-405: LGTM!

The parameter is correctly threaded through the function hierarchy to enable cross-linking in option sections.

Also applies to: 422-422


516-577: LGTM!

The index page correctly integrates manual documentation options with proper linking and categorization.


580-594: LGTM!

The function correctly reads and validates manual documentation files, ensuring only recognized manual options are loaded.


597-628: LGTM!

The function correctly generates a comprehensive utility options page with table of contents and individual sections for each manual option.


663-664: LGTM!

The manual documentation integration is correctly implemented with proper fallback behavior when manual docs are absent, consistent error handling, and accurate option counting.

Also applies to: 728-750

Comment thread docs/cli-reference/model-customization.md Outdated
Comment thread scripts/build_cli_docs.py Outdated
Comment thread scripts/build_cli_docs.py Outdated
Comment thread scripts/build_cli_docs.py Outdated
Comment thread tests/cli_doc/test_cli_options_sync.py
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: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/main/graphql/test_main_graphql.py (1)

540-577: Fix critical flag mismatch: Replace --frozen with --frozen-dataclasses in test execution.

The decorator specifies --frozen-dataclasses in both cli_args (line 546) and related_options (line 552), but the actual test execution uses --frozen (line 572). The only valid flag is --frozen-dataclasses.

Update the test execution args and docstring:

         extra_args=[
             "--output-model-type",
             "dataclasses.dataclass",
-            "--frozen",
+            "--frozen-dataclasses",
             "--keyword-only",
             "--target-python-version",
             "3.10",

Also update the docstring to match:

     """Generate dataclasses with keyword-only fields (Python 3.10+).
 
     The `--keyword-only` flag generates dataclasses where all fields must be
     specified as keyword arguments (kw_only=True). This is only available for
-    Python 3.10+. When combined with `--frozen`, it creates immutable dataclasses
+    Python 3.10+. When combined with `--frozen-dataclasses`, it creates immutable dataclasses
     with keyword-only arguments, improving code clarity and preventing positional
     argument errors.
     """
♻️ Duplicate comments (4)
docs/cli-reference/model-customization.md (1)

1359-1367: Align --frozen vs --frozen-dataclasses naming in dataclass sections

The docs still mix --frozen and --frozen-dataclasses:

  • Line 1359: **Related:** \--frozen`, ...`
  • Line 2631 and the usage example at 2638: refer to --frozen.

But the options table at the top exposes --frozen-dataclasses, and the dedicated section header is ## \--frozen-dataclasses`. Unless --frozen` is a deliberate, documented alias, this is likely confusing.

Consider updating these references and the example command to use --frozen-dataclasses for consistency with the rest of the CLI docs (or explicitly mention that --frozen is an alias, if that’s the case).

Also applies to: 2627-2639

scripts/build_cli_docs.py (3)

231-231: Remove unused noqa directive.

The noqa directive references Pylint codes (PLR0912, PLR0914, PLR0915) that are not enabled in your Ruff configuration.

🔎 Apply this diff:
-def generate_option_section(  # noqa: PLR0912, PLR0914, PLR0915
+def generate_option_section(
     option: str,
     primary: dict[str, Any],
     option_related_pages: dict[str, list[tuple[str, str]]] | None = None,
 ) -> str:

436-436: Remove unused noqa directive.

The noqa directive references Pylint codes (PLR0912, PLR0915) that are not enabled in your Ruff configuration.

🔎 Apply this diff:
-def generate_quick_reference(  # noqa: PLR0912, PLR0915
+def generate_quick_reference(
     categories: dict[OptionCategory, dict[str, Any]],
     manual_docs: dict[str, str] | None = None,
 ) -> str:

718-718: Remove unused noqa directive.

The noqa: T201 directive is not needed as the Ruff rule is not enabled in your configuration.

🔎 Apply this diff:
-            print(f"Error generating {category.value}: {e}", file=sys.stderr)  # noqa: T201
+            print(f"Error generating {category.value}: {e}", file=sys.stderr)
             errors += 1
🧹 Nitpick comments (1)
docs/cli-reference/general-options.md (1)

32-33: General-option cross-links look good; minor wording tweak for pyproject docs

The new “See also” links (module exports, CI/CD, model reuse, pyproject configuration) use correct relative paths and are well-matched to each option’s purpose.

One small polish suggestion: the link text “pyprojecttoml Configuration” reads a bit odd. Consider changing it to “pyproject.toml Configuration” while keeping the same target ../pyproject_toml.md for clarity and consistency with the rest of the docs.

Also applies to: 604-605, 1174-1175, 1248-1249, 1368-1370, 1402-1404, 1610-1612, 1684-1686

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 02fbdb6 and db6e34e.

📒 Files selected for processing (15)
  • docs/cli-reference/general-options.md (8 hunks)
  • docs/cli-reference/model-customization.md (8 hunks)
  • docs/cli-reference/openapi-only-options.md (5 hunks)
  • docs/cli-reference/template-customization.md (7 hunks)
  • docs/cli-reference/typing-customization.md (10 hunks)
  • docs/module-exports.md (1 hunks)
  • docs/openapi-options.md (1 hunks)
  • docs/python-version-compatibility.md (1 hunks)
  • docs/type-mappings.md (1 hunks)
  • mkdocs.yaml (1 hunks)
  • scripts/build_cli_docs.py (13 hunks)
  • src/datamodel_code_generator/cli_options.py (2 hunks)
  • tests/cli_doc/test_cli_doc_coverage.py (3 hunks)
  • tests/conftest.py (2 hunks)
  • tests/main/graphql/test_main_graphql.py (2 hunks)
✅ Files skipped from review due to trivial changes (2)
  • docs/openapi-options.md
  • docs/python-version-compatibility.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/cli-reference/template-customization.md
🧰 Additional context used
🧬 Code graph analysis (2)
tests/cli_doc/test_cli_doc_coverage.py (1)
src/datamodel_code_generator/cli_options.py (1)
  • get_all_canonical_options (259-261)
scripts/build_cli_docs.py (1)
src/datamodel_code_generator/cli_options.py (3)
  • OptionCategory (18-27)
  • get_canonical_option (244-255)
  • is_manual_doc (264-267)
🪛 LanguageTool
docs/cli-reference/openapi-only-options.md

[style] ~938-~938: Using many exclamation marks might seem excessive (in this case: 15 exclamation marks for a text that’s 3759 characters long)
Context: ... Constraints](../field-constraints.md) !!! tip "Usage" ```bash datamodel-...

(EN_EXCESSIVE_EXCLAMATION)

docs/cli-reference/general-options.md

[style] ~1685-~1685: Using many exclamation marks might seem excessive (in this case: 33 exclamation marks for a text that’s 7660 characters long)
Context: ... and Deduplication](../model-reuse.md) !!! tip "Usage" ```bash datamodel-...

(EN_EXCESSIVE_EXCLAMATION)

🪛 markdownlint-cli2 (0.18.1)
docs/module-exports.md

81-81: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


151-151: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

docs/cli-reference/general-options.md

32-32: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


32-32: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


604-604: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


604-604: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1174-1174: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1174-1174: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1248-1248: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1248-1248: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1368-1368: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1368-1368: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1402-1402: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1402-1402: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1610-1610: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1610-1610: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1684-1684: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1684-1684: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)

docs/cli-reference/typing-customization.md

605-605: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


605-605: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


887-887: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


887-887: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


950-950: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


950-950: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1063-1063: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1063-1063: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1128-1128: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1128-1128: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1199-1199: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1199-1199: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1273-1273: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1273-1273: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1566-1566: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1566-1566: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1638-1638: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1638-1638: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1949-1949: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)


1949-1949: Strong style
Expected: underscore; Actual: asterisk

(MD050, strong-style)

🪛 Ruff (0.14.8)
tests/cli_doc/test_cli_doc_coverage.py

82-82: Unused noqa directive (non-enabled: PLR6301)

Remove unused noqa directive

(RUF100)


104-104: Unused noqa directive (non-enabled: PLR6301)

Remove unused noqa directive

(RUF100)

scripts/build_cli_docs.py

231-231: Unused noqa directive (non-enabled: PLR0912, PLR0914, PLR0915)

Remove unused noqa directive

(RUF100)


436-436: Unused noqa directive (non-enabled: PLR0912, PLR0915)

Remove unused noqa directive

(RUF100)


718-718: Unused noqa directive (non-enabled: T201)

Remove unused noqa directive

(RUF100)

tests/conftest.py

50-50: Unused noqa directive (non-enabled: PLR0912, PLR0914)

Remove unused noqa directive

(RUF100)

⏰ 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). (2)
  • GitHub Check: benchmarks
  • GitHub Check: 3.11 on macOS
🔇 Additional comments (14)
tests/main/graphql/test_main_graphql.py (1)

477-509: LGTM: Metadata correctly updated to reference --frozen-dataclasses.

The related_options update at line 487 properly reflects the renamed CLI flag for documentation cross-referencing purposes. Since this test doesn't use the frozen flag in its execution, the change is purely metadata and appears correct.

docs/cli-reference/openapi-only-options.md (1)

24-25: Cross-links to OpenAPI options look correct

All added “See also: OpenAPI-Specific Options” references use the right relative path (../openapi-options.md) and are consistently placed after the option descriptions. No issues from a docs/structure perspective.

Also applies to: 116-117, 577-578, 655-656, 937-938

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

605-606: Typing customization cross-links are consistent and well-targeted

The added “See also” links all point to the right companion docs (../python-version-compatibility.md and ../type-mappings.md) and are attached to options where that extra context is actually useful (--output-datetime-class, --strict-types, --type-mappings, container-type switches, pendulum usage, union/Annotated options). No structural or correctness issues spotted.

Also applies to: 887-888, 950-951, 1063-1064, 1128-1129, 1199-1200, 1273-1274, 1566-1567, 1638-1639, 1949-1950

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

1211-1212: Model-customization See also links are well-aligned

All the added “See also” references here (to model reuse, output model types, Python version compatibility, CI/CD) are correctly linked and attached to the right options (--collapse-root-models, --frozen-dataclasses, --keyword-only, --output-model-type, --reuse-model, --reuse-scope, --target-python-version). From a navigation and structure standpoint this looks solid.

Also applies to: 2386-2387, 2633-2634, 2965-2966, 3210-3211, 3323-3324, 4011-4012

mkdocs.yaml (1)

71-98: LGTM! Excellent navigation improvements.

The reorganization into logical groups (Input Formats, Output Customization, Templates and Formatting, Integration) significantly improves discoverability and user experience. The addition of the Utility Options section complements the new manual docs support.

tests/cli_doc/test_cli_doc_coverage.py (1)

21-89: LGTM! Consistent rename to MANUAL_DOCS.

The rename from EXCLUDED_FROM_DOCS to MANUAL_DOCS improves clarity—these options have manual documentation rather than being "excluded." The backward-compatibility alias in cli_options.py ensures no breaking changes.

src/datamodel_code_generator/cli_options.py (2)

45-56: LGTM! Clean backward-compatible rename.

The rename from EXCLUDED_FROM_DOCS to MANUAL_DOCS better conveys intent—these options have hand-written documentation. The backward-compatibility alias ensures existing code continues to work.


264-276: LGTM! Proper backward-compatible helper functions.

The new is_manual_doc() function with its backward-compatible wrapper is_excluded_from_docs() maintains API compatibility while improving naming clarity. Both correctly canonicalize options before checking.

tests/conftest.py (1)

42-46: LGTM! Clean addition of aliases parameter.

The new aliases parameter for the cli_doc marker is well-integrated, with proper validation that ensures it's a list of strings when provided. The validation logic is consistent with existing parameter checks.

Also applies to: 133-139

scripts/build_cli_docs.py (5)

34-38: LGTM! Clean integration of manual docs support.

The imports and constants properly establish the infrastructure for manual documentation. The MANUAL_OPTION_DESCRIPTIONS dict provides user-friendly descriptions for utility options.

Also applies to: 67-74


77-121: LGTM! Well-implemented cross-reference scanning.

The scan_docs_for_cli_option_tags() function effectively extracts CLI option references from markdown files to enable "See also" links. The logic correctly:

  • Skips auto-generated cli-reference docs
  • Extracts page titles from H1 headings
  • Canonicalizes option names
  • Returns relative paths from docs/ root

231-274: LGTM! Enhanced option section with cross-linking.

The updated generate_option_section() now includes:

  • Aliases support (lines 246-248)
  • Cross-references to related manual pages (lines 269-273)

The "See also" links improve documentation discoverability.


581-621: LGTM! Clean manual docs loading and rendering.

The read_manual_docs() and generate_manual_docs_section() functions properly:

  • Load manual markdown files from the manual/ directory
  • Filter by MANUAL_DOCS set
  • Generate a consistent utility options page
  • Handle empty cases gracefully

656-683: LGTM! Comprehensive manual docs integration in build flow.

The build_docs() function now:

  • Loads manual docs via read_manual_docs()
  • Scans for CLI option cross-references
  • Passes manual docs to all generation functions
  • Generates the utility-options.md page
  • Adjusts option counts to include manual docs

The integration maintains backward compatibility when manual docs are absent.

Also applies to: 721-743

Comment thread docs/module-exports.md Outdated
Comment thread docs/module-exports.md Outdated
Comment thread docs/type-mappings.md
Comment thread tests/cli_doc/test_cli_doc_coverage.py
Comment thread tests/conftest.py
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.52%. Comparing base (18ee0c0) to head (4b33c50).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2681   +/-   ##
=======================================
  Coverage   99.52%   99.52%           
=======================================
  Files          79       79           
  Lines       11172    11174    +2     
  Branches     1348     1348           
=======================================
+ Hits        11119    11121    +2     
  Misses         32       32           
  Partials       21       21           
Flag Coverage Δ
unittests 99.52% <100.00%> (+<0.01%) ⬆️

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: 1

🧹 Nitpick comments (3)
pyproject.toml (2)

174-181: Consider refactoring complex scripts.

The complexity rule ignores (PLR0912, PLR0914, PLR0915) suggest that scripts in scripts/*.py may have high complexity. While acceptable for build scripts, consider refactoring complex scripts into smaller functions or modules to improve maintainability.


174-181: Consider narrowing the blanket "S" security ignore for scripts to specific rules where necessary.

The scripts in scripts/*.py use subprocess.run() with an argument list (not shell=True) and perform standard file I/O—both secure patterns. Ignoring all Bandit security rules is unnecessarily broad. Ignoring rules indiscriminately diminishes the value of the linter, and you should only ignore rules that are truly necessary. Instead, whitelist only the specific rules that genuinely conflict with build script requirements (e.g., S101 for assert usage if tests are run), allowing legitimate security checks to remain active.

scripts/build_cli_docs.py (1)

650-652: Consider logging a warning on schema version mismatch.

The version check currently does nothing when schema_version != 1. Adding a warning would aid debugging if the schema format changes.

🔎 Suggested improvement:
     schema_version = collection.get("schema_version", 0)
     if schema_version != 1:
-        pass
+        print(f"Warning: Unexpected schema version {schema_version}, expected 1", file=sys.stderr)
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1cdb2dd and 1e26c34.

📒 Files selected for processing (2)
  • pyproject.toml (1 hunks)
  • scripts/build_cli_docs.py (14 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
scripts/build_cli_docs.py (1)
src/datamodel_code_generator/cli_options.py (4)
  • OptionCategory (18-27)
  • get_canonical_option (244-255)
  • get_option_meta (279-291)
  • is_manual_doc (264-267)
🪛 Ruff (0.14.8)
scripts/build_cli_docs.py

626-626: subprocess call: check for execution of untrusted input

(S603)

⏰ 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). (10)
  • GitHub Check: 3.9 on Windows
  • GitHub Check: 3.12 on Windows
  • GitHub Check: 3.13 on Windows
  • GitHub Check: 3.11 on Windows
  • GitHub Check: 3.11 on macOS
  • GitHub Check: 3.12 on macOS
  • GitHub Check: 3.10 on Windows
  • GitHub Check: 3.10 on macOS
  • GitHub Check: 3.13 on macOS
  • GitHub Check: benchmarks
🔇 Additional comments (7)
scripts/build_cli_docs.py (7)

52-74: LGTM!

The CLI_OPTIONS_TAG_PATTERN regex correctly captures CLI options from markdown comments, and MANUAL_OPTION_DESCRIPTIONS is properly extracted as a module-level constant (addressing the previous review feedback).


77-121: Well-structured function for cross-referencing CLI options.

The approach using relative_to() for path exclusion is valid. The function correctly maps CLI options to documentation pages that reference them via the HTML comment tags.


269-273: Cross-linking implementation looks correct.

The relative path construction ../{page_path} correctly navigates from docs/cli-reference/*.md to other documentation pages, since page_path is relative to docs/.


581-595: LGTM!

The function correctly filters manual documentation files against the MANUAL_DOCS set from cli_options, ensuring only registered manual options are included.


598-621: Clean implementation of the utility options page generator.

The function correctly handles empty input, generates a structured table of contents, and properly concatenates manual documentation content with separators.


624-635: LGTM!

The static analysis warning (S603) about untrusted subprocess input is a false positive here—all arguments are hardcoded strings and sys.executable, with no user-controlled input.


682-739: Well-integrated manual documentation support.

The integration correctly:

  • Scans for CLI option tags and passes them to category page generation
  • Includes manual docs in index and quick reference pages
  • Accurately calculates total option count including manual docs

Comment thread scripts/build_cli_docs.py
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: 1

♻️ Duplicate comments (1)
tests/cli_doc/test_cli_options_sync.py (1)

47-47: Remove unused # noqa: PLR6301 directives.

These # noqa: PLR6301 markers are flagged as unused by Ruff (RUF100) since PLR6301 is not enabled in the linter configuration.

Also applies to: 59-59

🧹 Nitpick comments (1)
docs/model-reuse.md (1)

214-214: Consider replacing the over-used intensifier "very."

The phrase "very large schemas" (line 214) uses an intensifier that could be strengthened. Consider alternatives such as "extremely large schemas," "massive schemas," or simply removing the modifier if context is sufficient.

📜 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 2b6276c and 0dcbda1.

📒 Files selected for processing (3)
  • .coderabbit.yaml (1 hunks)
  • docs/model-reuse.md (1 hunks)
  • tests/cli_doc/test_cli_options_sync.py (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
tests/cli_doc/test_cli_options_sync.py (1)
src/datamodel_code_generator/cli_options.py (1)
  • get_all_canonical_options (259-261)
🪛 LanguageTool
docs/model-reuse.md

[style] ~214-~214: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...on | !!! tip "Performance tip" For very large schemas, combine --reuse-model with `...

(EN_WEAK_ADJECTIVE)

🪛 markdownlint-cli2 (0.18.1)
docs/model-reuse.md

216-216: Code block style
Expected: fenced; Actual: indented

(MD046, code-block-style)

🪛 Ruff (0.14.8)
tests/cli_doc/test_cli_options_sync.py

47-47: Unused noqa directive (non-enabled: PLR6301)

Remove unused noqa directive

(RUF100)


59-59: Unused noqa directive (non-enabled: PLR6301)

Remove unused noqa directive

(RUF100)

⏰ 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). (19)
  • GitHub Check: py312-pydantic1 on Ubuntu
  • GitHub Check: py312-isort6 on Ubuntu
  • GitHub Check: py312-isort5 on Ubuntu
  • GitHub Check: 3.11 on Windows
  • GitHub Check: 3.10 on macOS
  • GitHub Check: 3.11 on macOS
  • GitHub Check: 3.10 on Windows
  • GitHub Check: py312-black24 on Ubuntu
  • GitHub Check: 3.12 on Windows
  • GitHub Check: 3.11 on Ubuntu
  • GitHub Check: 3.9 on Windows
  • GitHub Check: 3.14 on macOS
  • GitHub Check: 3.9 on macOS
  • GitHub Check: 3.9 on Ubuntu
  • GitHub Check: 3.13 on macOS
  • GitHub Check: 3.13 on Windows
  • GitHub Check: 3.14 on Windows
  • GitHub Check: 3.14 on Ubuntu
  • GitHub Check: benchmarks
🔇 Additional comments (6)
tests/cli_doc/test_cli_options_sync.py (1)

1-97: LGTM! Semantic improvements through consistent renaming.

The renaming from EXCLUDED_FROM_DOCS to MANUAL_DOCS improves clarity about the purpose of these options. All references have been consistently updated across docstrings, test method names, variable references, and error messages while preserving the test logic.

.coderabbit.yaml (1)

1-1: LGTM! Schema reference is correctly configured.

The YAML language server directive properly references the CodeRabbit v2 schema, enabling IDE validation and autocomplete for this configuration file.

docs/model-reuse.md (4)

213-218: Verify code block formatting within MkDocs admonitions.

The static analysis tool flagged line 216 as using an indented code block when a fenced code block is expected. However, within MkDocs admonition blocks (!!! tip), indented code formatting is typically required. Please verify the rendered output displays the code block correctly in the final documentation.


3-251: Excellent documentation structure and comprehensive coverage.

The file provides clear, well-organized documentation with:

  • Quick reference table (lines 9–15) for immediate understanding
  • Detailed sections with before/after comparisons
  • Real-world multi-file and single-file use cases
  • Practical performance considerations
  • Helpful "Combining Options" guidance for different project scales

The examples are clear and the output structure comparisons (lines 222–242) effectively illustrate the benefits of deduplication.


246-251: All cross-referenced documentation paths and sections are valid. The files exist at the specified locations (cli-reference/model-customization.md and root-model-and-type-alias.md), and all anchor links (#reuse-model, #reuse-scope, #collapse-root-models) are properly defined in the documentation.


1-1: No action required. The <!-- related-cli-options: ... --> metadata tag format is already consistently applied across the documentation (13+ files), and this file adheres to the established pattern.

Likely an incorrect or invalid review comment.

Comment thread .coderabbit.yaml
@koxudaxi koxudaxi merged commit 5c25e38 into main Dec 18, 2025
41 checks passed
@koxudaxi koxudaxi deleted the docs/comprehensive-improvements branch December 18, 2025 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant