13
13
use ApiClients \Tools \OpenApiClientGenerator \Generator \Hydrator ;
14
14
use ApiClients \Tools \OpenApiClientGenerator \Generator \Hydrators ;
15
15
use ApiClients \Tools \OpenApiClientGenerator \Generator \Operation ;
16
+ use ApiClients \Tools \OpenApiClientGenerator \Generator \Operations ;
17
+ use ApiClients \Tools \OpenApiClientGenerator \Generator \OperationsInterface ;
16
18
use ApiClients \Tools \OpenApiClientGenerator \Generator \OperationTest ;
19
+ use ApiClients \Tools \OpenApiClientGenerator \Generator \Operator ;
17
20
use ApiClients \Tools \OpenApiClientGenerator \Generator \Schema ;
18
21
use ApiClients \Tools \OpenApiClientGenerator \Generator \WebHook ;
19
22
use ApiClients \Tools \OpenApiClientGenerator \Generator \WebHooks ;
@@ -86,6 +89,8 @@ public function __construct(
86
89
new Step ('generating_schemas ' , 'Generating: Schemas ' , true ),
87
90
new Step ('generating_clientinterface ' , 'Generating: ClientInterface ' , false ),
88
91
new Step ('generating_client ' , 'Generating: Client ' , false ),
92
+ new Step ('generating_operationsinterface_entry_point ' , 'Generating: OperationsInterface Entry Point ' , false ),
93
+ new Step ('generating_operations_entry_point ' , 'Generating: Operations Entry Point ' , false ),
89
94
new Step ('generating_webhooks ' , 'Generating: WebHooks ' , true ),
90
95
new Step ('generating_webhooks_entry_point ' , 'Generating: WebHooks Entry Point ' , false ),
91
96
new Step ('generating_hydrators ' , 'Generating: Hydrators ' , true ),
@@ -128,8 +133,6 @@ public function __construct(
128
133
(static function (string $ root , Files $ files , string ...$ additionalFiles ): bool {
129
134
foreach ($ additionalFiles as $ additionalFile ) {
130
135
if ($ files ->has ($ additionalFile ) && (! file_exists ($ root . $ additionalFile ) || $ files ->get ($ additionalFile )->hash !== md5 (file_get_contents ($ root . $ additionalFile )))) {
131
- echo $ additionalFile , PHP_EOL ;
132
-
133
136
return false ;
134
137
}
135
138
}
@@ -176,6 +179,7 @@ public function generate(string $namespace, string $namespaceTest, string $confi
176
179
'Error ' => 'ErrorSchemas ' ,
177
180
'Hydrator ' => null ,
178
181
'Operation ' => null ,
182
+ 'Operator ' => null ,
179
183
'Schema ' => null ,
180
184
'WebHook ' => null ,
181
185
'Router ' => null ,
@@ -192,7 +196,7 @@ public function generate(string $namespace, string $namespaceTest, string $confi
192
196
$ fileContentsHash = md5 ($ fileContents );
193
197
if (
194
198
! $ this ->state ->generatedFiles ->has ($ fileName ) ||
195
- $ this ->state ->generatedFiles ->get ($ fileName )->hash = == $ fileContentsHash
199
+ $ this ->state ->generatedFiles ->get ($ fileName )->hash ! == $ fileContentsHash
196
200
) {
197
201
@mkdir (dirname ($ fileName ), 0744 , true );
198
202
file_put_contents ($ fileName , $ fileContents );
@@ -207,7 +211,6 @@ public function generate(string $namespace, string $namespaceTest, string $confi
207
211
}
208
212
209
213
foreach ($ existingFiles as $ existingFile ) {
210
- echo $ existingFile , PHP_EOL ;
211
214
$ this ->state ->generatedFiles ->remove ($ existingFile );
212
215
unlink ($ existingFile );
213
216
}
@@ -253,7 +256,6 @@ private function all(string $namespace, string $namespaceTest, string $configura
253
256
$ this ->statusOutput ->advanceStep ('gathering_schemas ' );
254
257
}
255
258
}
256
-
257
259
$ this ->statusOutput ->markStepDone ('gathering_schemas ' );
258
260
259
261
$ webHooks = [];
@@ -269,7 +271,6 @@ private function all(string $namespace, string $namespaceTest, string $configura
269
271
$ this ->statusOutput ->advanceStep ('gathering_webhooks ' );
270
272
}
271
273
}
272
-
273
274
$ this ->statusOutput ->markStepDone ('gathering_webhooks ' );
274
275
275
276
$ paths = [];
@@ -334,6 +335,15 @@ private function oneClient(string $namespace, string $namespaceTest, string $con
334
335
$ this ->configuration ,
335
336
);
336
337
338
+ yield from Operator::generate (
339
+ $ this ->configuration ->destination ->source . DIRECTORY_SEPARATOR ,
340
+ $ namespace ,
341
+ $ operation ,
342
+ $ path ->hydrator ,
343
+ $ throwableSchemaRegistry ,
344
+ $ this ->configuration ,
345
+ );
346
+
337
347
yield from OperationTest::generate (
338
348
$ this ->configuration ->destination ->test . DIRECTORY_SEPARATOR ,
339
349
$ namespaceTest ,
@@ -347,7 +357,6 @@ private function oneClient(string $namespace, string $namespaceTest, string $con
347
357
348
358
$ this ->statusOutput ->advanceStep ('generating_operations ' );
349
359
}
350
-
351
360
$ this ->statusOutput ->markStepDone ('generating_operations ' );
352
361
353
362
$ unknownSchemaCount = 0 ;
@@ -360,7 +369,6 @@ private function oneClient(string $namespace, string $namespaceTest, string $con
360
369
$ this ->statusOutput ->advanceStep ('gathering_unknown_schemas ' );
361
370
}
362
371
}
363
-
364
372
$ this ->statusOutput ->markStepDone ('gathering_unknown_schemas ' );
365
373
366
374
$ this ->statusOutput ->itemForStep ('generating_schemas ' , count ($ schemas ));
@@ -382,25 +390,43 @@ private function oneClient(string $namespace, string $namespaceTest, string $con
382
390
383
391
$ this ->statusOutput ->advanceStep ('generating_schemas ' );
384
392
}
385
-
386
393
$ this ->statusOutput ->markStepDone ('generating_schemas ' );
387
394
388
395
$ client = \ApiClients \Tools \OpenApiClientGenerator \Gatherer \Client::gather ($ this ->spec , ...$ paths );
396
+ $ routers = new Client \Routers ();
389
397
390
398
$ this ->statusOutput ->markStepDone ('generating_clientinterface ' );
391
-
392
399
yield from ClientInterface::generate (
400
+ $ this ->configuration ,
393
401
$ this ->configuration ->destination ->source . DIRECTORY_SEPARATOR ,
394
402
$ namespace ,
395
403
$ operations ,
396
404
);
397
405
398
406
$ this ->statusOutput ->markStepDone ('generating_client ' );
399
-
400
407
yield from Client::generate (
408
+ $ this ->configuration ,
401
409
$ this ->configuration ->destination ->source . DIRECTORY_SEPARATOR ,
402
410
$ namespace ,
403
411
$ client ,
412
+ $ routers ,
413
+ );
414
+
415
+ $ this ->statusOutput ->markStepDone ('generating_operationsinterface_entry_point ' );
416
+ yield from OperationsInterface::generate (
417
+ $ this ->configuration ,
418
+ $ this ->configuration ->destination ->source . DIRECTORY_SEPARATOR ,
419
+ $ namespace ,
420
+ $ operations ,
421
+ );
422
+
423
+ $ this ->statusOutput ->markStepDone ('generating_operations_entry_point ' );
424
+ yield from Operations::generate (
425
+ $ this ->configuration ,
426
+ $ this ->configuration ->destination ->source . DIRECTORY_SEPARATOR ,
427
+ $ namespace ,
428
+ $ operations ,
429
+ $ routers ,
404
430
);
405
431
406
432
$ webHooksHydrators = [];
@@ -421,11 +447,9 @@ private function oneClient(string $namespace, string $namespaceTest, string $con
421
447
422
448
$ this ->statusOutput ->advanceStep ('generating_webhooks ' );
423
449
}
424
-
425
450
$ this ->statusOutput ->markStepDone ('generating_webhooks ' );
426
451
427
452
$ this ->statusOutput ->markStepDone ('generating_webhooks_entry_point ' );
428
-
429
453
yield from WebHooks::generate ($ this ->configuration ->destination ->source . DIRECTORY_SEPARATOR , $ namespace , $ webHooksHydrators , $ webHooks );
430
454
431
455
$ this ->statusOutput ->itemForStep ('generating_hydrators ' , count ($ hydrators ));
@@ -434,11 +458,9 @@ private function oneClient(string $namespace, string $namespaceTest, string $con
434
458
435
459
$ this ->statusOutput ->advanceStep ('generating_hydrators ' );
436
460
}
437
-
438
461
$ this ->statusOutput ->markStepDone ('generating_hydrators ' );
439
462
440
463
$ this ->statusOutput ->markStepDone ('generating_hydrators_entry_point ' );
441
-
442
464
yield from Hydrators::generate ($ this ->configuration ->destination ->source . DIRECTORY_SEPARATOR , $ namespace , ...$ hydrators );
443
465
444
466
$ this ->statusOutput ->markStepDone ('generating_templated_files ' );
@@ -485,6 +507,15 @@ private function subSplitClient(string $namespace, string $namespaceTest, string
485
507
$ this ->configuration ,
486
508
);
487
509
510
+ yield from Operator::generate (
511
+ $ this ->configuration ->subSplit ->subSplitsDestination . DIRECTORY_SEPARATOR . $ this ->splitPathPrefix ($ this ->configuration ->subSplit ->sectionPackage , $ split ) . $ this ->configuration ->destination ->source ,
512
+ $ namespace ,
513
+ $ operation ,
514
+ $ path ->hydrator ,
515
+ $ throwableSchemaRegistry ,
516
+ $ this ->configuration ,
517
+ );
518
+
488
519
yield from OperationTest::generate (
489
520
$ this ->configuration ->subSplit ->subSplitsDestination . DIRECTORY_SEPARATOR . $ this ->splitPathPrefix ($ this ->configuration ->subSplit ->sectionPackage , $ split ) . $ this ->configuration ->destination ->test ,
490
521
$ namespaceTest ,
@@ -498,7 +529,6 @@ private function subSplitClient(string $namespace, string $namespaceTest, string
498
529
499
530
$ this ->statusOutput ->advanceStep ('generating_operations ' );
500
531
}
501
-
502
532
$ this ->statusOutput ->markStepDone ('generating_operations ' );
503
533
504
534
$ webHooksHydrators = [];
@@ -527,7 +557,6 @@ private function subSplitClient(string $namespace, string $namespaceTest, string
527
557
$ this ->statusOutput ->advanceStep ('gathering_unknown_schemas ' );
528
558
}
529
559
}
530
-
531
560
$ this ->statusOutput ->markStepDone ('gathering_unknown_schemas ' );
532
561
533
562
$ sortedSchemas = [];
@@ -594,25 +623,43 @@ private function subSplitClient(string $namespace, string $namespaceTest, string
594
623
595
624
$ this ->statusOutput ->advanceStep ('generating_schemas ' );
596
625
}
597
-
598
626
$ this ->statusOutput ->markStepDone ('generating_schemas ' );
599
627
600
628
$ client = \ApiClients \Tools \OpenApiClientGenerator \Gatherer \Client::gather ($ this ->spec , ...$ paths );
629
+ $ routers = new Client \Routers ();
601
630
602
631
$ this ->statusOutput ->markStepDone ('generating_clientinterface ' );
603
-
604
632
yield from ClientInterface::generate (
633
+ $ this ->configuration ,
605
634
$ this ->configuration ->subSplit ->subSplitsDestination . DIRECTORY_SEPARATOR . $ this ->splitPathPrefix ($ this ->configuration ->subSplit ->rootPackage , '' ) . $ this ->configuration ->destination ->source ,
606
635
$ namespace ,
607
636
$ operations ,
608
637
);
609
638
610
639
$ this ->statusOutput ->markStepDone ('generating_client ' );
611
-
612
640
yield from Client::generate (
641
+ $ this ->configuration ,
613
642
$ this ->configuration ->subSplit ->subSplitsDestination . DIRECTORY_SEPARATOR . $ this ->splitPathPrefix ($ this ->configuration ->subSplit ->rootPackage , '' ) . $ this ->configuration ->destination ->source ,
614
643
$ namespace ,
615
644
$ client ,
645
+ $ routers ,
646
+ );
647
+
648
+ $ this ->statusOutput ->markStepDone ('generating_operationsinterface_entry_point ' );
649
+ yield from OperationsInterface::generate (
650
+ $ this ->configuration ,
651
+ $ this ->configuration ->subSplit ->subSplitsDestination . DIRECTORY_SEPARATOR . $ this ->splitPathPrefix ($ this ->configuration ->subSplit ->rootPackage , '' ) . $ this ->configuration ->destination ->source ,
652
+ $ namespace ,
653
+ $ operations ,
654
+ );
655
+
656
+ $ this ->statusOutput ->markStepDone ('generating_operations_entry_point ' );
657
+ yield from Operations::generate (
658
+ $ this ->configuration ,
659
+ $ this ->configuration ->subSplit ->subSplitsDestination . DIRECTORY_SEPARATOR . $ this ->splitPathPrefix ($ this ->configuration ->subSplit ->rootPackage , '' ) . $ this ->configuration ->destination ->source ,
660
+ $ namespace ,
661
+ $ operations ,
662
+ $ routers ,
616
663
);
617
664
618
665
$ this ->statusOutput ->itemForStep ('generating_webhooks ' , count ($ webHooks ));
@@ -636,11 +683,9 @@ private function subSplitClient(string $namespace, string $namespaceTest, string
636
683
637
684
$ this ->statusOutput ->advanceStep ('generating_webhooks ' );
638
685
}
639
-
640
686
$ this ->statusOutput ->markStepDone ('generating_webhooks ' );
641
687
642
688
$ this ->statusOutput ->markStepDone ('generating_webhooks_entry_point ' );
643
-
644
689
yield from WebHooks::generate (
645
690
$ this ->configuration ->subSplit ->subSplitsDestination . DIRECTORY_SEPARATOR . $ this ->splitPathPrefix ($ this ->configuration ->subSplit ->rootPackage , '' ) . $ this ->configuration ->destination ->source ,
646
691
$ namespace ,
@@ -660,11 +705,9 @@ private function subSplitClient(string $namespace, string $namespaceTest, string
660
705
661
706
$ this ->statusOutput ->advanceStep ('generating_hydrators ' );
662
707
}
663
-
664
708
$ this ->statusOutput ->markStepDone ('generating_hydrators ' );
665
709
666
710
$ this ->statusOutput ->markStepDone ('generating_hydrators_entry_point ' );
667
-
668
711
yield from Hydrators::generate (
669
712
$ this ->configuration ->subSplit ->subSplitsDestination . DIRECTORY_SEPARATOR . $ this ->splitPathPrefix ($ this ->configuration ->subSplit ->rootPackage , '' ) . $ this ->configuration ->destination ->source ,
670
713
$ namespace ,
@@ -765,7 +808,6 @@ private function subSplitClient(string $namespace, string $namespaceTest, string
765
808
);
766
809
$ this ->statusOutput ->advanceStep ('generating_templates_files_subsplit_package ' );
767
810
}
768
-
769
811
$ this ->statusOutput ->markStepDone ('generating_templates_files_subsplit_package ' );
770
812
771
813
$ this ->statusOutput ->markStepDone ('generating_subsplit_configuration ' );
0 commit comments