diff --git a/plugins/scaffolder/api-report.md b/plugins/scaffolder/api-report.md index 28dc0b7e40..63eea46fac 100644 --- a/plugins/scaffolder/api-report.md +++ b/plugins/scaffolder/api-report.md @@ -36,20 +36,7 @@ export function createScaffolderFieldExtension( options: FieldExtensionOptions, ): Extension<() => null>; -// Warning: (ae-missing-release-tag) "CustomFieldExtension" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) -export interface CustomFieldExtension - extends FieldProps { - // (undocumented) - uiSchema: { - 'ui:options'?: UiOptions; - }; -} - -// Warning: (ae-missing-release-tag) "CustomFieldValidator" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) +// @public export type CustomFieldValidator = | ((data: T, field: FieldValidation) => void) | (( @@ -107,9 +94,18 @@ export const EntityTagsPickerFieldExtension: () => null; // @public export const FavouriteTemplate: (props: Props) => JSX.Element; -// Warning: (ae-missing-release-tag) "FieldExtensionOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) -// -// @public (undocumented) +// @public +export interface FieldExtensionComponentProps< + ReturnValue, + UiOptions extends {} = {}, +> extends FieldProps { + // (undocumented) + uiSchema: { + 'ui:options'?: UiOptions; + }; +} + +// @public export type FieldExtensionOptions = { name: string; component: (props: FieldProps) => JSX.Element | null; @@ -157,7 +153,7 @@ export const RepoUrlPicker: ({ onChange, rawErrors, formData, -}: CustomFieldExtension) => JSX.Element; +}: FieldExtensionComponentProps) => JSX.Element; // Warning: (ae-missing-release-tag) "RepoUrlPickerFieldExtension" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // diff --git a/plugins/scaffolder/src/extensions/types.ts b/plugins/scaffolder/src/extensions/types.ts index 2fdb80e684..e1da9889e7 100644 --- a/plugins/scaffolder/src/extensions/types.ts +++ b/plugins/scaffolder/src/extensions/types.ts @@ -16,6 +16,11 @@ import { ApiHolder } from '@backstage/core-plugin-api'; import { FieldValidation, FieldProps } from '@rjsf/core'; +/** + * Field validation type for Custom Field Extensions. + * + * @public + */ export type CustomFieldValidator = | ((data: T, field: FieldValidation) => void) | (( @@ -24,12 +29,24 @@ export type CustomFieldValidator = context: { apiHolder: ApiHolder }, ) => void); +/** + * Type for the Custom Field Extension with the + * name and components and validation function. + * + * @public + */ export type FieldExtensionOptions = { name: string; component: (props: FieldProps) => JSX.Element | null; validation?: CustomFieldValidator; }; +/** + * Type for field extensions and being able to type + * incoming props easier. + * + * @public + */ export interface FieldExtensionComponentProps< ReturnValue, UiOptions extends {} = {}, diff --git a/plugins/scaffolder/src/index.ts b/plugins/scaffolder/src/index.ts index 86f684cb2d..57ce4df516 100644 --- a/plugins/scaffolder/src/index.ts +++ b/plugins/scaffolder/src/index.ts @@ -29,7 +29,7 @@ export { export type { CustomFieldValidator, FieldExtensionOptions, - CustomFieldExtension, + FieldExtensionComponentProps, } from './extensions'; export { EntityPickerFieldExtension,