Skip to content

Commit 13796ad

Browse files
committed
feat (ComponentDefinition): dataTypesConfiguration and processorConfiguration
1 parent 95ef1b2 commit 13796ad

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

src/JobFactory/Configuration/ComponentDefinition.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,24 @@ protected function getRootDefinition(TreeBuilder $treeBuilder): ArrayNodeDefinit
5858
->scalarPrototype()->end()
5959
->defaultValue([])
6060
->end()
61+
->arrayNode('dataTypesConfiguration')
62+
->ignoreExtraKeys()
63+
->children()
64+
->enumNode('dataTypesSupport')
65+
->values(['none', 'authoritative', 'hints'])
66+
->defaultValue('none')
67+
->end()
68+
->end()
69+
->end()
70+
->arrayNode('processorConfiguration')
71+
->ignoreExtraKeys()
72+
->children()
73+
->enumNode('allowedProcessorPosition')
74+
->values(['any', 'before', 'after'])
75+
->defaultValue('any')
76+
->end()
77+
->end()
78+
->end()
6179
->arrayNode('data')->isRequired()
6280
->children()
6381
->arrayNode('definition')->isRequired()

tests/JobFactory/Configuration/ComponentDefinitionTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,14 @@ public function validDataProvider(): Generator
127127
'features' => [
128128
'some-feature',
129129
],
130+
'dataTypesConfiguration' => [
131+
'dataTypesSupport' => 'hints',
132+
'somethingElse' => 'should be ignored',
133+
],
134+
'processorConfiguration' => [
135+
'allowedProcessorPosition' => 'after',
136+
'somethingElse' => 'should be ignored',
137+
],
130138
],
131139
'expected' => [
132140
'id' => 'test',
@@ -178,6 +186,12 @@ public function validDataProvider(): Generator
178186
'features' => [
179187
'some-feature',
180188
],
189+
'dataTypesConfiguration' => [
190+
'dataTypesSupport' => 'hints',
191+
],
192+
'processorConfiguration' => [
193+
'allowedProcessorPosition' => 'after',
194+
],
181195
],
182196
];
183197
yield 'other options' => [
@@ -412,5 +426,21 @@ public function invalidDataProvider(): Generator
412426
'expected' => 'The value -1 is too small for path "component.data.process_timeout". ' .
413427
'Should be greater than or equal to 0',
414428
];
429+
yield 'invalid dataTypeSupport' => [
430+
'data' => [
431+
'id' => 'test',
432+
'data' => [
433+
'definition' => [
434+
'type' => 'aws-ecr',
435+
'uri' => 'some-uri',
436+
],
437+
],
438+
'dataTypesConfiguration' => [
439+
'dataTypesSupport' => 'invalid',
440+
],
441+
],
442+
'expected' => 'The value "invalid" is not allowed for path ' .
443+
'"component.dataTypesConfiguration.dataTypesSupport"',
444+
];
415445
}
416446
}

0 commit comments

Comments
 (0)