From f3e8b2ae7d04cadc25efd9f83318e9be55c803ce Mon Sep 17 00:00:00 2001 From: Andrew Jiang Date: Wed, 8 May 2024 18:23:00 -0400 Subject: [PATCH] feat: allow users to override the api reference url slug (#824) --- fern/apis/fdr/definition/docs/v1/write/__package__.yml | 1 + .../docs/resources/v1/resources/write/types/ApiSection.ts | 1 + packages/fdr-sdk/src/converters/db/convertDocsDefinitionToDb.ts | 2 +- .../docs/resources/v1/resources/write/types/ApiSection.d.ts | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/fern/apis/fdr/definition/docs/v1/write/__package__.yml b/fern/apis/fdr/definition/docs/v1/write/__package__.yml index b2643ed5e6..901d7b8206 100644 --- a/fern/apis/fdr/definition/docs/v1/write/__package__.yml +++ b/fern/apis/fdr/definition/docs/v1/write/__package__.yml @@ -334,6 +334,7 @@ types: showErrors: optional changelog: optional hidden: optional + urlSlugOverride: optional fullSlug: optional> navigation: optional longScrolling: optional diff --git a/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/write/types/ApiSection.ts b/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/write/types/ApiSection.ts index d68ac0f6cc..262314cd5e 100644 --- a/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/write/types/ApiSection.ts +++ b/packages/fdr-sdk/src/client/generated/api/resources/docs/resources/v1/resources/write/types/ApiSection.ts @@ -13,6 +13,7 @@ export interface ApiSection { showErrors?: boolean; changelog?: FernRegistry.docs.v1.write.ChangelogSection; hidden?: boolean; + urlSlugOverride?: string; fullSlug?: string[]; navigation?: FernRegistry.docs.v1.write.ApiNavigationConfigRoot; longScrolling?: boolean; diff --git a/packages/fdr-sdk/src/converters/db/convertDocsDefinitionToDb.ts b/packages/fdr-sdk/src/converters/db/convertDocsDefinitionToDb.ts index 87143860fd..530bbec3e7 100644 --- a/packages/fdr-sdk/src/converters/db/convertDocsDefinitionToDb.ts +++ b/packages/fdr-sdk/src/converters/db/convertDocsDefinitionToDb.ts @@ -175,7 +175,7 @@ export function transformNavigationItemForDb( longScrolling: writeShape.longScrolling, flattened: writeShape.flattened, fullSlug: writeShape.fullSlug, - urlSlug: kebabCase(writeShape.title), + urlSlug: writeShape.urlSlugOverride ?? kebabCase(writeShape.title), artifacts: writeShape.artifacts != null ? transformArtifactsForReading(writeShape.artifacts) : undefined, skipUrlSlug: writeShape.skipUrlSlug ?? false, diff --git a/servers/fdr/src/api/generated/api/resources/docs/resources/v1/resources/write/types/ApiSection.d.ts b/servers/fdr/src/api/generated/api/resources/docs/resources/v1/resources/write/types/ApiSection.d.ts index 73dd6fe272..5123eceeb0 100644 --- a/servers/fdr/src/api/generated/api/resources/docs/resources/v1/resources/write/types/ApiSection.d.ts +++ b/servers/fdr/src/api/generated/api/resources/docs/resources/v1/resources/write/types/ApiSection.d.ts @@ -11,6 +11,7 @@ export interface ApiSection { showErrors?: boolean; changelog?: FernRegistry.docs.v1.write.ChangelogSection; hidden?: boolean; + urlSlugOverride?: string; fullSlug?: string[]; navigation?: FernRegistry.docs.v1.write.ApiNavigationConfigRoot; longScrolling?: boolean;