forked from loafle/openapi-generator-original
Merge branch 'master' of github.com:wordnik/swagger-codegen
This commit is contained in:
commit
11d1b8fcd4
@ -7,7 +7,7 @@ name := "swagger-codegen"
|
||||
|
||||
version := "2.0.10-SNAPSHOT"
|
||||
|
||||
scalaVersion := "2.9.1"
|
||||
scalaVersion := "2.10.0"
|
||||
|
||||
javacOptions ++= Seq("-target", "1.6", "-source", "1.6", "-Xlint:unchecked", "-Xlint:deprecation")
|
||||
|
||||
|
@ -60,4 +60,16 @@ function goToAnchor() {
|
||||
window.scrollTo(0,$('a[name='+anchor+']').offset().top - 80);
|
||||
}
|
||||
}
|
||||
function resize()
|
||||
{
|
||||
$(".sidebar").css('height', $(window).height() -60);
|
||||
$("#content-window").css('height', $(window).height() -60);
|
||||
|
||||
}
|
||||
$(function(){
|
||||
window.onresize = resize;
|
||||
resize();
|
||||
$(window).bind('hashchange', function() {
|
||||
choose(window.location.href.toString());
|
||||
});
|
||||
});
|
||||
|
@ -41,10 +41,10 @@ public class {{classname}} {
|
||||
{{/requiredParamCount}}
|
||||
|
||||
{{#queryParams}}if(!"null".equals(String.valueOf({{paramName}})))
|
||||
queryParams.put("{{paramName}}", String.valueOf({{paramName}}));
|
||||
queryParams.put("{{baseName}}", String.valueOf({{paramName}}));
|
||||
{{/queryParams}}
|
||||
|
||||
{{#headerParams}}headerParams.put("{{paramName}}", {{paramName}});
|
||||
{{#headerParams}}headerParams.put("{{baseName}}", {{paramName}});
|
||||
{{/headerParams}}
|
||||
|
||||
String contentType = "application/json";
|
||||
|
@ -159,7 +159,7 @@ class ApiClient:
|
||||
instance = objClass()
|
||||
|
||||
for attr, attrType in instance.swaggerTypes.iteritems():
|
||||
if attr in obj:
|
||||
if obj is not None and attr in obj and type(obj) in [list, dict]:
|
||||
value = obj[attr]
|
||||
if attrType in ['str', 'int', 'long', 'float', 'bool']:
|
||||
attrType = eval(attrType)
|
||||
|
@ -93,6 +93,11 @@ class BasicJavaGenerator extends BasicGenerator {
|
||||
// file suffix
|
||||
override def fileSuffix = ".java"
|
||||
|
||||
override def toVarName(name: String): String = {
|
||||
val paramName = name.replaceAll("[^a-zA-Z0-9_]","")
|
||||
super.toVarName(paramName)
|
||||
}
|
||||
|
||||
// response classes
|
||||
override def processResponseClass(responseClass: String): Option[String] = {
|
||||
responseClass match {
|
||||
|
@ -209,6 +209,7 @@ class Codegen(config: CodegenConfig) {
|
||||
val formParams = new ListBuffer[AnyRef]
|
||||
var paramList = new ListBuffer[HashMap[String, AnyRef]]
|
||||
var errorList = new ListBuffer[HashMap[String, AnyRef]]
|
||||
var bodyParamRequired: Option[String] = Some("true")
|
||||
|
||||
if (operation.responseMessages != null) {
|
||||
operation.responseMessages.foreach(param => {
|
||||
@ -256,8 +257,9 @@ class Codegen(config: CodegenConfig) {
|
||||
params += "baseName" -> "body"
|
||||
param.required match {
|
||||
case true => params += "required" -> "true"
|
||||
case _ =>
|
||||
case _ => bodyParamRequired = None
|
||||
}
|
||||
|
||||
bodyParam = Some("body")
|
||||
bodyParams += params.clone
|
||||
}
|
||||
@ -353,6 +355,7 @@ class Codegen(config: CodegenConfig) {
|
||||
"notes" -> operation.notes,
|
||||
"deprecated" -> operation.`deprecated`,
|
||||
"bodyParam" -> bodyParam,
|
||||
"bodyParamRequired" -> bodyParamRequired,
|
||||
"emptyBodyParam" -> (if (writeMethods contains operation.method.toUpperCase) "{}" else ""),
|
||||
"allParams" -> sp,
|
||||
"bodyParams" -> bodyParams.toList,
|
||||
|
@ -87,6 +87,7 @@ object SwaggerSerializers {
|
||||
new ResourceListingSerializer +
|
||||
new ApiListingSerializer
|
||||
}
|
||||
case _ => throw new IllegalArgumentException("%s is not a valid Swagger version".format(version))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user