Skip to content

fix: preserve docs.json key order to prevent OpenAPI embed 404s#154

Merged
Leechael merged 1 commit intomainfrom
fix/pre-commit-openapi-404
Apr 10, 2026
Merged

fix: preserve docs.json key order to prevent OpenAPI embed 404s#154
Leechael merged 1 commit intomainfrom
fix/pre-commit-openapi-404

Conversation

@Leechael
Copy link
Copy Markdown
Contributor

Summary

  • Add --no-sort-keys to pretty-format-json hook so openapi key stays declared before navigation in docs.json
  • Add fail_fast: true to stop on first hook failure
  • Root cause: alphabetical sorting moves openapi after navigation (o > n), causing Mintlify to 404 embedded API pages that it encounters before finding the OpenAPI spec declaration

Test plan

  • Verify embedded API reference pages (e.g. GET /api/v1/apps) no longer 404 on the preview deployment
  • Confirm git commit with docs.json changes no longer reorders keys

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.
@Leechael Leechael merged commit f582e34 into main Apr 10, 2026
4 checks passed
@Leechael Leechael deleted the fix/pre-commit-openapi-404 branch April 10, 2026 09:10
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