Skip to content

Commit 84e18ad

Browse files
reakaleekclaude
andauthored
Search: Fix schema key content_type → type to match API response (#3459)
The navigation-search API serializes NavigationSearchResultItem.Type as "type" (CamelCase policy). The previous fix incorrectly renamed the Zod key from "type" to "content_type", causing SearchResponse.parse() to fail on every result item. Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent ced14d0 commit 84e18ad

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/Elastic.Documentation.Site/Assets/web-components/ModalSearch/useModalSearchQuery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const SearchResultItemParent = z.object({
3636
})
3737

3838
const SearchResultItem = z.object({
39-
content_type: z.enum(['docs']),
39+
type: z.enum(['docs']),
4040
url: z.string(),
4141
title: z.string(),
4242
description: z.string(),

src/Elastic.Documentation.Site/Assets/web-components/NavigationSearch/NavigationSearchTelemetry.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ const mockSearchResults = {
3232
title: 'Elasticsearch Guide',
3333
description: 'Learn about Elasticsearch',
3434
score: 0.95,
35-
content_type: 'docs' as const,
35+
type: 'docs' as const,
3636
parents: [{ title: 'Docs' }, { title: 'Elasticsearch' }],
3737
},
3838
{
3939
url: '/docs/kibana/dashboard',
4040
title: 'Kibana Dashboard',
4141
description: 'Create dashboards',
4242
score: 0.85,
43-
content_type: 'docs' as const,
43+
type: 'docs' as const,
4444
parents: [{ title: 'Docs' }, { title: 'Kibana' }],
4545
},
4646
],

src/Elastic.Documentation.Site/Assets/web-components/NavigationSearch/useNavigationSearchQuery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const SearchResultItemParent = z.object({
4040
})
4141

4242
const SearchResultItem = z.object({
43-
content_type: z.enum(['docs']),
43+
type: z.enum(['docs']),
4444
url: z.string(),
4545
title: z.string(),
4646
description: z.string(),

0 commit comments

Comments
 (0)