File tree Expand file tree Collapse file tree 4 files changed +36
-11
lines changed
src/PropertyProcessor/Filter Expand file tree Collapse file tree 4 files changed +36
-11
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ public function process(
43
43
GeneratorConfiguration $ generatorConfiguration ,
44
44
Schema $ schema
45
45
): void {
46
- if (is_string ($ filterList )) {
46
+ if (is_string ($ filterList ) || ( is_array ( $ filterList ) && isset ( $ filterList [ ' filter ' ])) ) {
47
47
$ filterList = [$ filterList ];
48
48
}
49
49
Original file line number Diff line number Diff line change @@ -465,14 +465,15 @@ public function testFilterExceptionsAreCaught(): void
465
465
}
466
466
467
467
/**
468
- * @dataProvider namespaceDataProvider
468
+ * @dataProvider additionalFilterOptionsDataProvider
469
469
*
470
470
* @param string $namespace
471
+ * @param string $schemaFile
471
472
*/
472
- public function testAdditionalFilterOptions (string $ namespace ): void
473
+ public function testAdditionalFilterOptions (string $ namespace, string $ schemaFile ): void
473
474
{
474
475
$ className = $ this ->generateClassFromFile (
475
- ' FilterOptions.json ' ,
476
+ $ schemaFile ,
476
477
(new GeneratorConfiguration ())->setSerialization (true )->setNamespacePrefix ($ namespace )
477
478
);
478
479
@@ -486,6 +487,17 @@ public function testAdditionalFilterOptions(string $namespace): void
486
487
$ this ->assertSame (json_encode ($ expectedSerialization ), $ object ->toJSON ());
487
488
}
488
489
490
+ public function additionalFilterOptionsDataProvider (): array
491
+ {
492
+ return $ this ->combineDataProvider (
493
+ $ this ->namespaceDataProvider (),
494
+ [
495
+ 'Chain notation ' => ['FilterOptionsChainNotation.json ' ],
496
+ 'Single filter notation ' => ['FilterOptions.json ' ],
497
+ ]
498
+ );
499
+ }
500
+
489
501
public function testTransformingFilterAppliedToAnArrayPropertyThrowsAnException (): void
490
502
{
491
503
$ this ->expectException (SchemaException::class);
Original file line number Diff line number Diff line change 3
3
"properties" : {
4
4
"created" : {
5
5
"type" : " string" ,
6
- "filter" : [
7
- {
8
- "filter" : " dateTime" ,
9
- "createFromFormat" : " !dmY" ,
10
- "outputFormat" : " Ymd"
11
- }
12
- ]
6
+ "filter" : {
7
+ "filter" : " dateTime" ,
8
+ "createFromFormat" : " !dmY" ,
9
+ "outputFormat" : " Ymd"
10
+ }
13
11
}
14
12
}
15
13
}
Original file line number Diff line number Diff line change
1
+ {
2
+ "type" : " object" ,
3
+ "properties" : {
4
+ "created" : {
5
+ "type" : " string" ,
6
+ "filter" : [
7
+ {
8
+ "filter" : " dateTime" ,
9
+ "createFromFormat" : " !dmY" ,
10
+ "outputFormat" : " Ymd"
11
+ }
12
+ ]
13
+ }
14
+ }
15
+ }
You can’t perform that action at this time.
0 commit comments