Skip to content

Commit 2750938

Browse files
committed
remove duplicate validation
Signed-off-by: phuhung273 <phuhung.tranpham@gmail.com>
1 parent ee1b547 commit 2750938

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

packages/aws-cdk-lib/aws-stepfunctions/lib/states/distributed-map.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ItemBatcher } from './distributed-map/item-batcher';
33
import { IItemReader } from './distributed-map/item-reader';
44
import { ResultWriter, ResultWriterV2 } from './distributed-map/result-writer';
55
import { MapBase, MapBaseJsonataOptions, MapBaseJsonPathOptions, MapBaseOptions, MapBaseProps } from './map-base';
6-
import { Annotations, FeatureFlags, ValidationError } from '../../../core';
6+
import { Annotations, FeatureFlags } from '../../../core';
77
import { FieldUtils } from '../fields';
88
import { StateGraph } from '../state-graph';
99
import { StateMachineType } from '../state-machine';
@@ -314,11 +314,6 @@ export class DistributedMap extends MapBase implements INextable {
314314
* Return the Amazon States Language object for this state
315315
*/
316316
public toStateJson(stateMachineQueryLanguage?: QueryLanguage): object {
317-
// https://docs.aws.amazon.com/step-functions/latest/dg/statemachine-structure.html
318-
if (stateMachineQueryLanguage == QueryLanguage.JSONATA && this.queryLanguage == QueryLanguage.JSON_PATH) {
319-
throw new ValidationError('When StateMachine query language is JSONata, individual states cannot use JSONPath.', this);
320-
}
321-
322317
let rendered: any = super.toStateJson(stateMachineQueryLanguage);
323318
if (rendered.ItemProcessor.ProcessorConfig.ExecutionType) {
324319
Annotations.of(this).addWarningV2('@aws-cdk/aws-stepfunctions:propertyIgnored', 'Property \'ProcessorConfig.executionType\' is ignored, use the \'mapExecutionType\' in the \'DistributedMap\' class instead.');
@@ -327,9 +322,7 @@ export class DistributedMap extends MapBase implements INextable {
327322
rendered.ItemProcessor.ProcessorConfig.ExecutionType = this.mapExecutionType;
328323
// ItemReader and ResultWriter configuration will base on the Map's query language.
329324
// If Map's query language is not specified, then use state machine's query language.
330-
const stateQueryLanguage = stateMachineQueryLanguage == QueryLanguage.JSONATA
331-
? QueryLanguage.JSONATA
332-
: this.queryLanguage ?? stateMachineQueryLanguage;
325+
const stateQueryLanguage = this.queryLanguage ?? stateMachineQueryLanguage;
333326

334327
const renderedResultWriter = this.renderResultWriter(stateQueryLanguage);
335328
this.addWarningIfResultWriterIsEmpty(renderedResultWriter);

packages/aws-cdk-lib/aws-stepfunctions/test/distributed-map.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,8 +1619,6 @@ describe('Distributed Map State', () => {
16191619
expect(() => {
16201620
// GIVEN
16211621
const stack = new cdk.Stack();
1622-
1623-
stack.node.setContext(STEPFUNCTIONS_USE_DISTRIBUTED_MAP_RESULT_WRITER_V2, true);
16241622
const writerBucket = new s3.Bucket(stack, 'TestBucket');
16251623

16261624
// WHEN
@@ -1637,7 +1635,7 @@ describe('Distributed Map State', () => {
16371635
definition: map,
16381636
queryLanguage: stepfunctions.QueryLanguage.JSONATA,
16391637
});
1640-
}).toThrow(/When StateMachine query language is JSONata, individual states cannot use JSONPath./);
1638+
}).toThrow(/'queryLanguage' can not be 'JSONPath' if set to 'JSONata' for whole state machine/);
16411639
}),
16421640

16431641
test('State Machine JSONPath With Distributed Map State and ItemReader, ResultWriterV2 in JSONATA', () => {

0 commit comments

Comments
 (0)