This commit is contained in:
wing328
2017-06-07 20:04:12 +08:00
7 changed files with 25 additions and 5 deletions

View File

@@ -10,6 +10,8 @@ import io.swagger.codegen.CodegenType;
import io.swagger.codegen.DefaultCodegen;
import io.swagger.codegen.SupportingFile;
import io.swagger.models.Info;
import org.yaml.snakeyaml.error.Mark;
import io.swagger.codegen.utils.Markdown;
import io.swagger.models.Model;
import io.swagger.models.Operation;
import io.swagger.models.Swagger;
@@ -153,6 +155,8 @@ public class StaticHtml2Generator extends DefaultCodegen implements CodegenConfi
additionalProperties.put("jsProjectName", jsProjectName);
additionalProperties.put("jsModuleName", jsModuleName);
preparHtmlForGlobalDescription(swagger);
}
@Override
@@ -195,6 +199,21 @@ public class StaticHtml2Generator extends DefaultCodegen implements CodegenConfi
return op;
}
/**
* Parse Markdown to HTML for the main "Description" attribute
*
* @param swagger The base object containing the global description through "Info" class
* @return Void
*/
private void preparHtmlForGlobalDescription(Swagger swagger) {
String currentDescription = swagger.getInfo().getDescription();
if (currentDescription != null && !currentDescription.isEmpty()) {
Markdown markInstance = new Markdown();
swagger.getInfo().setDescription( markInstance.toHtml(currentDescription) );
} else {
LOGGER.error("Swagger object description is empty [" + swagger.getInfo().getTitle() + "]");
}
}
private String sanitizePath(String p) {
//prefer replace a ', instead of a fuLL URL encode for readability

View File

@@ -122,7 +122,7 @@ pplx::task<web::http::http_response> ApiClient::callApi(
web::json::value body_data = web::json::value::object();
for (auto& kvp : formParams)
{
body_data[U(kvp.first)] = ModelBase::toJson(kvp.second);
body_data[kvp.first] = ModelBase::toJson(kvp.second);
}
request.set_body(body_data);
}

View File

@@ -273,7 +273,7 @@ int32_t ModelBase::int32_tFromJson(web::json::value& val)
}
float ModelBase::floatFromJson(web::json::value& val)
{
return val.as_double();
return static_cast<float>(val.as_double());
}
utility::string_t ModelBase::stringFromJson(web::json::value& val)
{

View File

@@ -182,7 +182,7 @@
<div class="app-desc">Version: {{{version}}}</div>
{{/version}}
<hr>
<p class="marked">{{appDescription}}</p>
<div>{{{appDescription}}}</div>
</div>
</div>
<div id="sections">

View File

@@ -0,0 +1 @@
2.2.3-SNAPSHOT

View File

@@ -134,7 +134,7 @@ pplx::task<web::http::http_response> ApiClient::callApi(
web::json::value body_data = web::json::value::object();
for (auto& kvp : formParams)
{
body_data[U(kvp.first)] = ModelBase::toJson(kvp.second);
body_data[kvp.first] = ModelBase::toJson(kvp.second);
}
request.set_body(body_data);
}

View File

@@ -285,7 +285,7 @@ int32_t ModelBase::int32_tFromJson(web::json::value& val)
}
float ModelBase::floatFromJson(web::json::value& val)
{
return val.as_double();
return static_cast<float>(val.as_double());
}
utility::string_t ModelBase::stringFromJson(web::json::value& val)
{