From efffaa7589baa95755243f8b97c0e3a327a29016 Mon Sep 17 00:00:00 2001 From: Leechael Yim Date: Fri, 10 Apr 2026 16:53:03 +0800 Subject: [PATCH] fix: preserve docs.json key order to prevent OpenAPI embed 404s pretty-format-json was sorting keys alphabetically, moving the `openapi` field to after `navigation` (o > n). Mintlify parses docs.json sequentially, so when it processes `GET /api/v1/...` navigation entries before encountering the `openapi` spec declaration, those embedded API pages return 404. Add --no-sort-keys to freeze the author-controlled ordering, ensuring `openapi` stays declared before `navigation`. Also add fail_fast: true so hooks stop on first failure rather than running all checks on already-broken files. --- .pre-commit-config.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7c6198d0..0fac27cb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,5 @@ +fail_fast: true + repos: # Built-in hooks for basic file validation - repo: https://github.com/pre-commit/pre-commit-hooks @@ -18,7 +20,9 @@ repos: rev: v4.4.0 hooks: - id: pretty-format-json - args: [--autofix, --indent=2] + # --no-sort-keys preserves author-controlled ordering (notably the + # `openapi` field position); we only normalize indentation. + args: [--autofix, --indent=2, --no-sort-keys] files: ^docs\.json$ # Local hooks for Mintlify-specific validation