diff --git a/.changeset/soft-planets-mate.md b/.changeset/soft-planets-mate.md new file mode 100644 index 0000000000..94dd790f4b --- /dev/null +++ b/.changeset/soft-planets-mate.md @@ -0,0 +1,6 @@ +--- +'@backstage/plugin-scaffolder': patch +'@backstage/plugin-scaffolder-react': patch +--- + +Add schema output return type to the `makeFieldSchema` function return diff --git a/plugins/scaffolder-react/report.api.md b/plugins/scaffolder-react/report.api.md index 8a6b4739a4..a357ff3176 100644 --- a/plugins/scaffolder-react/report.api.md +++ b/plugins/scaffolder-react/report.api.md @@ -131,6 +131,8 @@ export interface FieldSchema { // (undocumented) readonly schema: CustomFieldExtensionSchema; // (undocumented) + readonly TOutput: TReturn; + // (undocumented) readonly TProps: FieldExtensionComponentProps; // @deprecated (undocumented) readonly type: FieldExtensionComponentProps; diff --git a/plugins/scaffolder-react/src/utils.ts b/plugins/scaffolder-react/src/utils.ts index 63a62fe3fc..dc24df759d 100644 --- a/plugins/scaffolder-react/src/utils.ts +++ b/plugins/scaffolder-react/src/utils.ts @@ -33,6 +33,7 @@ export function makeFieldSchema< const { output, uiOptions } = options; return { TProps: undefined as any, + TOutput: undefined as any, schema: { returnValue: zodToJsonSchema(output(z)) as JSONSchema7, uiOptions: uiOptions && (zodToJsonSchema(uiOptions(z)) as JSONSchema7), @@ -57,4 +58,5 @@ export interface FieldSchema { readonly schema: CustomFieldExtensionSchema; readonly TProps: FieldExtensionComponentProps; + readonly TOutput: TReturn; } diff --git a/plugins/scaffolder/src/components/fields/utils.ts b/plugins/scaffolder/src/components/fields/utils.ts index 4ec9de2d99..2fa6aab1b3 100644 --- a/plugins/scaffolder/src/components/fields/utils.ts +++ b/plugins/scaffolder/src/components/fields/utils.ts @@ -53,5 +53,6 @@ export function makeFieldSchemaFromZod< type: null as any, uiOptionsType: null as any, TProps: undefined as any, + TOutput: undefined as any, }; }