Skip to content

Commit

Permalink
chore(orchestrator): fix extensibleForm doc (#309)
Browse files Browse the repository at this point in the history
Signed-off-by: Marek Libra <[email protected]>
  • Loading branch information
mareklibra authored Jan 23, 2025
1 parent 4e3ccc2 commit 1d9c824
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions workspaces/orchestrator/docs/extensibleForm.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ For reference, an example plugin can be found [here](https://github.com/parodos-
## API

To implement the API, include @red-hat-developer-hub/backstage-plugin-orchestrator-form-api package as a dependency.
This package provides the `FormExtensionsApi` interface and related types.
This package provides the `OrchestratorFormApi` interface and related types.

```typescript
export type FormDecoratorProps = Pick<
export type OrchestratorFormDecoratorProps = Pick<
FormProps<JsonObject, JSONSchema7>,
'formData' | 'formContext' | 'widgets' | 'onChange' | 'customValidate'
> & {
Expand All @@ -27,19 +27,19 @@ export type FormDecoratorProps = Pick<
) => Promise<ErrorSchema<JsonObject>> | undefined;
};

export type FormDecorator = (
FormComponent: React.ComponentType<FormDecoratorProps>,
export type OrchestratorFormDecorator = (
FormComponent: React.ComponentType<OrchestratorFormDecoratorProps>,
) => React.ComponentType;

export interface FormExtensionsApi {
getFormDecorator(schema: JSONSchema7): FormDecorator;
export interface OrchestratorFormApi {
getFormDecorator(schema: JSONSchema7): OrchestratorFormDecorator;
}
```

### Example API Implementation

```typescript
class CustomFormApi implements FormExtensionsApi {
class CustomFormApi implements OrchestratorFormApi {
getFormDecorator(schema: JSONSchema7) {
return (FormComponent: React.ComponentType<FormDecoratorProps>>) => {
const widgets = {CountryWidget}; // CountryWidget needs to be implemneted and imported
Expand Down

0 comments on commit 1d9c824

Please sign in to comment.