From bb9073209fcb6a80de8a63b1f4f869cab388dfda Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 30 Jul 2024 08:45:40 +0200 Subject: [PATCH] i give up --- .../main/java/com/algolia/codegen/AlgoliaGoGenerator.java | 2 ++ .../java/com/algolia/codegen/AlgoliaScalaGenerator.java | 1 - .../java/com/algolia/codegen/AlgoliaSwiftGenerator.java | 1 - .../java/com/algolia/codegen/utils/OrphanDestroyer.java | 6 +----- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/generators/src/main/java/com/algolia/codegen/AlgoliaGoGenerator.java b/generators/src/main/java/com/algolia/codegen/AlgoliaGoGenerator.java index 2fd5a40508..670c0a267b 100644 --- a/generators/src/main/java/com/algolia/codegen/AlgoliaGoGenerator.java +++ b/generators/src/main/java/com/algolia/codegen/AlgoliaGoGenerator.java @@ -43,6 +43,8 @@ public void processOpts() { typeMapping.put("object", "map[string]any"); typeMapping.put("AnyType", "any"); + modelNameMapping.put("range", "modelRange"); + apiTestTemplateFiles.clear(); modelTestTemplateFiles.clear(); apiDocTemplateFiles.clear(); diff --git a/generators/src/main/java/com/algolia/codegen/AlgoliaScalaGenerator.java b/generators/src/main/java/com/algolia/codegen/AlgoliaScalaGenerator.java index 90ab06a19d..a434821b16 100644 --- a/generators/src/main/java/com/algolia/codegen/AlgoliaScalaGenerator.java +++ b/generators/src/main/java/com/algolia/codegen/AlgoliaScalaGenerator.java @@ -140,7 +140,6 @@ public Map postProcessAllModels(Map objs) @Override public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List models) { OperationsMap operations = super.postProcessOperationsWithModels(objs, models); - OrphanDestroyer.removeOrphans(this, operations, models, true); Helpers.removeHelpers(operations); GenericPropagator.propagateGenericsToOperations(operations, models); return operations; diff --git a/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java b/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java index 16dc6e78b1..fe2dd01b3f 100644 --- a/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java +++ b/generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java @@ -286,7 +286,6 @@ public void processOpenAPI(OpenAPI openAPI) { @Override public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List models) { OperationsMap operations = super.postProcessOperationsWithModels(objs, models); - OrphanDestroyer.removeOrphans(this, operations, models); Helpers.removeHelpers(operations); GenericPropagator.propagateGenericsToOperations(operations, models); return operations; diff --git a/generators/src/main/java/com/algolia/codegen/utils/OrphanDestroyer.java b/generators/src/main/java/com/algolia/codegen/utils/OrphanDestroyer.java index 29a23a748e..1e55d8b826 100644 --- a/generators/src/main/java/com/algolia/codegen/utils/OrphanDestroyer.java +++ b/generators/src/main/java/com/algolia/codegen/utils/OrphanDestroyer.java @@ -37,15 +37,12 @@ private void exploreProperties(CodegenModel model, List propert for (CodegenProperty property : properties) { CodegenModel propModel = propertyToModel(property); if (propModel != null && !visitedModels.contains(propModel.name)) { - System.out.println("Visiting property: " + propModel.name + " from " + model.name); + visitedModels.add(property.openApiType); visitedModels.add(propModel.name); visitModelRecursive(propModel); } CodegenModel itemsModel = propertyToModel(property.mostInnerItems); if (itemsModel != null && !visitedModels.contains(itemsModel.name)) { - System.out.println( - "Visiting item: " + itemsModel.name + " from " + model.name + " original name " + property.mostInnerItems.openApiType - ); // In csharp the real model name varies if its part of the modelMapping so we have to add // both visitedModels.add(property.mostInnerItems.openApiType); @@ -125,7 +122,6 @@ public static void removeOrphans(CodegenConfig config, OperationsMap operations, File file = new File(filename); if (file.exists()) { file.delete(); - System.out.println("Removed orphan model: " + modelName); } } }