updated basePath, contextPath

This commit is contained in:
Tony Tam 2015-03-18 09:34:38 -07:00
parent 64fbcb6045
commit dd78de1ed8
3 changed files with 14 additions and 3 deletions

View File

@ -126,7 +126,14 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
operation.putAll(config.additionalProperties());
operation.put("classname", config.toApiName(tag));
operation.put("classVarName", config.toApiVarName(tag));
allOperations.add(new HashMap<String, Object>(operation));
for(int i = 0; i < allOperations.size(); i++) {
Map<String, Object> oo = (Map<String, Object>) allOperations.get(i);
if(i < (allOperations.size() -1))
oo.put("hasMore", "true");
}
for(String templateName : config.apiTemplateFiles().keySet()) {
String suffix = config.apiTemplateFiles().get(templateName);
String filename = config.apiFileFolder() +
@ -160,9 +167,11 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
Map<String, Object> apis = new HashMap<String, Object>();
apis.put("apis", allOperations);
if(swagger.getBasePath() != null) {
bundle.put("basePath", basePath);
if(swagger.getHost() != null) {
bundle.put("host", swagger.getHost());
}
bundle.put("basePath", basePath);
bundle.put("contextPath", contextPath);
bundle.put("apiInfo", apis);
bundle.put("models", allModels);
bundle.put("apiFolder", config.apiPackage().replace('.', File.separatorChar));

View File

@ -11,7 +11,7 @@ public class ScalaClientCodegen extends DefaultCodegen implements CodegenConfig
protected String groupId = "com.wordnik";
protected String artifactId = "swagger-client";
protected String artifactVersion = "1.0.0";
protected String sourceFolder = "src/main/java";
protected String sourceFolder = "src/main/scala";
protected String authScheme = "";
protected boolean authPreemptive = false;
protected boolean asyncHttpClient = !authScheme.isEmpty();

View File

@ -17,6 +17,7 @@ import scala.collection.JavaConverters._
import scala.collection.mutable.HashMap
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import com.fasterxml.jackson.datatype.joda.JodaModule
import com.fasterxml.jackson.core.JsonGenerator.Feature
import com.fasterxml.jackson.databind._
import com.fasterxml.jackson.annotation._
@ -26,6 +27,7 @@ object ScalaJsonUtil {
def getJsonMapper = {
val mapper = new ObjectMapper()
mapper.registerModule(new DefaultScalaModule())
mapper.registerModule(new JodaModule());
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT)
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)