Fixup generation of Javascript samples

The generation code was ignoring top-level aliases for any language config that
contained "java", which included "javascript", a completely different language.

Changed this to be those configs based on the JavaAbstractGenerator class.
This commit is contained in:
Benjamin Douglas
2017-04-17 17:50:01 -07:00
parent 73454e95dc
commit 07ba1eb6f8
25 changed files with 868 additions and 11 deletions

View File

@@ -3,6 +3,7 @@ package io.swagger.codegen;
import com.samskivert.mustache.Mustache;
import com.samskivert.mustache.Template;
import io.swagger.codegen.ignore.CodegenIgnoreProcessor;
import io.swagger.codegen.languages.AbstractJavaCodegen;
import io.swagger.models.*;
import io.swagger.models.auth.OAuth2Definition;
import io.swagger.models.auth.SecuritySchemeDefinition;
@@ -319,9 +320,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
continue;
}
Map<String, Object> modelTemplate = (Map<String, Object>) ((List<Object>) models.get("models")).get(0);
if (config.getName().contains("java") || config.getName().contains("jaxrs")
|| config.getName().contains("spring") || config.getName().endsWith("4j")
|| config.getName().equals("inflector")) {
if (config instanceof AbstractJavaCodegen) {
// Special handling of aliases only applies to Java
if (modelTemplate != null && modelTemplate.containsKey("model")) {
CodegenModel m = (CodegenModel) modelTemplate.get("model");