diff --git a/scripts/sync-api-sidebar.mjs b/scripts/sync-api-sidebar.mjs index 973ce053..f4b56c25 100644 --- a/scripts/sync-api-sidebar.mjs +++ b/scripts/sync-api-sidebar.mjs @@ -178,6 +178,10 @@ function buildSlugToTagMap() { return map; } +// Find the `items` array of the sidebar category whose label matches the +// given tag. Falls back to a ` (...)` prefix match so a category can +// add a clarifying parenthetical (e.g. label "Custom Metadata (Any Datasource)" +// for OpenAPI tag "Custom Metadata") without breaking auto-insertion. function findCategoryItemsByLabel(root, label) { let found = null; root.find(j.ObjectExpression).forEach((p) => { @@ -196,7 +200,7 @@ function findCategoryItemsByLabel(root, label) { pr.type === 'ObjectProperty' && pr.key?.name === 'label' && pr.value?.type === 'StringLiteral' && - pr.value?.value === label, + (pr.value.value === label || pr.value.value.startsWith(`${label} (`)), ); if (!labelMatch) return; const itemsProp = props.find( diff --git a/sidebars.ts b/sidebars.ts index e6fdd050..29de3acb 100644 --- a/sidebars.ts +++ b/sidebars.ts @@ -1280,6 +1280,36 @@ const baseSidebars: SidebarsConfig = { id: 'api-info/indexing/custom-metadata/custom-properties-vs-custom-metadata', label: 'Custom Properties vs Custom Metadata', }, + { + type: 'doc', + id: 'api/indexing-api/add-or-update-custom-metadata', + label: 'Add or update custom metadata', + className: 'api-method put', + }, + { + type: 'doc', + id: 'api/indexing-api/create-or-update-metadata-schema', + label: 'Create or update metadata schema', + className: 'api-method put', + }, + { + type: 'doc', + id: 'api/indexing-api/remove-custom-metadata', + label: 'Remove custom metadata', + className: 'api-method delete', + }, + { + type: 'doc', + id: 'api/indexing-api/remove-metadata-schema', + label: 'Remove metadata schema', + className: 'api-method delete', + }, + { + type: 'doc', + id: 'api/indexing-api/retrieve-metadata-schema', + label: 'Retrieve metadata schema', + className: 'api-method get', + }, ], }, {