@@ -650,25 +650,25 @@ public void postProcessModelProperty(CodegenModel model, CodegenProperty propert
650650 public OperationsMap postProcessOperationsWithModels (OperationsMap objs , List <ModelMap > allModels ) {
651651 super .postProcessOperationsWithModels (objs , allModels );
652652 OperationMap operations = objs .getOperations ();
653- processImports (operations , operations . getOperation ( ));
653+ processImports (operations . getOperation (), imports -> objs . put ( "imports" , imports ));
654654 return objs ;
655655 }
656656
657657 @ Override
658658 public WebhooksMap postProcessWebhooksWithModels (WebhooksMap objs , List <ModelMap > allModels ) {
659659 super .postProcessWebhooksWithModels (objs , allModels );
660660 OperationMap operations = objs .getWebhooks ();
661- processImports (operations , operations . getOperation ( ));
661+ processImports (operations . getOperation (), imports -> objs . put ( "imports" , imports ));
662662 return objs ;
663663 }
664664
665665 /**
666666 * Processes imports for operations or webhooks, applying the same logic to both.
667667 *
668- * @param operations the OperationMap containing the operations
669668 * @param operationList the list of CodegenOperation to process
669+ * @param setImports the handler to apply the processed imports
670670 */
671- private void processImports (OperationMap operations , List <CodegenOperation > operationList ) {
671+ private void processImports (List < CodegenOperation > operationList , java . util . function . Consumer < List <String >> setImports ) {
672672 Set <String > resultImports = new HashSet <>();
673673
674674 for (CodegenOperation op : operationList ) {
@@ -747,7 +747,7 @@ private void processImports(OperationMap operations, List<CodegenOperation> oper
747747 }
748748 }
749749 // for some reason "import" structure is changed ..
750- operations . put ( "imports" , resultImports .stream ().sorted ().collect (Collectors .toList ()));
750+ setImports . accept ( resultImports .stream ().sorted ().collect (Collectors .toList ()));
751751 }
752752
753753 private void addBuiltValueSerializerImport (String type ) {
0 commit comments