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
6 changes: 5 additions & 1 deletion scripts/sync-api-sidebar.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<tag> (...)` 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) => {
Expand All @@ -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(
Expand Down
30 changes: 30 additions & 0 deletions sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
],
},
{
Expand Down
Loading