Skip to content

Commit bea8c0d

Browse files
authored
Merge pull request #350 from keboola/pepa_intTaskId
Allow integers for onlyOrchestrationTaskIds
2 parents a30a120 + aec789c commit bea8c0d

File tree

4 files changed

+10
-36
lines changed

4 files changed

+10
-36
lines changed

src/JobFactory/FullJobDefinition.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ protected function getRootDefinition(TreeBuilder $treeBuilder): ArrayNodeDefinit
212212
->thenInvalid('value cannot be empty list')
213213
->end()
214214
->validate()
215-
->ifTrue(fn($v) => count(array_filter($v ?? [], fn($i) => !is_string($i))) > 0)
216-
->thenInvalid('items must be strings')
215+
->ifTrue(fn($v) => count(array_filter($v ?? [], fn($i) => !is_scalar($i))) > 0)
216+
->thenInvalid('items must be scalars')
217217
->end()
218218
->validate()
219219
->ifTrue(fn($v) => count(array_filter($v ?? [], fn($i) => $i === '')) > 0)

src/JobFactory/NewJobDefinition.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ protected function getRootDefinition(TreeBuilder $treeBuilder): ArrayNodeDefinit
105105
->thenInvalid('value cannot be empty list')
106106
->end()
107107
->validate()
108-
->ifTrue(fn($v) => count(array_filter($v ?? [], fn($i) => !is_string($i))) > 0)
109-
->thenInvalid('items must be strings')
108+
->ifTrue(fn($v) => count(array_filter($v ?? [], fn($i) => !is_scalar($i))) > 0)
109+
->thenInvalid('items must be scalars')
110110
->end()
111111
->validate()
112112
->ifTrue(fn($v) => count(array_filter($v ?? [], fn($i) => $i === '')) > 0)

tests/JobFactory/FullJobDefinitionTest.php

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function testValidJobMaximal(): void
3737
'type' => 'standard',
3838
'branchType' => BranchType::DEFAULT->value,
3939
'orchestrationTaskId' => '123',
40-
'onlyOrchestrationTaskIds' => ['45', '67'],
40+
'onlyOrchestrationTaskIds' => ['45', 67],
4141
'previousJobId' => '789',
4242
];
4343
$definition = new FullJobDefinition();
@@ -473,23 +473,7 @@ public function invalidJobProvider(): array
473473
],
474474
'/Invalid configuration for path "job.onlyOrchestrationTaskIds": value cannot be empty list/',
475475
],
476-
'onlyOrchestrationTaskIds with non-string item' => [
477-
[
478-
'#tokenString' => getenv('TEST_STORAGE_API_TOKEN'),
479-
'id' => '12345',
480-
'runId' => '12345',
481-
'tokenId' => '1234',
482-
'projectId' => '123',
483-
'status' => 'created',
484-
'desiredStatus' => 'processing',
485-
'configId' => '123',
486-
'componentId' => 'keboola.test',
487-
'mode' => 'run',
488-
'onlyOrchestrationTaskIds' => [123],
489-
],
490-
'/Invalid configuration for path "job.onlyOrchestrationTaskIds": items must be strings/',
491-
],
492-
'onlyOrchestrationTaskIds with null item' => [
476+
'onlyOrchestrationTaskIds with non-scalar item' => [
493477
[
494478
'#tokenString' => getenv('TEST_STORAGE_API_TOKEN'),
495479
'id' => '12345',
@@ -503,7 +487,7 @@ public function invalidJobProvider(): array
503487
'mode' => 'run',
504488
'onlyOrchestrationTaskIds' => [null],
505489
],
506-
'/Invalid configuration for path "job.onlyOrchestrationTaskIds": items must be strings/',
490+
'/Invalid configuration for path "job.onlyOrchestrationTaskIds": items must be scalars/',
507491
],
508492
'onlyOrchestrationTaskIds with empty item' => [
509493
[

tests/JobFactory/NewJobDefinitionTest.php

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function testValidJobFull(string $mode): void
6565
],
6666
'orchestrationJobId' => '123456789',
6767
'orchestrationTaskId' => '123',
68-
'onlyOrchestrationTaskIds' => ['45', '67'],
68+
'onlyOrchestrationTaskIds' => ['45', 67],
6969
'previousJobId' => '789',
7070
];
7171
$definition = new NewJobDefinition();
@@ -194,25 +194,15 @@ public function invalidJobProvider(): array
194194
],
195195
'/Invalid configuration for path "job.onlyOrchestrationTaskIds": value cannot be empty list/',
196196
],
197-
'onlyOrchestrationTaskIds with non-string item' => [
198-
[
199-
'#tokenString' => getenv('TEST_STORAGE_API_TOKEN'),
200-
'configId' => '123',
201-
'componentId' => 'keboola.test',
202-
'result' => [],
203-
'onlyOrchestrationTaskIds' => [123],
204-
],
205-
'/Invalid configuration for path "job.onlyOrchestrationTaskIds": items must be strings/',
206-
],
207-
'onlyOrchestrationTaskIds with null item' => [
197+
'onlyOrchestrationTaskIds with non-scalar item' => [
208198
[
209199
'#tokenString' => getenv('TEST_STORAGE_API_TOKEN'),
210200
'configId' => '123',
211201
'componentId' => 'keboola.test',
212202
'result' => [],
213203
'onlyOrchestrationTaskIds' => [null],
214204
],
215-
'/Invalid configuration for path "job.onlyOrchestrationTaskIds": items must be strings/',
205+
'/Invalid configuration for path "job.onlyOrchestrationTaskIds": items must be scalars/',
216206
],
217207
'onlyOrchestrationTaskIds with empty item' => [
218208
[

0 commit comments

Comments
 (0)