docs: update extension config schema examples to new configSchema format
Switch all documentation examples from the deprecated
`config: { schema: { field: z => z.type() } }` pattern to the new
`configSchema: { field: z.type() }` format using zod v4 imports.
Also update catalog-graph README to use current blueprint APIs.
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
This commit is contained in:
@@ -78,17 +78,16 @@ _Example creating a custom `TechDocsSearchResultItemExtension`_
|
||||
```tsx
|
||||
// plugins/techdocs/alpha.tsx
|
||||
import { createSearchResultListItemExtension } from '@backstage/plugin-search-react/alpha';
|
||||
import { z } from 'zod';
|
||||
|
||||
/** @alpha */
|
||||
export const TechDocsSearchResultListItemExtension =
|
||||
createSearchResultListItemExtension({
|
||||
id: 'techdocs',
|
||||
configSchema: createSchemaFromZod(z =>
|
||||
z.object({
|
||||
noTrack: z.boolean().default(false),
|
||||
lineClamp: z.number().default(5),
|
||||
}),
|
||||
),
|
||||
configSchema: {
|
||||
noTrack: z.boolean().default(false),
|
||||
lineClamp: z.number().default(5),
|
||||
},
|
||||
predicate: result => result.type === 'techdocs',
|
||||
component: async ({ config }) => {
|
||||
const { TechDocsSearchResultListItem } = await import(
|
||||
@@ -188,17 +187,16 @@ Here is the `plugins/techdocs/alpha/index.tsx` final version, and you can also t
|
||||
// plugins/techdocs/alpha.tsx
|
||||
import { createPlugin } from '@backstage/frontend-plugin-api';
|
||||
import { createSearchResultListItemExtension } from '@backstage/plugin-search-react/alpha';
|
||||
import { z } from 'zod';
|
||||
|
||||
/** @alpha */
|
||||
export const TechDocsSearchResultListItemExtension =
|
||||
createSearchResultListItemExtension({
|
||||
id: 'techdocs',
|
||||
configSchema: createSchemaFromZod(z =>
|
||||
z.object({
|
||||
noTrack: z.boolean().default(false),
|
||||
lineClamp: z.number().default(5),
|
||||
}),
|
||||
),
|
||||
configSchema: {
|
||||
noTrack: z.boolean().default(false),
|
||||
lineClamp: z.number().default(5),
|
||||
},
|
||||
predicate: result => result.type === 'techdocs',
|
||||
component: async ({ config }) => {
|
||||
const { TechDocsSearchResultListItem } = await import(
|
||||
|
||||
Reference in New Issue
Block a user