Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions docs-mintlify/api-reference/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ Endpoints live under three path prefixes on that host, all taking the same token

Resources by entity:

{/* AUTOGEN:platform-endpoints START — generated by scripts/extract-api.mjs; do not edit by hand */}

| Entity | Resource | Version |
| --- | --- | --- |
{/* AUTOGEN:platform-endpoints START — generated by scripts/extract-api.mjs; do not edit by hand */}
| [Deployments](/api-reference/deployments/get-deployments) | `/api/v1/deployments` | v1 |
| [Deployment Creation](/api-reference/deployment-creation/create-a-deployment-with-an-empty-starter-project-and-trigger-its-first-build) | `/build/api/v1/deployments` | v1 |
| [Environments](/api-reference/environments/get-deployment-environments) | `/api/v1/deployments/{deploymentId}/environments` | v1 |
Expand Down Expand Up @@ -96,9 +97,10 @@ Resources by entity:
| [Embed Tenants](/api-reference/embed-tenants/list-embed-tenants) | `/api/v1/embed-tenants` | v1 |
| [Dashboard Embed Access](/api-reference/dashboard-embed-access/list-a-dashboards-embed-access) | `/api/v1/deployments/{deploymentId}/workbooks/{workbookId}/embed-access` | v1 |
| [OpenAPI Spec](/api-reference/openapi-spec/get-the-openapi-specification) | `/api/v1/spec` | v1 |
| [Users (SCIM)](/api-reference/scim-users/list-users) | `/api/scim/v2/Users` | SCIM 2.0 |
| [Groups (SCIM)](/api-reference/scim-groups/list-groups) | `/api/scim/v2/Groups` | SCIM 2.0 |

{/* AUTOGEN:platform-endpoints END */}
| [Users (SCIM)](/api-reference/scim-users/list-users) | `/scim/v2/Users` | SCIM 2.0 |
| [Groups (SCIM)](/api-reference/scim-groups/list-groups) | `/scim/v2/Groups` | SCIM 2.0 |

## Client libraries

Expand Down
27 changes: 20 additions & 7 deletions docs-mintlify/scripts/extract-api.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,20 @@ const OUT = path.join(ROOT, 'api-reference', 'api.yaml');
const DOCS_JSON = path.join(ROOT, 'docs.json');
const INTRO_MDX = path.join(ROOT, 'api-reference', 'introduction.mdx');
const API_REF = '/api-reference/api.yaml';
// Markers delimiting the auto-generated Platform API rows in the intro table.
// Markers delimiting the auto-generated endpoint table in the intro. They sit
// OUTSIDE the table, blank-line separated: an MDX expression between table rows
// terminates the table, so everything after it renders as a paragraph instead of
// rows. Because of that the whole table is generated — header, Platform API
// rows, and the SCIM tail (kept here since scim.yaml is hand-curated and not
// read by this script).
const INTRO_START =
'{/* AUTOGEN:platform-endpoints START — generated by scripts/extract-api.mjs; do not edit by hand */}';
const INTRO_END = '{/* AUTOGEN:platform-endpoints END */}';
const INTRO_TABLE_HEAD = '| Entity | Resource | Version |\n| --- | --- | --- |';
const INTRO_SCIM_ROWS = [
'| [Users (SCIM)](/api-reference/scim-users/list-users) | `/api/scim/v2/Users` | SCIM 2.0 |',
'| [Groups (SCIM)](/api-reference/scim-groups/list-groups) | `/api/scim/v2/Groups` | SCIM 2.0 |',
].join('\n');

// Written-file tracker: writes on a normal run, records drift under --check.
const staleFiles = [];
Expand Down Expand Up @@ -444,17 +454,18 @@ const nonApi = platformGroup.pages.filter((g) => !(g && g.openapi === API_REF));
platformGroup.pages = [...groups, ...nonApi];
writeOrCheck(DOCS_JSON, JSON.stringify(docs, null, 2) + '\n');

// 7. Regenerate the Platform API rows in the introduction table between the
// AUTOGEN markers. The entity link mirrors Mintlify's page slug
// (/api-reference/{kebab tag}/{kebab summary}); the resource is the tag's
// common path prefix. SCIM rows live outside the markers (hand-maintained).
// 7. Regenerate the introduction's endpoint table between the AUTOGEN markers.
// The entity link mirrors Mintlify's page slug (/api-reference/{kebab tag}/
// {kebab summary}); the resource is the tag's common path prefix. The table
// is emitted whole (header + rows + SCIM tail) because the markers have to
// stay outside it — see INTRO_START above.
const intro = fs.readFileSync(INTRO_MDX, 'utf8');
const s = intro.indexOf(INTRO_START);
const e = intro.indexOf(INTRO_END);
if (s < 0 || e < 0 || e < s) {
console.error(
`Aborting: AUTOGEN markers not found in ${path.relative(ROOT, INTRO_MDX)}.\n` +
`Add these two lines around the Platform API rows of the endpoint table:\n` +
`Add these two lines around (not inside) the endpoint table:\n` +
` ${INTRO_START}\n ${INTRO_END}`
);
process.exit(1);
Expand All @@ -466,7 +477,9 @@ const rows = groups
`| \`${commonPathPrefix(pathsForTag[g.group])}\` | v1 |`
)
.join('\n');
const newIntro = intro.slice(0, s + INTRO_START.length) + '\n' + rows + '\n' + intro.slice(e);
const table = [INTRO_TABLE_HEAD, rows, INTRO_SCIM_ROWS].join('\n');
const newIntro =
intro.slice(0, s + INTRO_START.length) + '\n\n' + table + '\n\n' + intro.slice(e);
writeOrCheck(INTRO_MDX, newIntro);

// 8. Under --check, fail loudly if anything drifted from the committed files.
Expand Down
Loading