Skip to content

Commit

Permalink
docs: add notes about getSchemaVariables
Browse files Browse the repository at this point in the history
Closes #729
  • Loading branch information
Niklas Kiefer committed Oct 13, 2023
1 parent c69357d commit 0e87a13
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,28 @@ const formPlayground = new FormPlayground({
See [playground documentation](./packages/form-js-playground) for further details.


### Retrieve schema variables from a form

Use the `getSchemaVariables` util to retrieve the variables defined in a form schema. This is useful to gather what data is consumed and produced by a form.

```javascript
import { getSchemaVariables } from '@bpmn-io/form-js';

const variables = getSchemaVariables(schema);

console.log('Schema variables', variables);
```

It is also possible to distinct between input and output variables:

```javascript
import { getSchemaVariables } from '@bpmn-io/form-js';

const outputVariables = getSchemaVariables(schema, { inputs: false});
const inputVariables = getSchemaVariables(schema, { outputs: false});
```


## Resources

* [Demo](https://demo.bpmn.io/form)
Expand Down
21 changes: 21 additions & 0 deletions packages/form-js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,27 @@ const formPlayground = new FormPlayground({

See [playground documentation](./packages/form-js-playground) for further details.

### Retrieve schema variables from a form

Use the `getSchemaVariables` util to retrieve the variables defined in a form schema. This is useful to gather what data is consumed and produced by a form.

```javascript
import { getSchemaVariables } from '@bpmn-io/form-js';

const variables = getSchemaVariables(schema);

console.log('Schema variables', variables);
```

It is also possible to distinct between input and output variables:

```javascript
import { getSchemaVariables } from '@bpmn-io/form-js';

const outputVariables = getSchemaVariables(schema, { inputs: false});
const inputVariables = getSchemaVariables(schema, { outputs: false});
```


## Resources

Expand Down

0 comments on commit 0e87a13

Please sign in to comment.