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

added option to ignore import mappings. #9972

Merged
merged 1 commit into from
Jan 11, 2020
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 @@ -75,6 +75,7 @@ public class Generate implements Runnable {
protected String ignoreFileOverride;
protected Boolean removeOperationIdPrefix;
protected Boolean disableExamples;
protected Boolean ignoreImportMappings;
private String url;
private List<CodegenArgument> codegenArguments;

Expand Down Expand Up @@ -218,6 +219,10 @@ public void setDisableExamples(Boolean disableExamples) {
this.disableExamples = disableExamples;
}

public void setIgnoreImportMappings(Boolean ignoreImportMappings) {
this.ignoreImportMappings = ignoreImportMappings;
}

@Override
public void run() {

Expand Down Expand Up @@ -333,6 +338,10 @@ public void run() {
additionalProperties.add(String.format("%s=%s", CodegenConstants.DISABLE_EXAMPLES_OPTION, disableExamples.toString()));
}

if (ignoreImportMappings != null) {
additionalProperties.add(String.format("%s=%s", CodegenConstants.IGNORE_IMPORT_MAPPING_OPTION, Boolean.parseBoolean(ignoreImportMappings.toString())));
}

if (CodegenConstants.MUSTACHE_TEMPLATE_ENGINE.equalsIgnoreCase(templateEngine)) {
additionalProperties.add(String.format("%s=%s", CodegenConstants.TEMPLATE_ENGINE, CodegenConstants.MUSTACHE_TEMPLATE_ENGINE));
} else {
Expand Down
5 changes: 5 additions & 0 deletions modules/swagger-codegen-cli/src/main/resources/oas3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ components:
title: "import mappings"
description: "specifies mappings between a given class and the import that should be used for that class in the format of type=import,type=import. You can also have multiple occurrences of this option."
x-option: "--import-mappings"
ignoreImportMappings:
type: "boolean"
title: "ignore import mapping"
description: "allow generate model classes using names previously listed on import mappings."
x-option: "--ignore-import-mapping"
invokerPackage:
type: "string"
title: "invoker package"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ public static enum ENUM_PROPERTY_NAMING_TYPE {camelCase, PascalCase, snake_case,

public static final String TEMPLATE_ENGINE = "templateEngine";
public static final String DISABLE_EXAMPLES_OPTION = "disableExample";
public static final String IGNORE_IMPORT_MAPPING_OPTION = "ignoreImportMappings";

public static final String IS_ENUM_EXT_NAME = PREFIX_IS + "enum";
public static final String IS_ALIAS_EXT_NAME = PREFIX_IS + "alias";
Expand Down