Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TreeSet;
import java.util.stream.Collectors;

import static io.swagger.codegen.v3.CodegenConstants.IS_CONTAINER_EXT_NAME;
import static io.swagger.codegen.v3.generators.handlebars.ExtensionHelper.getBooleanValue;

public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodegen {
Expand Down Expand Up @@ -190,8 +189,10 @@ public Map<String, Object> postProcessModels(Map<String, Object> objs) {
// Deduce the model file name in kebab case
cm.classFilename = cm.classname.replaceAll("([a-z0-9])([A-Z])", "$1-$2").toLowerCase(Locale.ROOT);

//processed enum names
cm.imports = new TreeSet<String>(cm.imports);
// Collect imports (don't add self referencing imports to the current model)
cm.imports = cm.imports.stream().filter(importClass -> !importClass.equals(cm.classname)).collect(Collectors.toSet());

// process enum names
// name enum with model name, e.g. StatusEnum => PetStatusEnum
for (CodegenProperty var : cm.vars) {
if (getBooleanValue(var, CodegenConstants.IS_ENUM_EXT_NAME)) {
Expand Down