mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-04 14:40:53 +00:00
Merge branch 'spring-resource-file-streams' of https://github.com/LEgregius/swagger-codegen into LEgregius-spring-resource-file-streams2
This commit is contained in:
commit
ba32f66714
@ -157,6 +157,9 @@ public class SpringCodegen extends AbstractJavaCodegen implements BeanValidation
|
|||||||
this.setImplicitHeaders(Boolean.valueOf(additionalProperties.get(IMPLICIT_HEADERS).toString()));
|
this.setImplicitHeaders(Boolean.valueOf(additionalProperties.get(IMPLICIT_HEADERS).toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typeMapping.put("file", "Resource");
|
||||||
|
importMapping.put("Resource", "org.springframework.core.io.Resource");
|
||||||
|
|
||||||
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
|
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
|
||||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||||
|
|
||||||
@ -448,6 +451,32 @@ public class SpringCodegen extends AbstractJavaCodegen implements BeanValidation
|
|||||||
return camelize(name) + "Api";
|
return camelize(name) + "Api";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setParameterExampleValue(CodegenParameter p) {
|
||||||
|
String type = p.baseType;
|
||||||
|
if (type == null) {
|
||||||
|
type = p.dataType;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("File".equals(type)) {
|
||||||
|
String example;
|
||||||
|
|
||||||
|
if (p.defaultValue == null) {
|
||||||
|
example = p.example;
|
||||||
|
} else {
|
||||||
|
example = p.defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (example == null) {
|
||||||
|
example = "/path/to/file";
|
||||||
|
}
|
||||||
|
example = "new org.springframework.core.io.FileSystemResource(new java.io.File(\"" + escapeText(example) + "\"))";
|
||||||
|
p.example = example;
|
||||||
|
} else {
|
||||||
|
super.setParameterExampleValue(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setTitle(String title) {
|
public void setTitle(String title) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user