Skip to content

Commit

Permalink
i give up
Browse files Browse the repository at this point in the history
  • Loading branch information
millotp committed Jul 30, 2024
1 parent 6f1bd5d commit bb90732
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ public Map<String, ModelsMap> postProcessAllModels(Map<String, ModelsMap> objs)
@Override
public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<ModelMap> models) {
OperationsMap operations = super.postProcessOperationsWithModels(objs, models);
OrphanDestroyer.removeOrphans(this, operations, models, true);
Helpers.removeHelpers(operations);
GenericPropagator.propagateGenericsToOperations(operations, models);
return operations;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ public void processOpenAPI(OpenAPI openAPI) {
@Override
public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<ModelMap> models) {
OperationsMap operations = super.postProcessOperationsWithModels(objs, models);
OrphanDestroyer.removeOrphans(this, operations, models);
Helpers.removeHelpers(operations);
GenericPropagator.propagateGenericsToOperations(operations, models);
return operations;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,12 @@ private void exploreProperties(CodegenModel model, List<CodegenProperty> 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);
Expand Down Expand Up @@ -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);
}
}
}
Expand Down

0 comments on commit bb90732

Please sign in to comment.