Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
1e97563
Fixed enum marshalling & fromValue()
Oct 24, 2016
60c7d90
remove glassfish dependencies and use MSF4J internal implementation f…
sanjeewa-malalgoda Nov 3, 2016
b6eb0eb
add json annotations
jfiala Nov 3, 2016
096cbd5
fix[dart]: multi-word class names work properly now
Nov 4, 2016
f25f6c2
Update pojo.mustache
wienczny Nov 4, 2016
9436ba1
Default added sourceFolder to src/main/java
wienczny Nov 4, 2016
9bd521e
add cli flag to check for jaxb annotations
jfiala Nov 6, 2016
f91ebdf
add CLI-flag for switching Spring-XML or annotation config #4088
jfiala Nov 6, 2016
15f740e
add cli flag for generating jboss depl. descriptor #4088
jfiala Nov 6, 2016
821c54a
add JbossFeature CLI flag to Resteasy #4088
jfiala Nov 6, 2016
460257e
update/add tests #4088
jfiala Nov 6, 2016
ad17654
[aspnet5] Fix broken template directory for deprecated lang (#4142)
jimschubert Nov 7, 2016
7db5391
Merge pull request #4134 from wienczny/patch-2
wing328 Nov 7, 2016
7ba60af
Merge pull request #4131 from wienczny/patch-1
wing328 Nov 7, 2016
e78ce6f
Merge pull request #4059 from markus-wa/issue-4045
wing328 Nov 7, 2016
a1cd019
[ObjC] Fix deprecated JSONModel API usage (#4133)
Nov 7, 2016
7dd774f
Merge branch 'msf4j' of https://github.com/sanjeewa-malalgoda/swagger…
wing328 Nov 7, 2016
46c4eb3
update mxf4j sample
wing328 Nov 7, 2016
7f31763
Merge branch 'master' of https://github.com/swagger-api/swagger-codegen
wing328 Nov 7, 2016
37460ee
Select application/json content-type in python generated client, if *…
mbohlool Nov 7, 2016
c54797b
Merge pull request #4152 from mbohlool/fix_python_client
wing328 Nov 8, 2016
77d3c0c
Merge pull request #4125 from ircecho/multiword
wing328 Nov 8, 2016
935bdfe
better handling of */*
wing328 Nov 8, 2016
d5ced7d
Merge pull request #4155 from wing328/produce_consume_exception
wing328 Nov 8, 2016
cce410c
add vendor extension to handle void response in jaxrs-cxf
wing328 Nov 8, 2016
6d6cfb4
fix[dart]: send ISO8601 dates
Nov 8, 2016
68e1afd
Merge pull request #4158 from wing328/java_null_response_type
wing328 Nov 8, 2016
5899554
Merge pull request #4159 from ircecho/origin/iso8061date
wing328 Nov 9, 2016
b35a525
cleanup tabs #4088
jfiala Nov 9, 2016
3376486
improve api formatting #4088
jfiala Nov 9, 2016
89f2274
refine formatting #4088
jfiala Nov 9, 2016
3870586
refine formatting again #4088
jfiala Nov 9, 2016
012c48f
add separate CLI-flags for controlling junit test features #4088
jfiala Nov 9, 2016
469a9d9
add json annotations
jfiala Nov 3, 2016
1696630
add cli flag to check for jaxb annotations
jfiala Nov 6, 2016
4a5eb8e
add CLI-flag for switching Spring-XML or annotation config #4088
jfiala Nov 6, 2016
b1e762e
add cli flag for generating jboss depl. descriptor #4088
jfiala Nov 6, 2016
733c887
add JbossFeature CLI flag to Resteasy #4088
jfiala Nov 6, 2016
9691509
update/add tests #4088
jfiala Nov 6, 2016
4422045
cleanup tabs #4088
jfiala Nov 9, 2016
becd52e
improve api formatting #4088
jfiala Nov 9, 2016
7790178
refine formatting #4088
jfiala Nov 9, 2016
b3b54f1
refine formatting again #4088
jfiala Nov 9, 2016
50efff3
add separate CLI-flags for controlling junit test features #4088
jfiala Nov 9, 2016
7566685
Merge branch 'cxf_refine' of https://github.com/jfiala/swagger-codege…
jfiala Nov 9, 2016
04fdc10
add check for void methods + assertNotNull(response) #4088
jfiala Nov 9, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,10 @@ public void execute() throws MojoExecutionException {
}

if (addCompileSourceRoot) {
String sourceJavaFolder = output.toString() + "/" + configOptions.get(CodegenConstants.SOURCE_FOLDER);
final Object sourceFolderObject = configOptions.get(CodegenConstants.SOURCE_FOLDER);
final String sourceFolder = sourceFolderObject == null ? "src/main/java" : sourceFolderObject.toString();

String sourceJavaFolder = output.toString() + "/" + sourceFolder;
project.addCompileSourceRoot(sourceJavaFolder);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1892,7 +1892,11 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation
for (String key : consumes) {
Map<String, String> mediaType = new HashMap<String, String>();
// escape quotation to avoid code injection
mediaType.put("mediaType", escapeText(escapeQuotationMark(key)));
if ("*/*".equals(key)) { // "*/*" is a special case, do nothing
mediaType.put("mediaType", key);
} else {
mediaType.put("mediaType", escapeText(escapeQuotationMark(key)));
}
count += 1;
if (count < consumes.size()) {
mediaType.put("hasMore", "true");
Expand Down Expand Up @@ -1926,7 +1930,11 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation
for (String key : produces) {
Map<String, String> mediaType = new HashMap<String, String>();
// escape quotation to avoid code injection
mediaType.put("mediaType", escapeText(escapeQuotationMark(key)));
if ("*/*".equals(key)) { // "*/*" is a special case, do nothing
mediaType.put("mediaType", key);
} else {
mediaType.put("mediaType", escapeText(escapeQuotationMark(key)));
}
count += 1;
if (count < produces.size()) {
mediaType.put("hasMore", "true");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public List<File> generate() {
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) {
Expand Down Expand Up @@ -405,6 +405,7 @@ public int compare(CodegenOperation one, CodegenOperation another) {
operation.put("classname", config.toApiName(tag));
operation.put("classVarName", config.toApiVarName(tag));
operation.put("importPath", config.toApiImport(tag));
operation.put("classFilename", config.toApiFilename(tag));

if(!config.vendorExtensions().isEmpty()) {
operation.put("vendorExtensions", config.vendorExtensions());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,11 @@ public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
}
}
}

if ( operation.returnType == null ) {
operation.returnType = "void";
// set vendorExtensions.x-java-is-response-void to true as returnType is set to "void"
operation.vendorExtensions.put("x-java-is-response-void", true);
} else if ( operation.returnType.startsWith("List") ) {
String rt = operation.returnType;
int end = rt.lastIndexOf(">");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public class AspNet5ServerCodegen extends AspNetCoreServerCodegen {

public AspNet5ServerCodegen() {
super();

embeddedTemplateDir = templateDir = "aspnetcore";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@
import io.swagger.codegen.CodegenProperty;
import io.swagger.codegen.CodegenType;
import io.swagger.codegen.SupportingFile;
import io.swagger.codegen.languages.features.CXFFeatures;
import io.swagger.codegen.languages.features.LoggingFeatures;
import io.swagger.codegen.languages.features.BeanValidationFeatures;
import io.swagger.codegen.languages.features.GzipTestFeatures;
import io.swagger.codegen.languages.features.JaxbFeatures;
import io.swagger.codegen.languages.features.LoggingTestFeatures;
import io.swagger.models.Operation;

public class JavaCXFClientCodegen extends AbstractJavaCodegen implements CXFFeatures
public class JavaCXFClientCodegen extends AbstractJavaCodegen
implements BeanValidationFeatures, JaxbFeatures, GzipTestFeatures, LoggingTestFeatures
{
private static final Logger LOGGER = LoggerFactory.getLogger(JavaCXFClientCodegen.class);

Expand All @@ -28,14 +31,13 @@ public class JavaCXFClientCodegen extends AbstractJavaCodegen implements CXFFeat
*/
protected static final String JAXRS_TEMPLATE_DIRECTORY_NAME = "JavaJaxRS";

protected boolean useJaxbAnnotations = true;

protected boolean useBeanValidation = false;

protected boolean useGzipFeature = false;

protected boolean useLoggingFeature = false;

protected boolean useBeanValidationFeature = false;
protected boolean useGzipFeatureForTests = false;

protected boolean useLoggingFeatureForTests = false;

public JavaCXFClientCodegen()
{
Expand Down Expand Up @@ -67,11 +69,12 @@ public JavaCXFClientCodegen()

embeddedTemplateDir = templateDir = JAXRS_TEMPLATE_DIRECTORY_NAME + File.separator + "cxf";

cliOptions.add(CliOption.newBoolean(USE_JAXB_ANNOTATIONS, "Use JAXB annotations for XML"));

cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations"));

cliOptions.add(CliOption.newBoolean(USE_GZIP_FEATURE, "Use Gzip Feature"));
cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION_FEATURE, "Use BeanValidation Feature"));
cliOptions.add(CliOption.newBoolean(USE_LOGGING_FEATURE, "Use Logging Feature"));
cliOptions.add(CliOption.newBoolean(USE_GZIP_FEATURE_FOR_TESTS, "Use Gzip Feature for tests"));
cliOptions.add(CliOption.newBoolean(USE_LOGGING_FEATURE_FOR_TESTS, "Use Logging Feature for tests"));


}
Expand All @@ -82,19 +85,19 @@ public void processOpts()
{
super.processOpts();

if (additionalProperties.containsKey(USE_JAXB_ANNOTATIONS)) {
boolean useJaxbAnnotationsProp = convertPropertyToBooleanAndWriteBack(USE_JAXB_ANNOTATIONS);
this.setUseJaxbAnnotations(useJaxbAnnotationsProp);
}

if (additionalProperties.containsKey(USE_BEANVALIDATION)) {
boolean useBeanValidationProp = convertPropertyToBooleanAndWriteBack(USE_BEANVALIDATION);
this.setUseBeanValidation(useBeanValidationProp);
}

this.setUseGzipFeature(convertPropertyToBooleanAndWriteBack(USE_GZIP_FEATURE));
this.setUseLoggingFeature(convertPropertyToBooleanAndWriteBack(USE_LOGGING_FEATURE));
this.setUseGzipFeatureForTests(convertPropertyToBooleanAndWriteBack(USE_GZIP_FEATURE_FOR_TESTS));
this.setUseLoggingFeatureForTests(convertPropertyToBooleanAndWriteBack(USE_LOGGING_FEATURE_FOR_TESTS));

boolean useBeanValidationFeature = convertPropertyToBooleanAndWriteBack(USE_BEANVALIDATION_FEATURE);
this.setUseBeanValidationFeature(useBeanValidationFeature);
if (useBeanValidationFeature) {
LOGGER.info("make sure your client supports Bean Validation 1.1");
}

supportingFiles.clear(); // Don't need extra files provided by AbstractJAX-RS & Java Codegen

Expand Down Expand Up @@ -141,18 +144,16 @@ public void setUseBeanValidation(boolean useBeanValidation) {
}


public void setUseGzipFeature(boolean useGzipFeature) {
this.useGzipFeature = useGzipFeature;
public void setUseJaxbAnnotations(boolean useJaxbAnnotations) {
this.useJaxbAnnotations = useJaxbAnnotations;
}


public void setUseLoggingFeature(boolean useLoggingFeature) {
this.useLoggingFeature = useLoggingFeature;
public void setUseGzipFeatureForTests(boolean useGzipFeatureForTests) {
this.useGzipFeatureForTests = useGzipFeatureForTests;
}


public void setUseBeanValidationFeature(boolean useBeanValidationFeature) {
this.useBeanValidationFeature = useBeanValidationFeature;
public void setUseLoggingFeatureForTests(boolean useLoggingFeatureForTests) {
this.useLoggingFeatureForTests = useLoggingFeatureForTests;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,44 @@
import io.swagger.codegen.CodegenProperty;
import io.swagger.codegen.SupportingFile;
import io.swagger.codegen.languages.features.CXFServerFeatures;
import io.swagger.codegen.languages.features.GzipTestFeatures;
import io.swagger.codegen.languages.features.JaxbFeatures;
import io.swagger.codegen.languages.features.LoggingTestFeatures;
import io.swagger.models.Operation;

public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen implements CXFServerFeatures
public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen
implements CXFServerFeatures, GzipTestFeatures, LoggingTestFeatures, JaxbFeatures
{
private static final Logger LOGGER = LoggerFactory.getLogger(JavaCXFServerCodegen.class);

protected boolean useJaxbAnnotations = true;

protected boolean useBeanValidation = false;

protected boolean generateSpringApplication = false;

protected boolean useSpringAnnotationConfig = false;

protected boolean useSwaggerFeature = false;

protected boolean useWadlFeature = false;

protected boolean useMultipartFeature = false;

protected boolean useGzipFeature = false;

protected boolean useLoggingFeature = false;

protected boolean useBeanValidationFeature = false;

protected boolean generateSpringBootApplication= false;

protected boolean generateJbossDeploymentDescriptor = false;

protected boolean useGzipFeature = false;

protected boolean useGzipFeatureForTests = false;

protected boolean useLoggingFeature = false;

protected boolean useLoggingFeatureForTests = false;

public JavaCXFServerCodegen()
{
super();
Expand All @@ -64,17 +78,26 @@ public JavaCXFServerCodegen()

embeddedTemplateDir = templateDir = JAXRS_TEMPLATE_DIRECTORY_NAME + File.separator + "cxf";

cliOptions.add(CliOption.newBoolean(USE_JAXB_ANNOTATIONS, "Use JAXB annotations for XML"));

cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations"));
cliOptions.add(CliOption.newBoolean(GENERATE_SPRING_APPLICATION, "Generate Spring application"));
cliOptions.add(CliOption.newBoolean(USE_SPRING_ANNOTATION_CONFIG, "Use Spring Annotation Config"));

cliOptions.add(CliOption.newBoolean(USE_SWAGGER_FEATURE, "Use Swagger Feature"));
cliOptions.add(CliOption.newBoolean(USE_WADL_FEATURE, "Use WADL Feature"));
cliOptions.add(CliOption.newBoolean(USE_MULTIPART_FEATURE, "Use Multipart Feature"));

cliOptions.add(CliOption.newBoolean(USE_GZIP_FEATURE, "Use Gzip Feature"));
cliOptions.add(CliOption.newBoolean(USE_GZIP_FEATURE_FOR_TESTS, "Use Gzip Feature for tests"));

cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION_FEATURE, "Use BeanValidation Feature"));
cliOptions.add(CliOption.newBoolean(USE_LOGGING_FEATURE, "Use Logging Feature"));
cliOptions.add(CliOption.newBoolean(USE_LOGGING_FEATURE_FOR_TESTS, "Use Logging Feature for tests"));

cliOptions.add(CliOption.newBoolean(GENERATE_SPRING_BOOT_APPLICATION, "Generate Spring Boot application"));
cliOptions.add(
CliOption.newBoolean(GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR, "Generate Jboss Deployment Descriptor"));


}
Expand All @@ -85,6 +108,11 @@ public void processOpts()
{
super.processOpts();

if (additionalProperties.containsKey(USE_JAXB_ANNOTATIONS)) {
boolean useJaxbAnnotationsProp = convertPropertyToBooleanAndWriteBack(USE_JAXB_ANNOTATIONS);
this.setUseJaxbAnnotations(useJaxbAnnotationsProp);
}

if (additionalProperties.containsKey(USE_BEANVALIDATION)) {
boolean useBeanValidationProp = convertPropertyToBooleanAndWriteBack(USE_BEANVALIDATION);
this.setUseBeanValidation(useBeanValidationProp);
Expand All @@ -97,7 +125,10 @@ public void processOpts()
this.setUseWadlFeature(convertPropertyToBooleanAndWriteBack(USE_WADL_FEATURE));
this.setUseMultipartFeature(convertPropertyToBooleanAndWriteBack(USE_MULTIPART_FEATURE));
this.setUseGzipFeature(convertPropertyToBooleanAndWriteBack(USE_GZIP_FEATURE));
this.setUseGzipFeatureForTests(convertPropertyToBooleanAndWriteBack(USE_GZIP_FEATURE_FOR_TESTS));
this.setUseLoggingFeature(convertPropertyToBooleanAndWriteBack(USE_LOGGING_FEATURE));
this.setUseLoggingFeatureForTests(convertPropertyToBooleanAndWriteBack(USE_LOGGING_FEATURE_FOR_TESTS));
this.setUseSpringAnnotationConfig(convertPropertyToBooleanAndWriteBack(USE_SPRING_ANNOTATION_CONFIG));

boolean useBeanValidationFeature = convertPropertyToBooleanAndWriteBack(USE_BEANVALIDATION_FEATURE);
this.setUseBeanValidationFeature(useBeanValidationFeature);
Expand All @@ -107,8 +138,13 @@ public void processOpts()

this.setGenerateSpringBootApplication(convertPropertyToBooleanAndWriteBack(GENERATE_SPRING_BOOT_APPLICATION));
}


if (additionalProperties.containsKey(GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR)) {
boolean generateJbossDeploymentDescriptorProp = convertPropertyToBooleanAndWriteBack(
GENERATE_JBOSS_DEPLOYMENT_DESCRIPTOR);
this.setGenerateJbossDeploymentDescriptor(generateJbossDeploymentDescriptorProp);
}

supportingFiles.clear(); // Don't need extra files provided by AbstractJAX-RS & Java Codegen

writeOptional(outputFolder, new SupportingFile("server/pom.mustache", "", "pom.xml"));
Expand All @@ -124,8 +160,11 @@ public void processOpts()
("src/main/webapp/WEB-INF"), "context.xml"));

// Jboss
writeOptional(outputFolder, new SupportingFile("server/jboss-web.xml.mustache",
("src/main/webapp/WEB-INF"), "jboss-web.xml"));
if (generateJbossDeploymentDescriptor) {
writeOptional(outputFolder, new SupportingFile("server/jboss-web.xml.mustache",
("src/main/webapp/WEB-INF"), "jboss-web.xml"));

}

// Spring Boot
if (this.generateSpringBootApplication) {
Expand Down Expand Up @@ -174,6 +213,9 @@ public void setGenerateSpringApplication(boolean generateSpringApplication) {
this.generateSpringApplication = generateSpringApplication;
}

public void setUseSpringAnnotationConfig(boolean useSpringAnnotationConfig) {
this.useSpringAnnotationConfig = useSpringAnnotationConfig;
}

public void setUseSwaggerFeature(boolean useSwaggerFeature) {
this.useSwaggerFeature = useSwaggerFeature;
Expand Down Expand Up @@ -204,7 +246,24 @@ public void setUseBeanValidationFeature(boolean useBeanValidationFeature) {
this.useBeanValidationFeature = useBeanValidationFeature;
}

public void setGenerateSpringBootApplication(boolean generateSpringBootApplication) {
public void setGenerateSpringBootApplication(boolean generateSpringBootApplication) {
this.generateSpringBootApplication = generateSpringBootApplication;
}

public void setUseJaxbAnnotations(boolean useJaxbAnnotations) {
this.useJaxbAnnotations = useJaxbAnnotations;
}

public void setGenerateJbossDeploymentDescriptor(boolean generateJbossDeploymentDescriptor) {
this.generateJbossDeploymentDescriptor = generateJbossDeploymentDescriptor;
}

public void setUseGzipFeatureForTests(boolean useGzipFeatureForTests) {
this.useGzipFeatureForTests = useGzipFeatureForTests;
}

public void setUseLoggingFeatureForTests(boolean useLoggingFeatureForTests) {
this.useLoggingFeatureForTests = useLoggingFeatureForTests;
}

}
Loading