@@ -545,7 +545,7 @@ public function generate(string $target): void
545545 'contactURL ' => $ this ->spec ->getContactURL (),
546546 'contactEmail ' => $ this ->spec ->getContactEmail (),
547547 'services ' => $ this ->spec ->getServices (),
548- 'enums ' => $ this ->spec ->getEnumNames (),
548+ 'enums ' => $ this ->spec ->getEnums (),
549549 'definitions ' => $ this ->spec ->getDefinitions (),
550550 'global ' => [
551551 'headers ' => $ this ->spec ->getGlobalHeaders (),
@@ -636,24 +636,10 @@ public function generate(string $target): void
636636 }
637637 break ;
638638 case 'enum ' :
639- foreach ($ this ->spec ->getServices () as $ key => $ service ) {
640- $ methods = $ this -> spec -> getMethods ( $ key ) ;
639+ foreach ($ this ->spec ->getEnums () as $ key => $ enum ) {
640+ $ params [ ' enum ' ] = $ enum ;
641641
642- foreach ($ methods as $ method ) {
643- $ parameters = $ method ['parameters ' ]['all ' ];
644-
645- foreach ($ parameters as $ parameter ) {
646- // Check if the enum field is defined
647- if (isset ($ parameter ['enumValues ' ])) {
648- $ params ['enum ' ] = [
649- 'name ' => $ parameter ['enumName ' ] ?? $ parameter ['name ' ],
650- 'enum ' => $ parameter ['enumValues ' ],
651- 'keys ' => $ parameter ['enumKeys ' ],
652- ];
653- $ this ->render ($ template , $ destination , $ block , $ params , $ minify );
654- }
655- }
656- }
642+ $ this ->render ($ template , $ destination , $ block , $ params , $ minify );
657643 }
658644 break ;
659645 }
0 commit comments