minor formatting change (#7503)

This commit is contained in:
William Cheng 2020-09-25 10:16:26 +08:00 committed by GitHub
parent 7b1563326a
commit 5dffbabc74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,10 +40,10 @@ import org.slf4j.LoggerFactory;
import java.io.File;
import java.net.URL;
import java.util.*;
import java.util.regex.*;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static org.openapitools.codegen.utils.OnceLogger.once;
import static org.openapitools.codegen.utils.StringUtils.camelize;
import static org.openapitools.codegen.utils.StringUtils.underscore;
@ -329,7 +329,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
*/
@Override
public String getHelp() {
return "Generates a Rust client/server library (beta) using the swagger-codegen project.";
return "Generates a Rust client/server library (beta) using the openapi-generator project.";
}
@Override
@ -735,7 +735,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
op.vendorExtensions.put("x-operation-id", underscoredOperationId);
op.vendorExtensions.put("x-uppercase-operation-id", underscoredOperationId.toUpperCase(Locale.ROOT));
String vendorExtensionPath = op.path.replace("{", ":").replace("}", "");
op.vendorExtensions.put("x-path",vendorExtensionPath);
op.vendorExtensions.put("x-path", vendorExtensionPath);
op.vendorExtensions.put("x-path-id", pathId);
op.vendorExtensions.put("x-has-path-params", hasPathParams);
op.vendorExtensions.put("x-path-format-string", formatPath);
@ -1300,7 +1300,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
// If we have callbacks, add the callbacks module, otherwise remove it
boolean hasCallbacks = haveCallbacks(bundle);
bundle.put("hasCallbacks", hasCallbacks);
SupportingFile[] callbackFiles = new SupportingFile[] {
SupportingFile[] callbackFiles = new SupportingFile[]{
new SupportingFile("client-callbacks.mustache", "src/client", "callbacks.rs"),
new SupportingFile("server-callbacks.mustache", "src/server", "callbacks.rs"),
new SupportingFile("example-client-server.mustache", "examples/client", "server.rs")
@ -1544,9 +1544,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
// the user than the alternative.
LOGGER.warn("Ignoring additionalProperties (see https://github.com/OpenAPITools/openapi-generator/issues/318) alongside defined properties");
cm.dataType = null;
}
else
{
} else {
cm.dataType = "std::collections::HashMap<String, " + cm.additionalPropertiesType + ">";
}
} else if (cm.dataType != null) {
@ -1635,7 +1633,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig {
// only process files with .rs extension
if ("rs".equals(FilenameUtils.getExtension(file.toString()))) {
try {
Process p = Runtime.getRuntime().exec(new String[] {commandPrefix, file.toString()});
Process p = Runtime.getRuntime().exec(new String[]{commandPrefix, file.toString()});
int exitValue = p.waitFor();
if (exitValue != 0) {
LOGGER.error("Error running the command ({} {}). Exit code: {}", commandPrefix, file.toString(), exitValue);