forked from loafle/openapi-generator-original
updated basePath, contextPath
This commit is contained in:
parent
64fbcb6045
commit
dd78de1ed8
@ -126,7 +126,14 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
|||||||
operation.putAll(config.additionalProperties());
|
operation.putAll(config.additionalProperties());
|
||||||
operation.put("classname", config.toApiName(tag));
|
operation.put("classname", config.toApiName(tag));
|
||||||
operation.put("classVarName", config.toApiVarName(tag));
|
operation.put("classVarName", config.toApiVarName(tag));
|
||||||
|
|
||||||
allOperations.add(new HashMap<String, Object>(operation));
|
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()) {
|
for(String templateName : config.apiTemplateFiles().keySet()) {
|
||||||
String suffix = config.apiTemplateFiles().get(templateName);
|
String suffix = config.apiTemplateFiles().get(templateName);
|
||||||
String filename = config.apiFileFolder() +
|
String filename = config.apiFileFolder() +
|
||||||
@ -160,9 +167,11 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
|||||||
|
|
||||||
Map<String, Object> apis = new HashMap<String, Object>();
|
Map<String, Object> apis = new HashMap<String, Object>();
|
||||||
apis.put("apis", allOperations);
|
apis.put("apis", allOperations);
|
||||||
if(swagger.getBasePath() != null) {
|
if(swagger.getHost() != null) {
|
||||||
bundle.put("basePath", basePath);
|
bundle.put("host", swagger.getHost());
|
||||||
}
|
}
|
||||||
|
bundle.put("basePath", basePath);
|
||||||
|
bundle.put("contextPath", contextPath);
|
||||||
bundle.put("apiInfo", apis);
|
bundle.put("apiInfo", apis);
|
||||||
bundle.put("models", allModels);
|
bundle.put("models", allModels);
|
||||||
bundle.put("apiFolder", config.apiPackage().replace('.', File.separatorChar));
|
bundle.put("apiFolder", config.apiPackage().replace('.', File.separatorChar));
|
||||||
|
@ -11,7 +11,7 @@ public class ScalaClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
protected String groupId = "com.wordnik";
|
protected String groupId = "com.wordnik";
|
||||||
protected String artifactId = "swagger-client";
|
protected String artifactId = "swagger-client";
|
||||||
protected String artifactVersion = "1.0.0";
|
protected String artifactVersion = "1.0.0";
|
||||||
protected String sourceFolder = "src/main/java";
|
protected String sourceFolder = "src/main/scala";
|
||||||
protected String authScheme = "";
|
protected String authScheme = "";
|
||||||
protected boolean authPreemptive = false;
|
protected boolean authPreemptive = false;
|
||||||
protected boolean asyncHttpClient = !authScheme.isEmpty();
|
protected boolean asyncHttpClient = !authScheme.isEmpty();
|
||||||
|
@ -17,6 +17,7 @@ import scala.collection.JavaConverters._
|
|||||||
import scala.collection.mutable.HashMap
|
import scala.collection.mutable.HashMap
|
||||||
|
|
||||||
import com.fasterxml.jackson.module.scala.DefaultScalaModule
|
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.core.JsonGenerator.Feature
|
||||||
import com.fasterxml.jackson.databind._
|
import com.fasterxml.jackson.databind._
|
||||||
import com.fasterxml.jackson.annotation._
|
import com.fasterxml.jackson.annotation._
|
||||||
@ -26,6 +27,7 @@ object ScalaJsonUtil {
|
|||||||
def getJsonMapper = {
|
def getJsonMapper = {
|
||||||
val mapper = new ObjectMapper()
|
val mapper = new ObjectMapper()
|
||||||
mapper.registerModule(new DefaultScalaModule())
|
mapper.registerModule(new DefaultScalaModule())
|
||||||
|
mapper.registerModule(new JodaModule());
|
||||||
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||||
mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT)
|
mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT)
|
||||||
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
|
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user