File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 3
3
namespace Appwrite \SDK \Language ;
4
4
5
5
use Appwrite \SDK \Language ;
6
+ use Twig \TwigFilter ;
6
7
7
8
class Kotlin extends Language {
8
9
@@ -439,5 +440,37 @@ public function getFiles()
439
440
],
440
441
];
441
442
}
443
+
444
+ public function getFilters (): array
445
+ {
446
+ return [
447
+ new TwigFilter ('hasGenericType ' , function (string $ model , array $ spec ) {
448
+ return $ this ->hasGenericType ($ model , $ spec );
449
+ }),
450
+ ];
451
+ }
452
+
453
+ protected function hasGenericType (?string $ model , array $ spec ): string
454
+ {
455
+ if (empty ($ model )) {
456
+ return false ;
457
+ }
458
+
459
+ $ model = $ spec ['definitions ' ][$ model ];
460
+
461
+ if ($ model ['additionalProperties ' ]) {
462
+ return true ;
463
+ }
464
+
465
+ foreach ($ model ['properties ' ] as $ property ) {
466
+ if (!\array_key_exists ('sub_schema ' , $ property ) || !$ property ['sub_schema ' ]) {
467
+ continue ;
468
+ }
469
+
470
+ return $ this ->hasGenericType ($ property ['sub_schema ' ], $ spec );
471
+ }
472
+
473
+ return false ;
474
+ }
442
475
}
443
476
You can’t perform that action at this time.
0 commit comments