mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 19:08:52 +00:00
Merge pull request #1988 from wing328/maven_build_quiet3
Rebase on latest master for "Using logger instead of System.out #1871"
This commit is contained in:
commit
564fa04f7c
@ -33,7 +33,7 @@ import static com.google.common.base.Joiner.on;
|
||||
"specify, and includes default templates to include.")
|
||||
public class Meta implements Runnable {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(Meta.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Meta.class);
|
||||
|
||||
private static final String TEMPLATE_DIR_CLASSPATH = "codegen";
|
||||
private static final String MUSTACHE_EXTENSION = ".mustache";
|
||||
@ -53,7 +53,7 @@ public class Meta implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
final File targetDir = new File(outputFolder);
|
||||
LOG.info("writing to folder [{}]", targetDir.getAbsolutePath());
|
||||
LOGGER.info("writing to folder [{}]", targetDir.getAbsolutePath());
|
||||
|
||||
String mainClass = CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, name) + "Generator";
|
||||
|
||||
@ -108,13 +108,13 @@ public class Meta implements Runnable {
|
||||
String formatted = template;
|
||||
|
||||
if (support.templateFile.endsWith(MUSTACHE_EXTENSION)) {
|
||||
LOG.info("writing file to {}", outputFile.getAbsolutePath());
|
||||
LOGGER.info("writing file to {}", outputFile.getAbsolutePath());
|
||||
formatted = Mustache.compiler().withLoader(loader(generator))
|
||||
.defaultValue("")
|
||||
.compile(template)
|
||||
.execute(data);
|
||||
} else {
|
||||
LOG.info("copying file to {}", outputFile.getAbsolutePath());
|
||||
LOGGER.info("copying file to {}", outputFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
FileUtils.writeStringToFile(outputFile, formatted);
|
||||
|
@ -7,11 +7,16 @@ import java.io.File;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ConfigParser {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigParser.class);
|
||||
|
||||
public static Config read(String location) {
|
||||
|
||||
System.out.println("reading config from " + location);
|
||||
LOGGER.info("reading config from " + location);
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
@ -27,11 +32,11 @@ public class ConfigParser {
|
||||
if (optionNode.getValue().isValueNode()) {
|
||||
config.setOption(optionNode.getKey(), optionNode.getValue().asText());
|
||||
} else {
|
||||
System.out.println("omitting non-value node " + optionNode.getKey());
|
||||
LOGGER.warn("omitting non-value node " + optionNode.getKey());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
LOGGER.error(e.getMessage());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -10,13 +10,18 @@ import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
import java.util.Scanner;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public abstract class AbstractGenerator {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractGenerator.class);
|
||||
|
||||
@SuppressWarnings("static-method")
|
||||
public File writeToFile(String filename, String contents) throws IOException {
|
||||
System.out.println("writing file " + filename);
|
||||
LOGGER.info("writing file " + filename);
|
||||
File output = new File(filename);
|
||||
|
||||
if (output.getParent() != null && !new File(output.getParent()).exists()) {
|
||||
@ -37,10 +42,10 @@ public abstract class AbstractGenerator {
|
||||
if (reader == null) {
|
||||
throw new RuntimeException("no file found");
|
||||
}
|
||||
java.util.Scanner s = new java.util.Scanner(reader).useDelimiter("\\A");
|
||||
Scanner s = new Scanner(reader).useDelimiter("\\A");
|
||||
return s.hasNext() ? s.next() : "";
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error(e.getMessage());
|
||||
}
|
||||
throw new RuntimeException("can't load template " + name);
|
||||
}
|
||||
@ -53,7 +58,7 @@ public abstract class AbstractGenerator {
|
||||
}
|
||||
return new InputStreamReader(is);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error(e.getMessage());
|
||||
}
|
||||
throw new RuntimeException("can't load template " + name);
|
||||
}
|
||||
|
@ -1,15 +1,5 @@
|
||||
package io.swagger.codegen;
|
||||
|
||||
import config.Config;
|
||||
import config.ConfigParser;
|
||||
import io.swagger.models.Swagger;
|
||||
import io.swagger.parser.SwaggerParser;
|
||||
import org.apache.commons.cli.BasicParser;
|
||||
import org.apache.commons.cli.CommandLine;
|
||||
import org.apache.commons.cli.CommandLineParser;
|
||||
import org.apache.commons.cli.HelpFormatter;
|
||||
import org.apache.commons.cli.Options;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@ -17,12 +7,28 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
import org.apache.commons.cli.BasicParser;
|
||||
import org.apache.commons.cli.CommandLine;
|
||||
import org.apache.commons.cli.CommandLineParser;
|
||||
import org.apache.commons.cli.HelpFormatter;
|
||||
import org.apache.commons.cli.Options;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import config.Config;
|
||||
import config.ConfigParser;
|
||||
import io.swagger.models.Swagger;
|
||||
import io.swagger.parser.SwaggerParser;
|
||||
|
||||
/**
|
||||
* @deprecated use instead {@link io.swagger.codegen.DefaultGenerator}
|
||||
* or cli interface from https://github.com/swagger-api/swagger-codegen/pull/547
|
||||
*/
|
||||
@Deprecated
|
||||
public class Codegen extends DefaultGenerator {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Codegen.class);
|
||||
|
||||
static Map<String, CodegenConfig> configs = new HashMap<String, CodegenConfig>();
|
||||
static String configString;
|
||||
static String debugInfoOptions = "\nThe following additional debug options are available for all codegen targets:" +
|
||||
@ -111,7 +117,7 @@ public class Codegen extends DefaultGenerator {
|
||||
.swagger(swagger);
|
||||
new Codegen().opts(clientOptInput).generate();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,9 +142,9 @@ public class Codegen extends DefaultGenerator {
|
||||
} else {
|
||||
// see if it's a class
|
||||
try {
|
||||
System.out.println("loading class " + name);
|
||||
LOGGER.debug("loading class " + name);
|
||||
Class<?> customClass = Class.forName(name);
|
||||
System.out.println("loaded");
|
||||
LOGGER.debug("loaded");
|
||||
return (CodegenConfig) customClass.newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("can't load class " + name);
|
||||
|
@ -689,7 +689,7 @@ public class DefaultCodegen {
|
||||
} catch (Exception e) {
|
||||
LOGGER.warn("Error obtaining the datatype from RefProperty:" + p + ". Datatype default to Object");
|
||||
datatype = "Object";
|
||||
e.printStackTrace();
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
}
|
||||
} else {
|
||||
if (p != null) {
|
||||
@ -1090,7 +1090,7 @@ public class DefaultCodegen {
|
||||
ArrayProperty ap = (ArrayProperty) p;
|
||||
CodegenProperty cp = fromProperty(property.name, ap.getItems());
|
||||
if (cp == null) {
|
||||
LOGGER.warn("skipping invalid property " + Json.pretty(p));
|
||||
LOGGER.warn("skipping invalid property " + Json.pretty(p));
|
||||
} else {
|
||||
property.baseType = getSwaggerType(p);
|
||||
if (!languageSpecificPrimitives.contains(cp.baseType)) {
|
||||
|
@ -240,7 +240,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
}
|
||||
}
|
||||
if (System.getProperty("debugModels") != null) {
|
||||
System.out.println("############ Model info ############");
|
||||
LOGGER.info("############ Model info ############");
|
||||
Json.prettyPrint(allModels);
|
||||
}
|
||||
|
||||
@ -340,7 +340,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
}
|
||||
}
|
||||
if (System.getProperty("debugOperations") != null) {
|
||||
System.out.println("############ Operation info ############");
|
||||
LOGGER.info("############ Operation info ############");
|
||||
Json.prettyPrint(allOperations);
|
||||
}
|
||||
|
||||
@ -379,7 +379,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
config.postProcessSupportingFileData(bundle);
|
||||
|
||||
if (System.getProperty("debugSupportingFiles") != null) {
|
||||
System.out.println("############ Supporting file info ############");
|
||||
LOGGER.info("############ Supporting file info ############");
|
||||
Json.prettyPrint(bundle);
|
||||
}
|
||||
|
||||
@ -439,10 +439,12 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
File outputFile = new File(outputFilename);
|
||||
OutputStream out = new FileOutputStream(outputFile, false);
|
||||
if (in != null) {
|
||||
System.out.println("writing file " + outputFile);
|
||||
LOGGER.info("writing file " + outputFile);
|
||||
IOUtils.copy(in, out);
|
||||
} else {
|
||||
System.out.println("can't open " + templateFile + " for input"); // FIXME: use LOGGER instead of standart output
|
||||
if (in == null) {
|
||||
LOGGER.error("can't open " + templateFile + " for input");
|
||||
}
|
||||
}
|
||||
files.add(outputFile);
|
||||
}
|
||||
@ -550,7 +552,8 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
public void processOperation(String resourcePath, String httpMethod, Operation operation, Map<String, List<CodegenOperation>> operations, Path path) {
|
||||
if (operation != null) {
|
||||
if (System.getProperty("debugOperations") != null) {
|
||||
LOGGER.debug("processOperation: resourcePath= " + resourcePath + "\t;" + httpMethod + " " + operation + "\n");
|
||||
LOGGER.info("processOperation: resourcePath= " + resourcePath + "\t;" + httpMethod + " " + operation
|
||||
+ "\n");
|
||||
}
|
||||
List<String> tags = operation.getTags();
|
||||
if (tags == null) {
|
||||
|
@ -8,8 +8,11 @@ import org.apache.commons.cli.CommandLineParser;
|
||||
import org.apache.commons.cli.HelpFormatter;
|
||||
import org.apache.commons.cli.Options;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -24,6 +27,9 @@ import java.util.ServiceLoader;
|
||||
*/
|
||||
@Deprecated
|
||||
public class MetaGenerator extends AbstractGenerator {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MetaGenerator.class);
|
||||
|
||||
static Map<String, CodegenConfig> configs = new HashMap<String, CodegenConfig>();
|
||||
static String configString;
|
||||
|
||||
@ -99,7 +105,7 @@ public class MetaGenerator extends AbstractGenerator {
|
||||
usage(options);
|
||||
return;
|
||||
}
|
||||
System.out.println("writing to folder " + outputFolder);
|
||||
LOGGER.info("writing to folder " + outputFolder);
|
||||
File outputFolderLocation = new File(outputFolder);
|
||||
if (!outputFolderLocation.exists()) {
|
||||
outputFolderLocation.mkdirs();
|
||||
@ -163,11 +169,11 @@ public class MetaGenerator extends AbstractGenerator {
|
||||
} else {
|
||||
String template = readTemplate(templateDir + File.separator + support.templateFile);
|
||||
FileUtils.writeStringToFile(new File(outputFilename), template);
|
||||
System.out.println("copying file to " + outputFilename);
|
||||
LOGGER.info("copying file to " + outputFilename);
|
||||
files.add(new File(outputFilename));
|
||||
}
|
||||
} catch (java.io.IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,9 +7,16 @@ import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import config.ConfigParser;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
||||
|
||||
public class AuthParser {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AuthParser.class);
|
||||
|
||||
public static List<AuthorizationValue> parse(String urlEncodedAuthStr) {
|
||||
List<AuthorizationValue> auths = new ArrayList<AuthorizationValue>();
|
||||
@ -38,7 +45,7 @@ public class AuthParser {
|
||||
.append(URLEncoder.encode(v.getValue(), "UTF-8"));
|
||||
} catch (Exception e) {
|
||||
// continue
|
||||
e.printStackTrace();
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
return b.toString();
|
||||
|
@ -36,7 +36,7 @@ import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
||||
*/
|
||||
public class CodegenConfigurator {
|
||||
|
||||
public static final Logger LOG = LoggerFactory.getLogger(CodegenConfigurator.class);
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger(CodegenConfigurator.class);
|
||||
|
||||
private String lang;
|
||||
private String inputSpec;
|
||||
@ -349,7 +349,7 @@ public class CodegenConfigurator {
|
||||
if (!verbose) {
|
||||
return;
|
||||
}
|
||||
LOG.info("\nVERBOSE MODE: ON. Additional debug options are injected" +
|
||||
LOGGER.info("\nVERBOSE MODE: ON. Additional debug options are injected" +
|
||||
"\n - [debugSwagger] prints the swagger specification as interpreted by the codegen" +
|
||||
"\n - [debugModels] prints models passed to the template engine" +
|
||||
"\n - [debugOperations] prints operations passed to the template engine" +
|
||||
@ -392,7 +392,7 @@ public class CodegenConfigurator {
|
||||
try {
|
||||
return Json.mapper().readValue(new File(configFile), CodegenConfigurator.class);
|
||||
} catch (IOException e) {
|
||||
LOG.error("Unable to deserialize config file: " + configFile, e);
|
||||
LOGGER.error("Unable to deserialize config file: " + configFile, e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -4,6 +4,8 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import config.ConfigParser;
|
||||
import io.swagger.codegen.*;
|
||||
import io.swagger.models.HttpMethod;
|
||||
import io.swagger.models.Operation;
|
||||
@ -14,7 +16,13 @@ import io.swagger.util.Yaml;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class FlaskConnexionCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(FlaskConnexionCodegen.class);
|
||||
|
||||
public static final String CONTROLLER_PACKAGE = "controllerPackage";
|
||||
public static final String DEFAULT_CONTROLLER = "defaultController";
|
||||
|
||||
@ -289,7 +297,7 @@ public class FlaskConnexionCodegen extends DefaultCodegen implements CodegenConf
|
||||
try {
|
||||
objs.put("swagger-yaml", Yaml.mapper().writeValueAsString(swagger));
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
for (Map<String, Object> operations : getOperations(objs)) {
|
||||
|
@ -11,7 +11,13 @@ import io.swagger.util.Yaml;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class JavaInflectorServerCodegen extends JavaClientCodegen {
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class JavaInflectorServerCodegen extends JavaClientCodegen implements CodegenConfig {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(JavaInflectorServerCodegen.class);
|
||||
|
||||
protected String title = "Swagger Inflector";
|
||||
|
||||
public JavaInflectorServerCodegen() {
|
||||
@ -164,7 +170,7 @@ public class JavaInflectorServerCodegen extends JavaClientCodegen {
|
||||
try {
|
||||
objs.put("swagger-yaml", Yaml.mapper().writeValueAsString(swagger));
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
return super.postProcessSupportingFileData(objs);
|
||||
|
@ -20,7 +20,13 @@ import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class NodeJSServerCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(NodeJSServerCodegen.class);
|
||||
|
||||
protected String apiVersion = "1.0.0";
|
||||
protected int serverPort = 8080;
|
||||
protected String projectName = "swagger-server";
|
||||
@ -284,7 +290,7 @@ public class NodeJSServerCodegen extends DefaultCodegen implements CodegenConfig
|
||||
});
|
||||
objs.put("swagger-yaml", Yaml.mapper().registerModule(module).writeValueAsString(swagger));
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
for (Map<String, Object> operations : getOperations(objs)) {
|
||||
|
@ -17,7 +17,14 @@ import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class SinatraServerCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SinatraServerCodegen.class);
|
||||
|
||||
protected String gemName;
|
||||
protected String moduleName;
|
||||
protected String gemVersion = "1.0.0";
|
||||
@ -230,7 +237,7 @@ public class SinatraServerCodegen extends DefaultCodegen implements CodegenConfi
|
||||
try {
|
||||
objs.put("swagger-yaml", Yaml.mapper().writeValueAsString(swagger));
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
return super.postProcessSupportingFileData(objs);
|
||||
|
@ -1,16 +1,22 @@
|
||||
package io.swagger.codegen.languages;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.CodegenType;
|
||||
import io.swagger.codegen.DefaultCodegen;
|
||||
import io.swagger.codegen.SupportingFile;
|
||||
import io.swagger.models.Swagger;
|
||||
import io.swagger.util.Json;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class SwaggerGenerator extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SwaggerGenerator.class);
|
||||
|
||||
public SwaggerGenerator() {
|
||||
super();
|
||||
embeddedTemplateDir = templateDir = "swagger";
|
||||
@ -41,9 +47,9 @@ public class SwaggerGenerator extends DefaultCodegen implements CodegenConfig {
|
||||
try {
|
||||
String outputFile = outputFolder + File.separator + "swagger.json";
|
||||
FileUtils.writeStringToFile(new File(outputFile), swaggerString);
|
||||
System.out.println("wrote file to " + outputFile);
|
||||
LOGGER.debug("wrote file to " + outputFile);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,16 +1,22 @@
|
||||
package io.swagger.codegen.languages;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.CodegenType;
|
||||
import io.swagger.codegen.DefaultCodegen;
|
||||
import io.swagger.codegen.SupportingFile;
|
||||
import io.swagger.models.Swagger;
|
||||
import io.swagger.util.Yaml;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class SwaggerYamlGenerator extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SwaggerYamlGenerator.class);
|
||||
|
||||
public SwaggerYamlGenerator() {
|
||||
super();
|
||||
embeddedTemplateDir = templateDir = "swagger";
|
||||
@ -40,9 +46,9 @@ public class SwaggerYamlGenerator extends DefaultCodegen implements CodegenConfi
|
||||
String swaggerString = Yaml.mapper().writeValueAsString(swagger);
|
||||
String outputFile = outputFolder + File.separator + "swagger.yaml";
|
||||
FileUtils.writeStringToFile(new File(outputFile), swaggerString);
|
||||
System.out.println("wrote file to " + outputFile);
|
||||
LOGGER.debug("wrote file to " + outputFile);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
@ -122,7 +122,7 @@ public class Generator {
|
||||
List<File> files = new Codegen().opts(clientOptInput).generate();
|
||||
if (files.size() > 0) {
|
||||
List<File> filesToAdd = new ArrayList<File>();
|
||||
System.out.println("adding to " + outputFolder);
|
||||
LOGGER.debug("adding to " + outputFolder);
|
||||
filesToAdd.add(new File(outputFolder));
|
||||
ZipUtil zip = new ZipUtil();
|
||||
zip.compressFiles(filesToAdd, outputFilename);
|
||||
|
@ -153,7 +153,7 @@ class ObjectSerializer
|
||||
*/
|
||||
public function toFormValue($value)
|
||||
{
|
||||
if ($value instanceof SplFileObject) {
|
||||
if ($value instanceof \SplFileObject) {
|
||||
return $value->getRealPath();
|
||||
} else {
|
||||
return $this->toString($value);
|
||||
|
Loading…
Reference in New Issue
Block a user