Skip to content

Commit 6e7d75f

Browse files
committed
fix(docs): inject required frontmatter and fix naming collisions in generated API docs
The generate-docs.ts script was overwriting MDX files without the url, metaTitle, and metaDescription frontmatter fields required by source.config.ts. Additionally, the naming function produced identical filenames for list and get-by-id operations (e.g., both GET /v1/projects and GET /v1/projects/{id} mapped to get-projects.mdx), causing content corruption and data loss. Changes: - Extend beforeWrite hook to derive and inject url, metaTitle, metaDescription from the operation metadata - Use slice-based content replacement instead of String.replace to prevent content corruption - Fix naming regex (By[A-Z][a-z]* → By[A-Z][a-z]{2,}) so ById is preserved as -by-id, preventing list/detail filename collisions - Add pre-commit frontmatter validation step to the sync workflow - Add stale file cleanup step before generation - Update meta.json navigation files for new and renamed pages
1 parent cdf8696 commit 6e7d75f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+303
-67
lines changed

.github/workflows/sync-management-api-docs.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,29 @@ jobs:
3535
working-directory: apps/docs
3636
run: pnpm fetch-openapi
3737

38+
- name: Clean stale endpoint files
39+
run: find apps/docs/content/docs/management-api/endpoints -name '*.mdx' -type f -delete
40+
3841
- name: Generate docs
3942
working-directory: apps/docs
4043
run: pnpm tsx scripts/generate-docs.ts
4144

45+
- name: Validate generated frontmatter
46+
run: |
47+
missing=$(find apps/docs/content/docs/management-api/endpoints -name '*.mdx' -type f -exec sh -c '
48+
for field in url metaTitle metaDescription; do
49+
if ! grep -q "^${field}:" "$1"; then
50+
echo "$1: missing $field"
51+
fi
52+
done
53+
' _ {} \;)
54+
if [ -n "$missing" ]; then
55+
echo "::error::Generated MDX files have missing required frontmatter fields:"
56+
echo "$missing"
57+
exit 1
58+
fi
59+
echo "All generated MDX files have required frontmatter fields"
60+
4261
- name: Check for changes
4362
id: changes
4463
run: |

apps/docs/content/docs/management-api/endpoints/connections/delete-connections.mdx renamed to apps/docs/content/docs/management-api/endpoints/connections/delete-connections-by-id.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ _openapi:
99
headings: []
1010
contents:
1111
- content: Deletes the connection with the given ID.
12+
url: /management-api/endpoints/connections/delete-connections-by-id
13+
metaTitle: 'DELETE /v1/connections/{id} | Delete connection - Prisma Postgres'
14+
metaDescription: 'Management API: Deletes the connection with the given ID. DELETE /v1/connections/{id}.'
1215
---
1316

1417
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: Get connection
3+
full: true
4+
_openapi:
5+
path: "/v1/connections/{id}"
6+
method: GET
7+
toc: []
8+
structuredData:
9+
headings: []
10+
contents:
11+
- content: Returns the connection with the given ID.
12+
url: /management-api/endpoints/connections/get-connections-by-id
13+
metaTitle: 'GET /v1/connections/{id} | Get connection - Prisma Postgres'
14+
metaDescription: 'Management API: Returns the connection with the given ID. GET /v1/connections/{id}.'
15+
---
16+
17+
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
18+
19+
Returns the connection with the given ID.
20+
21+
<APIPage document={"management-api"} operations={[{"path":"/v1/connections/{id}","method":"get"}]} />
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
---
2-
title: Get connection
2+
title: List connections
33
full: true
44
_openapi:
5-
path: "/v1/connections/{id}"
5+
path: "/v1/connections"
66
method: GET
77
toc: []
88
structuredData:
99
headings: []
1010
contents:
11-
- content: Returns the connection with the given ID.
11+
- content: >-
12+
Returns all connections the actor has access to, with optional
13+
database filter.
14+
url: /management-api/endpoints/connections/get-connections
15+
metaTitle: 'GET /v1/connections | List connections - Prisma Postgres'
16+
metaDescription: 'Management API: Returns all connections the actor has access to, with optional database filter. GET /v1/connections.'
1217
---
1318

1419
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
1520

16-
Returns the connection with the given ID.
21+
Returns all connections the actor has access to, with optional database filter.
1722

18-
<APIPage document={"management-api"} operations={[{"path":"/v1/connections/{id}","method":"get"}]} />age document={"management-api"} operations={[{"path":"/v1/connections","method":"get"}]} />
23+
<APIPage document={"management-api"} operations={[{"path":"/v1/connections","method":"get"}]} />
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"title": "Connections",
3+
"pages": [
4+
"get-connections",
5+
"get-connections-by-id",
6+
"post-connections",
7+
"delete-connections-by-id"
8+
]
9+
}

apps/docs/content/docs/management-api/endpoints/connections/post-connections.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ _openapi:
99
headings: []
1010
contents:
1111
- content: Creates a new connection for the specified database.
12+
url: /management-api/endpoints/connections/post-connections
13+
metaTitle: 'POST /v1/connections | Create connection - Prisma Postgres'
14+
metaDescription: 'Management API: Creates a new connection for the specified database. POST /v1/connections.'
1215
---
1316

1417
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}

apps/docs/content/docs/management-api/endpoints/database-backups/get-databases-id-backups.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ _openapi:
99
headings: []
1010
contents:
1111
- content: Returns backups for the specified database.
12+
url: /management-api/endpoints/database-backups/get-databases-id-backups
13+
metaTitle: 'GET /v1/databases/{databaseId}/backups | Get list of backups - Prisma Postgres'
14+
metaDescription: 'Management API: Returns backups for the specified database. GET /v1/databases/{databaseId}/backups.'
1215
---
1316

1417
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}

apps/docs/content/docs/management-api/endpoints/database-usage/get-databases-id-usage.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ _openapi:
99
headings: []
1010
contents:
1111
- content: Returns usage metrics for the specified database.
12+
url: /management-api/endpoints/database-usage/get-databases-id-usage
13+
metaTitle: 'GET /v1/databases/{databaseId}/usage | Get database usage metrics - Prisma Postgres'
14+
metaDescription: 'Management API: Returns usage metrics for the specified database. GET /v1/databases/{databaseId}/usage.'
1215
---
1316

1417
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}

apps/docs/content/docs/management-api/endpoints/databases-connections/delete-connections.mdx

Lines changed: 0 additions & 21 deletions
This file was deleted.

apps/docs/content/docs/management-api/endpoints/databases-connections/get-databases-id-connections.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ _openapi:
99
headings: []
1010
contents:
1111
- content: Returns all connections for the given database.
12+
url: /management-api/endpoints/databases-connections/get-databases-id-connections
13+
metaTitle: 'GET /v1/databases/{databaseId}/connections | Get list of database connections - Prisma Postgres'
14+
metaDescription: 'Management API: Returns all connections for the given database. GET /v1/databases/{databaseId}/connections.'
1215
---
1316

1417
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}

0 commit comments

Comments
 (0)