Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix duplicated imports in typescript models #1242

Merged
merged 2 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
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 @@ -6,6 +6,8 @@
import io.swagger.codegen.v3.CodegenOperation;
import io.swagger.codegen.v3.CodegenProperty;
import io.swagger.codegen.v3.SupportingFile;
import io.swagger.v3.oas.models.media.BooleanSchema;
import io.swagger.v3.oas.models.media.Schema;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
Expand All @@ -15,6 +17,7 @@
import java.util.Map;
import java.util.TreeSet;

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 @@ -117,6 +120,16 @@ public void processOpts() {
addNpmPackageGeneration();
}

protected void processMapSchema(CodegenModel codegenModel, String name, Schema schema) {
final Map<String, Schema> properties = new HashMap<>(schema.getProperties());
if (schema.getAdditionalProperties() instanceof Schema) {
properties.put("additionalProperties", (Schema) schema.getAdditionalProperties());
} else if (schema.getAdditionalProperties() instanceof Boolean) {
properties.put("additionalProperties", new BooleanSchema());
}
addVars(codegenModel, properties, schema.getRequired());
}

@Override
public Map<String, Object> postProcessOperations(Map<String, Object> operations) {
boolean hasImports = operations.get("hasImport") != null && Boolean.parseBoolean(operations.get("hasImport").toString());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
{{#imports}}{{.}},{{/imports}}
} from ".";

/**
/**
* {{{description}}}
*
* @export
Expand Down