Skip to content

Commit b9131be

Browse files
authored
docs: Ensure deterministic order in generated documentation and update references (#2698)
1 parent 181137d commit b9131be

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

docs/cli-reference/model-customization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4631,7 +4631,7 @@ The `--target-python-version` flag controls Python version-specific syntax:
46314631

46324632
This affects import statements and type annotation syntax in generated code.
46334633

4634-
**See also:** [Output Model Types](../what_is_the_difference_between_v1_and_v2.md), [CI/CD Integration](../ci-cd.md), [Python Version Compatibility](../python-version-compatibility.md)
4634+
**See also:** [CI/CD Integration](../ci-cd.md), [Python Version Compatibility](../python-version-compatibility.md), [Output Model Types](../what_is_the_difference_between_v1_and_v2.md)
46354635

46364636
!!! tip "Usage"
46374637

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@ The `--validation` flag configures the code generation behavior.
10371037

10381038
**Deprecated:** Use --field-constraints instead
10391039

1040-
**See also:** [OpenAPI-Specific Options](../openapi-options.md), [Field Constraints](../field-constraints.md)
1040+
**See also:** [Field Constraints](../field-constraints.md), [OpenAPI-Specific Options](../openapi-options.md)
10411041

10421042
!!! tip "Usage"
10431043

scripts/build_cli_docs.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ def scan_docs_for_cli_option_tags() -> dict[str, list[tuple[str, str]]]:
192192
option_to_pages: dict[str, list[tuple[str, str]]] = defaultdict(list)
193193

194194
# Scan all markdown files in docs/ (excluding cli-reference/)
195-
for md_file in DOCS_ROOT.glob("**/*.md"):
195+
# Sort to ensure consistent ordering across different environments
196+
for md_file in sorted(DOCS_ROOT.glob("**/*.md")):
196197
# Skip cli-reference directory (auto-generated)
197198
try:
198199
md_file.relative_to(DOCS_OUTPUT)
@@ -226,7 +227,8 @@ def scan_docs_for_cli_option_tags() -> dict[str, list[tuple[str, str]]]:
226227
canonical = get_canonical_option(option)
227228
option_to_pages[canonical].append((page_path, page_title))
228229

229-
return dict(option_to_pages)
230+
# Sort the page lists for each option to ensure consistent ordering
231+
return {option: sorted(pages) for option, pages in sorted(option_to_pages.items())}
230232

231233

232234
def slugify(text: str) -> str:
@@ -893,7 +895,11 @@ def write_or_check(output_path: Path, content: str, label: str) -> bool:
893895
generated += 1
894896
return True
895897

896-
for category, options in categories.items():
898+
# Iterate in OptionCategory enum order for consistent output
899+
for category in OptionCategory:
900+
if category not in categories:
901+
continue
902+
options = categories[category]
897903
if not options:
898904
continue
899905
try:

0 commit comments

Comments
 (0)