From 0ce3856e3f865313b7df83a0c0f6b90b798c433a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20Pr=C3=A9?= Date: Tue, 21 Apr 2026 13:48:53 -0700 Subject: [PATCH] Skip links to undocumented resources in generated API docs Check isUndocumented before generating resource links in endpoint responses. Prevents broken links to pages that don't exist because the resource namespace is undocumented (e.g., unstable_partner). Co-Authored-By: Claude Opus 4.6 (1M context) --- codegen/layouts/api-endpoint.hbs | 2 +- codegen/lib/layout/api-endpoint.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/codegen/layouts/api-endpoint.hbs b/codegen/layouts/api-endpoint.hbs index 65f729768..6ab618519 100644 --- a/codegen/layouts/api-endpoint.hbs +++ b/codegen/layouts/api-endpoint.hbs @@ -80,7 +80,7 @@ None {% hint style="success" %} Returns: {{#if response.batchResources}}batch response{{#each response.batchResources}} -- `{{this.batchKey}}`: Array of [{{this.escapedResourceType}}s]({{#if this.responsePath}}{{this.responsePath}}{{else}}./{{/if}}){{/each}}{{else}}**{{#if response.resourceType}}{{#if (eq response.responseType "resource_list")}}Array of [{{response.escapedResourceType}}s]({{#if response.responsePath}}{{response.responsePath}}{{else}}./{{/if}}){{else}}[{{response.escapedResourceType}}]({{#if response.responsePath}}{{response.responsePath}}{{else}}./{{/if}}){{/if}}{{else}}void{{/if}}**{{/if}} +- `{{this.batchKey}}`: Array of {{#if this.responsePath}}[{{this.escapedResourceType}}s]({{this.responsePath}}){{else}}{{this.escapedResourceType}}s{{/if}}{{/each}}{{else}}**{{#if response.resourceType}}{{#if (eq response.responseType "resource_list")}}Array of {{#if response.responsePath}}[{{response.escapedResourceType}}s]({{response.responsePath}}){{else}}{{response.escapedResourceType}}s{{/if}}{{else}}{{#if response.responsePath}}[{{response.escapedResourceType}}]({{response.responsePath}}){{else}}{{response.escapedResourceType}}{{/if}}{{/if}}{{else}}void{{/if}}**{{/if}} {% endhint %} diff --git a/codegen/lib/layout/api-endpoint.ts b/codegen/lib/layout/api-endpoint.ts index 186e34ec7..1b38780af 100644 --- a/codegen/lib/layout/api-endpoint.ts +++ b/codegen/lib/layout/api-endpoint.ts @@ -173,7 +173,7 @@ export function setEndpointLayoutContext( ) let responsePath = null - if (responseResource != null) { + if (responseResource != null && !responseResource.isUndocumented) { responsePath = path .relative(endpoint.path, responseResource.routePath) .replace('..', '.') // gitbook expects first level to be . @@ -196,7 +196,7 @@ export function setEndpointLayoutContext( (r) => r.resourceType === batchResource.resourceType, ) let batchResponsePath = null - if (batchResourceDef != null) { + if (batchResourceDef != null && !batchResourceDef.isUndocumented) { batchResponsePath = path .relative(endpoint.path, batchResourceDef.routePath) .replace('..', '.')