mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-05-17 08:31:23 +00:00
Allowing generators to be aware of original inputSpec path (#3592)
* Enabling knowledge of inputSpec path for custom generators * Enabling knowledge of inputSpec path for custom generators * Enabling direct use of "inputSpec" property in templates * Fixing spaces
This commit is contained in:
@@ -79,6 +79,10 @@ public interface CodegenConfig {
|
||||
|
||||
List<SupportingFile> supportingFiles();
|
||||
|
||||
String getInputSpec();
|
||||
|
||||
void setInputSpec(String inputSpec);
|
||||
|
||||
String getOutputDir();
|
||||
|
||||
void setOutputDir(String dir);
|
||||
|
||||
@@ -73,7 +73,8 @@ import java.util.regex.Pattern;
|
||||
|
||||
public class DefaultCodegen {
|
||||
protected static final Logger LOGGER = LoggerFactory.getLogger(DefaultCodegen.class);
|
||||
|
||||
|
||||
protected String inputSpec;
|
||||
protected String outputFolder = "";
|
||||
protected Set<String> defaultIncludes = new HashSet<String>();
|
||||
protected Map<String, String> typeMapping = new HashMap<String, String>();
|
||||
@@ -507,6 +508,14 @@ public class DefaultCodegen {
|
||||
return outputFolder();
|
||||
}
|
||||
|
||||
public String getInputSpec() {
|
||||
return inputSpec;
|
||||
}
|
||||
|
||||
public void setInputSpec(String inputSpec) {
|
||||
this.inputSpec = inputSpec;
|
||||
}
|
||||
|
||||
public void setTemplateDir(String templateDir) {
|
||||
this.templateDir = templateDir;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,8 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
|
||||
config.additionalProperties().put("generatedDate", DateTime.now().toString());
|
||||
config.additionalProperties().put("generatorClass", config.getClass().toString());
|
||||
|
||||
config.additionalProperties().put("inputSpec", config.getInputSpec());
|
||||
|
||||
if (swagger.getInfo() != null) {
|
||||
Info info = swagger.getInfo();
|
||||
if (info.getTitle() != null) {
|
||||
|
||||
@@ -352,6 +352,7 @@ public class CodegenConfigurator {
|
||||
|
||||
CodegenConfig config = CodegenConfigLoader.forName(lang);
|
||||
|
||||
config.setInputSpec(inputSpec);
|
||||
config.setOutputDir(outputDir);
|
||||
config.setSkipOverwrite(skipOverwrite);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user