Skip to content

Commit

Permalink
Merge pull request #10379 from swagger-api/issue-9897
Browse files Browse the repository at this point in the history
added method to verify alias models in generators.
  • Loading branch information
HugoMario authored Jul 11, 2020
2 parents 3c955d7 + a75ff56 commit 44ff4c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,4 +247,8 @@ public interface CodegenConfig {
boolean defaultIgnoreImportMappingOption();

ISchemaHandler getSchemaHandler();

default boolean checkAliasModel() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ public int compare(String o1, String o2) {
continue;
}
Map<String, Object> modelTemplate = (Map<String, Object>) ((List<Object>) models.get("models")).get(0);
if (isAliasVerifierGenerator(config.getName())) {
if (config.checkAliasModel()) {
// Special handling of aliases only applies to Java
if (modelTemplate != null && modelTemplate.containsKey("model")) {
CodegenModel codegenModel = (CodegenModel) modelTemplate.get("model");
Expand Down Expand Up @@ -1112,14 +1112,6 @@ private Map<String, SecurityScheme> getAuthMethods(List<SecurityRequirement> sec
return authMethods;
}

private boolean isAliasVerifierGenerator(String name) {
return name.equalsIgnoreCase("java")
|| name.equalsIgnoreCase("inflector")
|| name.equalsIgnoreCase("csharp")
|| name.equalsIgnoreCase("go")
|| name.equalsIgnoreCase("go-server");
}

private Boolean getCustomOptionBooleanValue(String option) {
List<CodegenArgument> languageArguments = config.getLanguageArguments();
if (languageArguments == null || languageArguments.isEmpty()) {
Expand Down

0 comments on commit 44ff4c3

Please sign in to comment.