# DefinitionBody

Extends: DefinitionBody
Superclass of: ChainDefinitionBody, FileDefinitionBody, StringDefinitionBody

- Source: [`aws-stepfunctions/lib/state-machine.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-stepfunctions/lib/state-machine.ts#L795)
- Type last changed: v2.127.0 · 10 Feb 2024

## Example

```ts
const jsonata = sfn.Pass.jsonata(this, 'JSONata');
const jsonPath = sfn.Pass.jsonPath(this, 'JSONPath');
const definition = jsonata.next(jsonPath);

new sfn.StateMachine(this, 'MixedStateMachine', {
  // queryLanguage: sfn.QueryLanguage.JSON_PATH, // default
  definitionBody: sfn.DefinitionBody.fromChainable(definition),
});

// This throws an error. If JSONata is specified at the top level, JSONPath cannot be used in the state machine definition.
new sfn.StateMachine(this, 'JSONataOnlyStateMachine', {
  queryLanguage: sfn.QueryLanguage.JSONATA,
  definitionBody: sfn.DefinitionBody.fromChainable(definition),
});
```

## Initializer

```ts
new DefinitionBody()
```

## Methods

- `bind(scope: Construct, sfnPrincipal: IPrincipal, sfnProps: StateMachineProps, graph?: StateGraph): DefinitionConfig`

- `fromChainable(chainable: IChainable): DefinitionBody // chainable` (static)

- `fromFile(path: string, options?: AssetOptions): DefinitionBody // chainable` (static)

- `fromString(definition: string): DefinitionBody // chainable` (static)
