diff --git a/README.md b/README.md index ee5203e97d8..7253eea064a 100644 --- a/README.md +++ b/README.md @@ -887,8 +887,9 @@ Here is a list of template creators: * Erlang Server: @galaxie * Go Server: @guohuang * Haskell Servant: @algas - * Java Undertow: @stevehu + * Java MSF4J: @sanjeewa-malalgoda * Java Spring Boot: @diyfr + * Java Undertow: @stevehu * JAX-RS RestEasy: @chameleon82 * JAX-RS CXF: @hiveship * JAX-RS CXF (CDI): @nickcmaynard diff --git a/bin/java-msf4j-petstore-server.sh b/bin/java-msf4j-petstore-server.sh new file mode 100755 index 00000000000..79bba1b368b --- /dev/null +++ b/bin/java-msf4j-petstore-server.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" + +if [ ! -f "$executable" ] +then + mvn clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/MSF4J -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l msf4j -o samples/server/petstore/java-msf4j/ -DhideGenerationTimestamp=true" + +echo "Removing files and folders under samples/server/petstore/java-msf4j/src/main" +rm -rf samples/server/petstore/java-msf4j/src/main +find samples/server/petstore/java-msf4j -maxdepth 1 -type f ! -name "README.md" -exec rm {} + +java $JAVA_OPTS -jar $executable $ags diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index ff75ae6255a..3eba155581b 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java @@ -3330,4 +3330,23 @@ public class DefaultCodegen { return pattern; } + + /** + * reads propertyKey from additionalProperties, converts it to a boolean and + * writes it back to additionalProperties to be usable as a boolean in + * mustache files. + * + * @param propertyKey + * @return property value as boolean + */ + public boolean convertPropertyToBooleanAndWriteBack(String propertyKey) { + boolean booleanValue = false; + if (additionalProperties.containsKey(propertyKey)) { + booleanValue = Boolean.valueOf(additionalProperties.get(propertyKey).toString()); + // write back as boolean + additionalProperties.put(propertyKey, booleanValue); + } + + return booleanValue; + } } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java index c41e1550f42..7ff42b28469 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java @@ -935,4 +935,8 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code return sb.toString(); } + public String toRegularExpression(String pattern) { + return escapeText(pattern); + } + } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaCXFClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaCXFClientCodegen.java new file mode 100644 index 00000000000..15bf08191a5 --- /dev/null +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaCXFClientCodegen.java @@ -0,0 +1,158 @@ + +package io.swagger.codegen.languages; + +import java.io.File; +import java.util.List; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import io.swagger.codegen.CliOption; +import io.swagger.codegen.CodegenModel; +import io.swagger.codegen.CodegenOperation; +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.models.Operation; + +public class JavaCXFClientCodegen extends AbstractJavaCodegen implements CXFFeatures +{ + private static final Logger LOGGER = LoggerFactory.getLogger(JavaCXFClientCodegen.class); + + /** + * Name of the sub-directory in "src/main/resource" where to find the + * Mustache template for the JAX-RS Codegen. + */ + protected static final String JAXRS_TEMPLATE_DIRECTORY_NAME = "JavaJaxRS"; + + protected boolean useBeanValidation = false; + + protected boolean useGzipFeature = false; + + protected boolean useLoggingFeature = false; + + protected boolean useBeanValidationFeature = false; + + + public JavaCXFClientCodegen() + { + super(); + + supportsInheritance = true; + + sourceFolder = "src/gen/java"; + invokerPackage = "io.swagger.api"; + artifactId = "swagger-jaxrs-client"; + dateLibrary = "legacy"; //TODO: add joda support to all jax-rs + + apiPackage = "io.swagger.api"; + modelPackage = "io.swagger.model"; + + outputFolder = "generated-code/JavaJaxRS-CXF"; + + // clear model and api doc template as this codegen + // does not support auto-generated markdown doc at the moment + //TODO: add doc templates + modelDocTemplateFiles.remove("model_doc.mustache"); + apiDocTemplateFiles.remove("api_doc.mustache"); + + + typeMapping.put("date", "LocalDate"); + typeMapping.put("DateTime", "javax.xml.datatype.XMLGregorianCalendar"); // Map DateTime fields to Java standart class 'XMLGregorianCalendar' + + importMapping.put("LocalDate", "org.joda.time.LocalDate"); + + embeddedTemplateDir = templateDir = JAXRS_TEMPLATE_DIRECTORY_NAME + File.separator + "cxf"; + + 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")); + + + } + + + @Override + public void processOpts() + { + super.processOpts(); + + 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)); + + 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 + + writeOptional(outputFolder, new SupportingFile("pom.mustache", "", "pom.xml")); + + } + + @Override + public String getName() + { + return "jaxrs-cxf-client"; + } + + + @Override + public CodegenType getTag() + { + return CodegenType.CLIENT; + } + + @Override + public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map> operations) { + super.addOperationToGroup(tag, resourcePath, operation, co, operations); + co.subresourceOperation = !co.path.isEmpty(); + } + + @Override + public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { + super.postProcessModelProperty(model, property); + model.imports.remove("ApiModelProperty"); + model.imports.remove("ApiModel"); + model.imports.remove("JsonSerialize"); + model.imports.remove("ToStringSerializer"); + } + + @Override + public String getHelp() + { + return "Generates a Java JAXRS Client based on Apache CXF framework."; + } + + public void setUseBeanValidation(boolean useBeanValidation) { + this.useBeanValidation = useBeanValidation; + } + + + public void setUseGzipFeature(boolean useGzipFeature) { + this.useGzipFeature = useGzipFeature; + } + + + public void setUseLoggingFeature(boolean useLoggingFeature) { + this.useLoggingFeature = useLoggingFeature; + } + + + public void setUseBeanValidationFeature(boolean useBeanValidationFeature) { + this.useBeanValidationFeature = useBeanValidationFeature; + } + +} diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaCXFServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaCXFServerCodegen.java index 35fae461666..ced60722790 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaCXFServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaCXFServerCodegen.java @@ -5,23 +5,51 @@ import java.io.File; import java.util.List; import java.util.Map; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import io.swagger.codegen.CliOption; import io.swagger.codegen.CodegenModel; import io.swagger.codegen.CodegenOperation; import io.swagger.codegen.CodegenProperty; +import io.swagger.codegen.SupportingFile; +import io.swagger.codegen.languages.features.CXFServerFeatures; import io.swagger.models.Operation; -public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen -{ - public JavaCXFServerCodegen() - { +public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen implements CXFServerFeatures +{ + private static final Logger LOGGER = LoggerFactory.getLogger(JavaCXFServerCodegen.class); + + protected boolean useBeanValidation = false; + + protected boolean generateSpringApplication = 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; + + public JavaCXFServerCodegen() + { super(); - sourceFolder = "gen" + File.separator + "java"; + + supportsInheritance = true; + + artifactId = "swagger-cxf-server"; + outputFolder = "generated-code/JavaJaxRS-CXF"; - apiTestTemplateFiles.clear(); // TODO: add test template - - //TODO add auto-generated pom.xml for maven - //apiTemplateFiles.put("pom.mustache", "pom.xml"); - + + apiTemplateFiles.put("apiServiceImpl.mustache", ".java"); + // clear model and api doc template as this codegen // does not support auto-generated markdown doc at the moment //TODO: add doc templates @@ -36,14 +64,86 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen embeddedTemplateDir = templateDir = JAXRS_TEMPLATE_DIRECTORY_NAME + File.separator + "cxf"; - } + 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_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_BEANVALIDATION_FEATURE, "Use BeanValidation Feature")); + cliOptions.add(CliOption.newBoolean(USE_LOGGING_FEATURE, "Use Logging Feature")); + + cliOptions.add(CliOption.newBoolean(GENERATE_SPRING_BOOT_APPLICATION, "Generate Spring Boot application")); + + + } - @Override - public String getName() - { - return "jaxrs-cxf"; - } + @Override + public void processOpts() + { + super.processOpts(); + + if (additionalProperties.containsKey(USE_BEANVALIDATION)) { + boolean useBeanValidationProp = convertPropertyToBooleanAndWriteBack(USE_BEANVALIDATION); + this.setUseBeanValidation(useBeanValidationProp); + } + + if (additionalProperties.containsKey(GENERATE_SPRING_APPLICATION)) { + this.setGenerateSpringApplication(convertPropertyToBooleanAndWriteBack(GENERATE_SPRING_APPLICATION)); + + this.setUseSwaggerFeature(convertPropertyToBooleanAndWriteBack(USE_SWAGGER_FEATURE)); + this.setUseWadlFeature(convertPropertyToBooleanAndWriteBack(USE_WADL_FEATURE)); + this.setUseMultipartFeature(convertPropertyToBooleanAndWriteBack(USE_MULTIPART_FEATURE)); + this.setUseGzipFeature(convertPropertyToBooleanAndWriteBack(USE_GZIP_FEATURE)); + this.setUseLoggingFeature(convertPropertyToBooleanAndWriteBack(USE_LOGGING_FEATURE)); + + boolean useBeanValidationFeature = convertPropertyToBooleanAndWriteBack(USE_BEANVALIDATION_FEATURE); + this.setUseBeanValidationFeature(useBeanValidationFeature); + if (useBeanValidationFeature) { + LOGGER.info("make sure your target server supports Bean Validation 1.1"); + } + + this.setGenerateSpringBootApplication(convertPropertyToBooleanAndWriteBack(GENERATE_SPRING_BOOT_APPLICATION)); + } + + + supportingFiles.clear(); // Don't need extra files provided by AbstractJAX-RS & Java Codegen + + writeOptional(outputFolder, new SupportingFile("server/pom.mustache", "", "pom.xml")); + + if (this.generateSpringApplication) { + writeOptional(outputFolder, new SupportingFile("server/readme.md", "", "readme.md")); + + writeOptional(outputFolder, new SupportingFile("server/ApplicationContext.xml.mustache", + ("src/main/resources"), "ApplicationContext.xml")); + writeOptional(outputFolder, new SupportingFile("server/web.mustache", + ("src/main/webapp/WEB-INF"), "web.xml")); + writeOptional(outputFolder, new SupportingFile("server/context.xml.mustache", + ("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")); + + // Spring Boot + if (this.generateSpringBootApplication) { + writeOptional(outputFolder, new SupportingFile("server/SpringBootApplication.mustache", + (testFolder + '/' + apiPackage).replace(".", "/"), "SpringBootApplication.java")); + + } + + } + + + } + + @Override + public String getName() + { + return "jaxrs-cxf"; + } @Override public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map> operations) { @@ -65,4 +165,46 @@ public class JavaCXFServerCodegen extends AbstractJavaJAXRSServerCodegen { return "Generates a Java JAXRS Server application based on Apache CXF framework."; } + + public void setUseBeanValidation(boolean useBeanValidation) { + this.useBeanValidation = useBeanValidation; + } + + public void setGenerateSpringApplication(boolean generateSpringApplication) { + this.generateSpringApplication = generateSpringApplication; + } + + + public void setUseSwaggerFeature(boolean useSwaggerFeature) { + this.useSwaggerFeature = useSwaggerFeature; + } + + + public void setUseWadlFeature(boolean useWadlFeature) { + this.useWadlFeature = useWadlFeature; + } + + + public void setUseMultipartFeature(boolean useMultipartFeature) { + this.useMultipartFeature = useMultipartFeature; + } + + + public void setUseGzipFeature(boolean useGzipFeature) { + this.useGzipFeature = useGzipFeature; + } + + + public void setUseLoggingFeature(boolean useLoggingFeature) { + this.useLoggingFeature = useLoggingFeature; + } + + + public void setUseBeanValidationFeature(boolean useBeanValidationFeature) { + this.useBeanValidationFeature = useBeanValidationFeature; + } + + public void setGenerateSpringBootApplication(boolean generateSpringBootApplication) { + this.generateSpringBootApplication = generateSpringBootApplication; + } } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java index 74b556c639a..857d0ace2e6 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaClientCodegen.java @@ -1,6 +1,8 @@ package io.swagger.codegen.languages; import io.swagger.codegen.*; +import io.swagger.codegen.languages.features.BeanValidationFeatures; + import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -9,7 +11,7 @@ import org.slf4j.LoggerFactory; import java.io.File; import java.util.*; -public class JavaClientCodegen extends AbstractJavaCodegen { +public class JavaClientCodegen extends AbstractJavaCodegen implements BeanValidationFeatures { @SuppressWarnings("hiding") private static final Logger LOGGER = LoggerFactory.getLogger(JavaClientCodegen.class); @@ -24,6 +26,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen { protected boolean useRxJava = false; protected boolean parcelableModel = false; protected boolean supportJava6= false; + protected boolean useBeanValidation = false; public JavaClientCodegen() { super(); @@ -37,6 +40,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen { cliOptions.add(CliOption.newBoolean(USE_RX_JAVA, "Whether to use the RxJava adapter with the retrofit2 library.")); cliOptions.add(CliOption.newBoolean(PARCELABLE_MODEL, "Whether to generate models for Android that implement Parcelable with the okhttp-gson library.")); cliOptions.add(CliOption.newBoolean(SUPPORT_JAVA6, "Whether to support Java6 with the Jersey1 library.")); + cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations")); supportedLibraries.put("jersey1", "HTTP client: Jersey client 1.19.1. JSON processing: Jackson 2.7.0. Enable Java6 support using '-DsupportJava6=true'."); supportedLibraries.put("feign", "HTTP client: Netflix Feign 8.16.0. JSON processing: Jackson 2.7.0"); @@ -81,6 +85,14 @@ public class JavaClientCodegen extends AbstractJavaCodegen { } // put the boolean value back to PARCELABLE_MODEL in additionalProperties additionalProperties.put(PARCELABLE_MODEL, parcelableModel); + + if (additionalProperties.containsKey(USE_BEANVALIDATION)) { + boolean useBeanValidationProp = Boolean.valueOf(additionalProperties.get(USE_BEANVALIDATION).toString()); + this.setUseBeanValidation(useBeanValidationProp); + + // write back as boolean + additionalProperties.put(USE_BEANVALIDATION, useBeanValidationProp); + } if (additionalProperties.containsKey(SUPPORT_JAVA6)) { this.setSupportJava6(Boolean.valueOf(additionalProperties.get(SUPPORT_JAVA6).toString())); @@ -187,7 +199,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen { operation.returnType = "Void"; } if (usesRetrofit2Library() && StringUtils.isNotEmpty(operation.path) && operation.path.startsWith("/")) - operation.path = operation.path.substring(1); + operation.path = operation.path.substring(1); } } } @@ -235,7 +247,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen { } return objs; } - + public void setUseRxJava(boolean useRxJava) { this.useRxJava = useRxJava; } @@ -248,4 +260,8 @@ public class JavaClientCodegen extends AbstractJavaCodegen { this.supportJava6 = value; } + public void setUseBeanValidation(boolean useBeanValidation) { + this.useBeanValidation = useBeanValidation; + } + } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaMSF4JServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaMSF4JServerCodegen.java new file mode 100644 index 00000000000..09f5276afc3 --- /dev/null +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaMSF4JServerCodegen.java @@ -0,0 +1,152 @@ +package io.swagger.codegen.languages; + +import io.swagger.codegen.*; +import io.swagger.models.Operation; + +import java.util.*; + +import org.apache.commons.lang3.BooleanUtils; +import org.apache.commons.lang3.StringUtils; + +public class JavaMSF4JServerCodegen extends AbstractJavaJAXRSServerCodegen { + + protected static final String LIBRARY_JERSEY1 = "jersey1"; + protected static final String LIBRARY_JERSEY2 = "jersey2"; + + + public static final String DEFAULT_LIBRARY = LIBRARY_JERSEY2; + + public JavaMSF4JServerCodegen() { + super(); + outputFolder = "generated-code/JavaJaxRS-Jersey"; + apiTemplateFiles.put("apiService.mustache", ".java"); + apiTemplateFiles.put("apiServiceImpl.mustache", ".java"); + apiTemplateFiles.put("apiServiceFactory.mustache", ".java"); + apiTestTemplateFiles.clear(); + modelDocTemplateFiles.remove("model_doc.mustache"); + apiDocTemplateFiles.remove("api_doc.mustache"); + embeddedTemplateDir = templateDir = "MSF4J"; + CliOption library = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use"); + supportedLibraries.put(LIBRARY_JERSEY1, "Jersey core 1.x"); + supportedLibraries.put(LIBRARY_JERSEY2, "Jersey core 2.x"); + library.setEnum(supportedLibraries); + library.setDefault(DEFAULT_LIBRARY); + cliOptions.add(library); + + } + + @Override + public String getName() + { + return "msf4j"; + } + + @Override + public String getHelp() + { + return "Generates a Java Micro Service based on WSO2 Microservices Framework for Java (MSF4J)"; + } + + @Override + public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { + super.postProcessModelProperty(model, property); + if("null".equals(property.example)) { + property.example = null; + } + + //Add imports for Jackson + if(!BooleanUtils.toBoolean(model.isEnum)) { + model.imports.add("JsonProperty"); + + if(BooleanUtils.toBoolean(model.hasEnums)) { + model.imports.add("JsonValue"); + } + } + } + + @Override + public void processOpts() { + super.processOpts(); + + // use default library if unset + if (StringUtils.isEmpty(library)) { + setLibrary(DEFAULT_LIBRARY); + } + + if ( additionalProperties.containsKey(CodegenConstants.IMPL_FOLDER)) { + implFolder = (String) additionalProperties.get(CodegenConstants.IMPL_FOLDER); + } + + if ("joda".equals(dateLibrary)) { + supportingFiles.add(new SupportingFile("JodaDateTimeProvider.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "JodaDateTimeProvider.java")); + supportingFiles.add(new SupportingFile("JodaLocalDateProvider.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "JodaLocalDateProvider.java")); + } else if ( dateLibrary.startsWith("java8") ) { + supportingFiles.add(new SupportingFile("OffsetDateTimeProvider.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "OffsetDateTimeProvider.java")); + supportingFiles.add(new SupportingFile("LocalDateProvider.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "LocalDateProvider.java")); + } + + writeOptional(outputFolder, new SupportingFile("pom.mustache", "", "pom.xml")); + writeOptional(outputFolder, new SupportingFile("README.mustache", "", "README.md")); + supportingFiles.add(new SupportingFile("ApiException.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "ApiException.java")); + supportingFiles.add(new SupportingFile("ApiOriginFilter.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "ApiOriginFilter.java")); + supportingFiles.add(new SupportingFile("ApiResponseMessage.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "ApiResponseMessage.java")); + supportingFiles.add(new SupportingFile("NotFoundException.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "NotFoundException.java")); + supportingFiles.add(new SupportingFile("jacksonJsonProvider.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "JacksonJsonProvider.java")); + supportingFiles.add(new SupportingFile("RFC3339DateFormat.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "RFC3339DateFormat.java")); + //writeOptional(outputFolder, new SupportingFile("bootstrap.mustache", (implFolder + '/' + apiPackage).replace(".", "/"), "Bootstrap.java")); + //writeOptional(outputFolder, new SupportingFile("web.mustache", ("src/main/webapp/WEB-INF"), "web.xml")); + supportingFiles.add(new SupportingFile("StringUtil.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "StringUtil.java")); + supportingFiles.add(new SupportingFile("Application.mustache", (sourceFolder + '/' + apiPackage).replace(".", "/"), "Application.java")); + } + + @Override + public Map postProcessModelsEnum(Map objs) { + objs = super.postProcessModelsEnum(objs); + + //Add imports for Jackson + List> imports = (List>)objs.get("imports"); + List models = (List) objs.get("models"); + for (Object _mo : models) { + Map mo = (Map) _mo; + CodegenModel cm = (CodegenModel) mo.get("model"); + // for enum model + if (Boolean.TRUE.equals(cm.isEnum) && cm.allowableValues != null) { + cm.imports.add(importMapping.get("JsonValue")); + Map item = new HashMap(); + item.put("import", importMapping.get("JsonValue")); + imports.add(item); + } + } + + return objs; + } + + @Override + public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map> operations) { + String basePath = resourcePath; + if (basePath.startsWith("/")) { + basePath = basePath.substring(1); + } + int pos = basePath.indexOf("/"); + if (pos > 0) { + basePath = basePath.substring(0, pos); + } + + if (basePath == "") { + basePath = "default"; + } else { + if (co.path.startsWith("/" + basePath)) { + co.path = co.path.substring(("/" + basePath).length()); + } + co.subresourceOperation = !co.path.isEmpty(); + } + List opList = operations.get(basePath); + if (opList == null) { + opList = new ArrayList(); + operations.put(basePath, opList); + } + opList.add(co); + co.baseName = basePath; + } + +} diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/NancyFXServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/NancyFXServerCodegen.java index 571bcdef920..3e2c3432356 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/NancyFXServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/NancyFXServerCodegen.java @@ -55,6 +55,7 @@ public class NancyFXServerCodegen extends AbstractCSharpCodegen { private static final String API_NAMESPACE = "Modules"; private static final String MODEL_NAMESPACE = "Models"; private static final String IMMUTABLE_OPTION = "immutable"; + private static final String USE_BASE_PATH = "writeModulePath"; private static final Map> propertyToSwaggerTypeMapping = createPropertyToSwaggerTypeMapping(); @@ -89,6 +90,7 @@ public class NancyFXServerCodegen extends AbstractCSharpCodegen { addSwitch(USE_COLLECTION, USE_COLLECTION_DESC, useCollection); addSwitch(RETURN_ICOLLECTION, RETURN_ICOLLECTION_DESC, returnICollection); addSwitch(IMMUTABLE_OPTION, "Enabled by default. If disabled generates model classes with setters", true); + addSwitch(USE_BASE_PATH, "Enabled by default. If disabled, module paths will not mirror api base path", true); typeMapping.putAll(nodaTimeTypesMappings()); languageSpecificPrimitives.addAll(nodaTimePrimitiveTypes()); @@ -348,7 +350,8 @@ public class NancyFXServerCodegen extends AbstractCSharpCodegen { @Override public void preprocessSwagger(final Swagger swagger) { additionalProperties.put("packageContext", sanitizeName(swagger.getBasePath())); - additionalProperties.put("baseContext", swagger.getBasePath()); + final Object basePathOption = additionalProperties.get(USE_BASE_PATH); + additionalProperties.put("baseContext", basePathOption == null ? swagger.getBasePath() : "/"); } @Override diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/BeanValidationExtendedFeatures.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/BeanValidationExtendedFeatures.java new file mode 100644 index 00000000000..274ce720efc --- /dev/null +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/BeanValidationExtendedFeatures.java @@ -0,0 +1,11 @@ +package io.swagger.codegen.languages.features; + +public interface BeanValidationExtendedFeatures { + + // Language (implementing Client/Server) supports automatic BeanValidation (1.1) + public static final String USE_BEANVALIDATION_FEATURE = "useBeanValidationFeature"; + + public void setUseBeanValidationFeature(boolean useBeanValidationFeature); + + +} diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/BeanValidationFeatures.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/BeanValidationFeatures.java new file mode 100644 index 00000000000..6818c29059d --- /dev/null +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/BeanValidationFeatures.java @@ -0,0 +1,10 @@ +package io.swagger.codegen.languages.features; + +public interface BeanValidationFeatures { + + // Language supports generating BeanValidation-Annotations + public static final String USE_BEANVALIDATION = "useBeanValidation"; + + public void setUseBeanValidation(boolean useBeanValidation); + +} diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/CXFFeatures.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/CXFFeatures.java new file mode 100644 index 00000000000..64fa569c83f --- /dev/null +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/CXFFeatures.java @@ -0,0 +1,9 @@ +package io.swagger.codegen.languages.features; + +/** + * Features supported by CXF 3 (client + server) + * + */ +public interface CXFFeatures extends LoggingFeatures, GzipFeatures, BeanValidationFeatures, BeanValidationExtendedFeatures { + +} diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/CXFServerFeatures.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/CXFServerFeatures.java new file mode 100644 index 00000000000..5c12aaedef6 --- /dev/null +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/CXFServerFeatures.java @@ -0,0 +1,17 @@ +package io.swagger.codegen.languages.features; + +/** + * Features supported by CXF 3 server + * + */ +public interface CXFServerFeatures extends CXFFeatures, SwaggerFeatures, SpringFeatures { + + public static final String USE_WADL_FEATURE = "useWadlFeature"; + + public static final String USE_MULTIPART_FEATURE = "useMultipartFeature"; + + public void setUseWadlFeature(boolean useWadlFeature); + + public void setUseMultipartFeature(boolean useMultipartFeature); + +} diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/GzipFeatures.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/GzipFeatures.java new file mode 100644 index 00000000000..b117708232c --- /dev/null +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/GzipFeatures.java @@ -0,0 +1,9 @@ +package io.swagger.codegen.languages.features; + +public interface GzipFeatures { + + public static final String USE_GZIP_FEATURE = "useGzipFeature"; + + public void setUseGzipFeature(boolean useGzipFeature); + +} diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/LoggingFeatures.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/LoggingFeatures.java new file mode 100644 index 00000000000..0d370a44ced --- /dev/null +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/LoggingFeatures.java @@ -0,0 +1,9 @@ +package io.swagger.codegen.languages.features; + +public interface LoggingFeatures extends BeanValidationFeatures { + + public static final String USE_LOGGING_FEATURE = "useLoggingFeature"; + + public void setUseLoggingFeature(boolean useLoggingFeature); + +} diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/SpringFeatures.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/SpringFeatures.java new file mode 100644 index 00000000000..e7cb6c18228 --- /dev/null +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/SpringFeatures.java @@ -0,0 +1,14 @@ +package io.swagger.codegen.languages.features; + +public interface SpringFeatures extends BeanValidationFeatures { + + public static final String GENERATE_SPRING_APPLICATION = "generateSpringApplication"; + + public static final String GENERATE_SPRING_BOOT_APPLICATION = "generateSpringBootApplication"; + + public void setGenerateSpringApplication(boolean useGenerateSpringApplication); + + public void setGenerateSpringBootApplication(boolean generateSpringBootApplication); + + +} diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/SwaggerFeatures.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/SwaggerFeatures.java new file mode 100644 index 00000000000..f60b2391e03 --- /dev/null +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/features/SwaggerFeatures.java @@ -0,0 +1,9 @@ +package io.swagger.codegen.languages.features; + +public interface SwaggerFeatures extends CXFFeatures { + + public static final String USE_SWAGGER_FEATURE = "useSwaggerFeature"; + + public void setUseSwaggerFeature(boolean useSwaggerFeature); + +} diff --git a/modules/swagger-codegen/src/main/resources/Java/beanValidation.mustache b/modules/swagger-codegen/src/main/resources/Java/beanValidation.mustache new file mode 100644 index 00000000000..1cd5d386106 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/Java/beanValidation.mustache @@ -0,0 +1,42 @@ +{{#required}} + @NotNull +{{/required}} +{{#pattern}} + @Pattern(regexp="{{pattern}}") +{{/pattern}} +{{#minLength}} +{{#maxLength}} + @Size(min={{minLength}},max={{maxLength}}) +{{/maxLength}} +{{/minLength}} +{{#minLength}} +{{^maxLength}} + @Size(min={{minLength}}) +{{/maxLength}} +{{/minLength}} +{{^minLength}} +{{#maxLength}} + @Size(max={{maxLength}}) + {{/maxLength}} + {{/minLength}} +{{#minItems}} +{{#maxItems}} + @Size(min={{minItems}},max={{maxItems}}) +{{/maxItems}} +{{/minItems}} +{{#minItems}} +{{^maxItems}} + @Size(min={{minItems}}) +{{/maxItems}} +{{/minItems}} +{{^minItems}} +{{#maxItems}} + @Size(max={{maxItems}}) + {{/maxItems}} + {{/minItems}} +{{#minimum}} + //@Min({{minimum}}) +{{/minimum}} +{{#maximum}} + //@Max({{maximum}}) +{{/maximum}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache index f6a64180085..698c1a97f94 100644 --- a/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/libraries/okhttp-gson/pom.mustache @@ -131,6 +131,15 @@ ${jodatime-version} {{/java8}} + {{#useBeanValidation}} + + + javax.validation + validation-api + 1.1.0.Final + provided + + {{/useBeanValidation}} @@ -152,4 +161,4 @@ 4.12 UTF-8 - + \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/Java/model.mustache b/modules/swagger-codegen/src/main/resources/Java/model.mustache index 400d2b983bd..385b3c14ec9 100644 --- a/modules/swagger-codegen/src/main/resources/Java/model.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/model.mustache @@ -18,6 +18,9 @@ import java.io.Serializable; import android.os.Parcelable; import android.os.Parcel; {{/parcelableModel}} +{{#useBeanValidation}} +import javax.validation.constraints.*; +{{/useBeanValidation}} {{#models}} {{#model}} diff --git a/modules/swagger-codegen/src/main/resources/Java/pojo.mustache b/modules/swagger-codegen/src/main/resources/Java/pojo.mustache index aec023afd7c..4e706ed7d4c 100644 --- a/modules/swagger-codegen/src/main/resources/Java/pojo.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/pojo.mustache @@ -66,7 +66,10 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela {{#vendorExtensions.extraAnnotation}} {{{vendorExtensions.extraAnnotation}}} {{/vendorExtensions.extraAnnotation}} - @ApiModelProperty({{#example}}example = "{{example}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") +{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} @ApiModelProperty({{#example}}example = "{{example}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") +{{#vendorExtensions.extraAnnotation}} + {{vendorExtensions.extraAnnotation}} +{{/vendorExtensions.extraAnnotation}} public {{{datatypeWithEnum}}} {{getter}}() { return {{name}}; } diff --git a/modules/swagger-codegen/src/main/resources/Java/pom.mustache b/modules/swagger-codegen/src/main/resources/Java/pom.mustache index 9431610d469..78225ad7599 100644 --- a/modules/swagger-codegen/src/main/resources/Java/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/Java/pom.mustache @@ -180,7 +180,6 @@ migbase64 2.2 - {{#supportJava6}} org.apache.commons @@ -194,7 +193,15 @@ ${commons_io_version} {{/supportJava6}} - +{{#useBeanValidation}} + + + javax.validation + validation-api + 1.1.0.Final + provided + +{{/useBeanValidation}} junit diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/api.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/api.mustache index 7454d0141c3..f1efbe87c63 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/api.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/api.mustache @@ -12,15 +12,24 @@ import javax.ws.rs.core.Response; import org.apache.cxf.jaxrs.ext.multipart.*; -@Path("{{contextPath}}") +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +{{#useBeanValidation}} +import javax.validation.constraints.*; +{{/useBeanValidation}} + +@Path("/") +@Api(value = "/", description = "{{description}}") public interface {{classname}} { {{#operations}} {{#operation}} + @{{httpMethod}} {{#subresourceOperation}}@Path("{{path}}"){{/subresourceOperation}} {{#hasConsumes}}@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}} {{#hasProduces}}@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}} - Response {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}); + @ApiOperation(value = "{{summary}}", tags={ {{#vendorExtensions.x-tags}}"{{tag}}"{{#hasMore}}, {{/hasMore}}{{/vendorExtensions.x-tags}} }) + public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); {{/operation}} } {{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/apiServiceImpl.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/apiServiceImpl.mustache new file mode 100644 index 00000000000..9b55d4c7551 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/apiServiceImpl.mustache @@ -0,0 +1,34 @@ +package {{package}}.impl; + +import {{package}}.*; +{{#imports}}import {{import}}; +{{/imports}} + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import org.apache.cxf.jaxrs.model.wadl.Description; +import org.apache.cxf.jaxrs.model.wadl.DocTarget; + +import org.apache.cxf.jaxrs.ext.multipart.*; + +import io.swagger.annotations.Api; + +{{#description}} +{{/description}} +public class {{classname}}ServiceImpl implements {{classname}} { +{{#operations}} +{{#operation}} + public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}} {{nickname}}({{#allParams}}{{>queryParamsImpl}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { + // TODO: Implement... + + {{#returnType}}return null;{{/returnType}} + } + +{{/operation}} +} +{{/operations}} + diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/api_test.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/api_test.mustache new file mode 100644 index 00000000000..43e9222d45e --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/api_test.mustache @@ -0,0 +1,110 @@ +{{>licenseInfo}} + +package {{package}}; + +{{#imports}}import {{import}}; +{{/imports}} +import org.junit.Test; +import org.junit.Before; + +import javax.ws.rs.core.Response; +import org.apache.cxf.jaxrs.client.JAXRSClientFactory; +import org.apache.cxf.jaxrs.client.ClientConfiguration; +import org.apache.cxf.jaxrs.client.WebClient; +{{#useGzipFeature}} +import org.apache.cxf.transport.common.gzip.GZIPInInterceptor; +import org.apache.cxf.transport.common.gzip.GZIPOutInterceptor; +{{/useGzipFeature}} + +{{#useLoggingFeature}} +import org.apache.cxf.interceptor.LoggingOutInterceptor; +{{/useLoggingFeature}} + +import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; + +{{^fullJavaUtil}} +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +{{/fullJavaUtil}} + +{{#generateSpringBootApplication}} +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.test.IntegrationTest; +import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; +{{/generateSpringBootApplication}} + + + +/** + * API tests for {{classname}} + */ +{{#generateSpringBootApplication}} +@RunWith(SpringJUnit4ClassRunner.class) +@SpringApplicationConfiguration(classes = SpringBootApplication.class) +@WebAppConfiguration +@IntegrationTest("server.port=0") +{{/generateSpringBootApplication}} +public class {{classname}}Test { + +{{#generateSpringBootApplication}} + @Value("${local.server.port}") + private int serverPort; +{{/generateSpringBootApplication}} + + private {{classname}} api; + + @Before + public void setup() { + JacksonJsonProvider provider = new JacksonJsonProvider(); + List providers = new ArrayList(); + providers.add(provider); + +{{#generateSpringBootApplication}} + api = JAXRSClientFactory.create("http://localhost:" + serverPort + "/services/services", {{classname}}.class, providers); +{{/generateSpringBootApplication}} +{{^generateSpringBootApplication}} + api = JAXRSClientFactory.create("{{basePath}}", {{classname}}.class, providers); +{{/generateSpringBootApplication}} + org.apache.cxf.jaxrs.client.Client client = WebClient.client(api); + + ClientConfiguration config = WebClient.getConfig(client); +{{#useGzipFeature}} + // Example for using Gzipping + GZIPOutInterceptor gzipOutInterceptor = new GZIPOutInterceptor(); + // use Gzipping for first request sent to server + //gzipOutInterceptor.setForce(true); + config.getOutInterceptors().add(gzipOutInterceptor); + + config.getInInterceptors().add(new GZIPInInterceptor()); +{{/useGzipFeature}} +{{#useLoggingFeature}} + LoggingOutInterceptor loggingOutInterceptor = new LoggingOutInterceptor(); + config.getOutInterceptors().add(loggingOutInterceptor); +{{/useLoggingFeature}} + } + + {{#operations}}{{#operation}} + /** + * {{summary}} + * + * {{notes}} + * + * @throws ApiException + * if the Api call fails + */ + @Test + public void {{operationId}}Test() { + {{#allParams}} + {{{dataType}}} {{paramName}} = null; + {{/allParams}} + // {{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + + // TODO: test validations + } + {{/operation}}{{/operations}} +} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/beanValidation.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/beanValidation.mustache new file mode 100644 index 00000000000..1cd5d386106 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/beanValidation.mustache @@ -0,0 +1,42 @@ +{{#required}} + @NotNull +{{/required}} +{{#pattern}} + @Pattern(regexp="{{pattern}}") +{{/pattern}} +{{#minLength}} +{{#maxLength}} + @Size(min={{minLength}},max={{maxLength}}) +{{/maxLength}} +{{/minLength}} +{{#minLength}} +{{^maxLength}} + @Size(min={{minLength}}) +{{/maxLength}} +{{/minLength}} +{{^minLength}} +{{#maxLength}} + @Size(max={{maxLength}}) + {{/maxLength}} + {{/minLength}} +{{#minItems}} +{{#maxItems}} + @Size(min={{minItems}},max={{maxItems}}) +{{/maxItems}} +{{/minItems}} +{{#minItems}} +{{^maxItems}} + @Size(min={{minItems}}) +{{/maxItems}} +{{/minItems}} +{{^minItems}} +{{#maxItems}} + @Size(max={{maxItems}}) + {{/maxItems}} + {{/minItems}} +{{#minimum}} + //@Min({{minimum}}) +{{/minimum}} +{{#maximum}} + //@Max({{maximum}}) +{{/maximum}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/licenseInfo.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/licenseInfo.mustache new file mode 100644 index 00000000000..861d97234cf --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/licenseInfo.mustache @@ -0,0 +1,23 @@ +/** + * {{{appName}}} + * {{{appDescription}}} + * + * {{#version}}OpenAPI spec version: {{{version}}}{{/version}} + * {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/model.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/model.mustache index 25e0c244ed9..aa3501d796e 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/model.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/model.mustache @@ -2,6 +2,9 @@ package {{package}}; {{#imports}}import {{import}}; {{/imports}} +{{#useBeanValidation}} +import javax.validation.constraints.*; +{{/useBeanValidation}} {{#models}} {{#model}} diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pojo.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pojo.mustache index c214ae2ae84..382b8372daa 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pojo.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pojo.mustache @@ -1,3 +1,4 @@ +import io.swagger.annotations.ApiModelProperty; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlAccessType; @@ -7,10 +8,13 @@ import javax.xml.bind.annotation.XmlEnum; @XmlAccessorType(XmlAccessType.FIELD) {{#hasVars}} @XmlType(name = "{{classname}}", propOrder = - { {{#vars}}"{{name}}"{{^-last}}, {{/-last}}{{/vars}} + { {{#vars}}"{{name}}"{{^-last}}, {{/-last}}{{/vars}} }){{/hasVars}} {{^hasVars}}@XmlType(name = "{{classname}}"){{/hasVars}} {{^parent}}@XmlRootElement(name="{{classname}}"){{/parent}} +{{#description}} +@ApiModel(description="{{{description}}}") +{{/description}} public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} { {{#vars}}{{#isEnum}} @@ -19,16 +23,29 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} { {{>enumClass}}{{/items}}{{/items.isEnum}} @XmlElement(name="{{baseName}}") + @ApiModelProperty({{#example}}example = "{{example}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}} {{#vars}} - /**{{#description}} - * {{{description}}}{{/description}}{{#minimum}} - * minimum: {{minimum}}{{/minimum}}{{#maximum}} - * maximum: {{maximum}}{{/maximum}} - **/ - {{#vendorExtensions.extraAnnotation}}{{vendorExtensions.extraAnnotation}}{{/vendorExtensions.extraAnnotation}} - public {{{datatypeWithEnum}}} {{getter}}() { + /** + {{#description}} + * {{{description}}} + {{/description}} + {{^description}} + * Get {{name}} + {{/description}} + {{#minimum}} + * minimum: {{minimum}} + {{/minimum}} + {{#maximum}} + * maximum: {{maximum}} + {{/maximum}} + * @return {{name}} + **/ +{{#vendorExtensions.extraAnnotation}} + {{vendorExtensions.extraAnnotation}} +{{/vendorExtensions.extraAnnotation}} +{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} public {{{datatypeWithEnum}}} {{getter}}() { return {{name}}; } public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pom.mustache new file mode 100644 index 00000000000..6e0736b368a --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/pom.mustache @@ -0,0 +1,181 @@ + + 4.0.0 + {{groupId}} + {{artifactId}} + jar + {{artifactId}} + {{artifactVersion}} + + src/main/java + + + maven-failsafe-plugin + 2.6 + + + + integration-test + verify + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + + + + + + io.swagger + swagger-jaxrs + compile + ${swagger-core-version} + + + ch.qos.logback + logback-classic + ${logback-version} + compile + + + ch.qos.logback + logback-core + ${logback-version} + compile + + + junit + junit + ${junit-version} + test + +{{#useBeanValidation}} + + + javax.validation + validation-api + ${beanvalidation-version} + provided + +{{/useBeanValidation}} + + + org.apache.cxf + cxf-rt-rs-client + ${cxf-version} + test + + + + + org.apache.cxf + cxf-rt-frontend-jaxrs + ${cxf-version} + compile + + + org.apache.cxf + cxf-rt-rs-service-description + ${cxf-version} + compile + + + org.apache.cxf + cxf-rt-ws-policy + ${cxf-version} + compile + + + org.apache.cxf + cxf-rt-wsdl + ${cxf-version} + compile + +{{#useBeanValidationFeature}} + + org.hibernate + hibernate-validator + 5.2.2.Final + +{{/useBeanValidationFeature}} + + + + sonatype-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + true + + + + + {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}} + ${java.version} + ${java.version} + 1.5.9 + 9.2.9.v20150224 + 2.22.2 + 4.12 + 1.1.7 + 2.5 +{{#useBeanValidation}} + 1.1.0.Final +{{/useBeanValidation}} + 3.1.6 + UTF-8 + + diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/queryParams.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/queryParams.mustache index be8cee8dfe1..6b16d47e340 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/queryParams.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/queryParams.mustache @@ -1 +1 @@ -{{#isQueryParam}}@QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file +{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/queryParamsImpl.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/queryParamsImpl.mustache new file mode 100644 index 00000000000..ff79730471d --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/queryParamsImpl.mustache @@ -0,0 +1 @@ +{{#isQueryParam}}{{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/ApplicationContext.xml.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/ApplicationContext.xml.mustache new file mode 100644 index 00000000000..2cb4720da8c --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/ApplicationContext.xml.mustache @@ -0,0 +1,142 @@ + + + + + + + + + + +{{#useMultipartFeature}} + +{{/useMultipartFeature}} + + +{{#apiInfo}} +{{#apis}} + +{{/apis}} +{{/apiInfo}} + +{{#useSwaggerFeature}} + + {{! http://cxf.apache.org/docs/swagger2feature.html }} + + + +{{/useSwaggerFeature}} + + + +{{#useGzipFeature}} + +{{/useGzipFeature}} +{{#useBeanValidationFeature}} + + +{{/useBeanValidationFeature}} + + +{{#useGzipFeature}} + +{{/useGzipFeature}} +{{#useBeanValidationFeature}} + + +{{/useBeanValidationFeature}} + + +{{#useLoggingFeature}} + +{{/useLoggingFeature}} +{{#useGzipFeature}} + +{{/useGzipFeature}} + + + + + + +{{#useWadlFeature}} + + + +{{/useWadlFeature}} + +{{#useGzipFeature}} + + + + + + + +{{/useGzipFeature}} + +{{#useBeanValidationFeature}} + + + + + + + + + + + +{{/useBeanValidationFeature}} +{{^useBeanValidationFeature}} + + + +{{/useBeanValidationFeature}} + + + + +{{#apiInfo}} +{{#apis}} + +{{/apis}} +{{/apiInfo}} + + + +{{#useMultipartFeature}} + +{{/useMultipartFeature}} +{{#useWadlFeature}} + +{{/useWadlFeature}} + + +{{#useSwaggerFeature}} + +{{/useSwaggerFeature}} +{{#useBeanValidationFeature}} + +{{/useBeanValidationFeature}} + + + + diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/SpringBootApplication.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/SpringBootApplication.mustache new file mode 100644 index 00000000000..f6d08e71296 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/SpringBootApplication.mustache @@ -0,0 +1,23 @@ +package {{apiPackage}}; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.context.web.SpringBootServletInitializer; +import org.springframework.context.annotation.ImportResource; + +@ImportResource({"classpath:/ApplicationContext.xml"}) +@EnableAutoConfiguration +public class SpringBootApplication extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(SpringBootApplication.class); + } + + public static void main(String[] args) { + SpringApplication.run(SpringBootApplication.class, args); + } + + +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/context.xml.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/context.xml.mustache new file mode 100644 index 00000000000..a14b9a13d01 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/context.xml.mustache @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/jboss-web.xml.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/jboss-web.xml.mustache new file mode 100644 index 00000000000..ef688c10e91 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/jboss-web.xml.mustache @@ -0,0 +1,7 @@ + + + + + swagger-cxf-server + + diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/pom.mustache new file mode 100644 index 00000000000..6e0165d011f --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/pom.mustache @@ -0,0 +1,231 @@ + + 4.0.0 + {{groupId}} + {{artifactId}} + war + {{artifactId}} + {{artifactVersion}} + + src/main/java + + + maven-failsafe-plugin + 2.6 + + + + integration-test + verify + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + + + + + maven-war-plugin + 2.1.1 + + true + + + + + + + io.swagger + swagger-jaxrs + compile + ${swagger-core-version} + + + ch.qos.logback + logback-classic + ${logback-version} + compile + + + ch.qos.logback + logback-core + ${logback-version} + compile + + + junit + junit + ${junit-version} + test + +{{#useBeanValidation}} + + + javax.validation + validation-api + ${beanvalidation-version} + provided + +{{/useBeanValidation}} + + + org.apache.cxf + cxf-rt-rs-client + ${cxf-version} + test + + + + + org.apache.cxf + cxf-rt-frontend-jaxrs + ${cxf-version} + compile + + + org.apache.cxf + cxf-rt-rs-service-description + ${cxf-version} + compile + + + org.apache.cxf + cxf-rt-rs-service-description-swagger + ${cxf-version} + compile + + + org.apache.cxf + cxf-rt-ws-policy + ${cxf-version} + compile + + + org.apache.cxf + cxf-rt-wsdl + ${cxf-version} + compile + +{{#generateSpringApplication}} + + + org.springframework + spring-context + ${spring-version} + + + org.springframework + spring-web + ${spring-version} + +{{/generateSpringApplication}} +{{#generateSpringBootApplication}} + + + org.springframework.boot + spring-boot-starter-tomcat + ${spring.boot-version} + provided + + + + org.springframework.boot + spring-boot-starter-test + ${spring.boot-version} + test + + + + org.apache.cxf + cxf-spring-boot-starter-jaxrs + ${cxf-version} + provided + +{{/generateSpringBootApplication}} + + + + sonatype-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + true + + + + + {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}} + ${java.version} + ${java.version} + 1.5.9 + 9.2.9.v20150224 + 2.22.2 + 4.12 + 1.1.7 + 2.5 +{{#useBeanValidation}} + 1.1.0.Final +{{/useBeanValidation}} +{{#generateSpringApplication}} + 4.2.5.RELEASE +{{/generateSpringApplication}} +{{#generateSpringBootApplication}} + 1.3.3.RELEASE +{{/generateSpringBootApplication}} + 3.1.7 + UTF-8 + + diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/readme.md b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/readme.md new file mode 100644 index 00000000000..27925cedf44 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/readme.md @@ -0,0 +1,23 @@ + +# JAX-RS CXF 3 server application + +## Supported features +* Bean-Validation-API support +* Spring-configuration of Swagger, WADL and Endpoints +* Swagger-API is accessible (CXF3 Swagger2Feature) +* WADL is accessible (CXF WADL-Generator) +* Unit-tests include Gzip-Interceptors for demonstration + + +## Urls to access the REST API + +* Available services listing +http://localhost:8080/swagger-cxf-server/rest/services/ + +* Swagger API + http://localhost:8080/swagger-cxf-server/rest/services/swagger.json + +* CXF WADL + http://localhost:8080/swagger-cxf-server/rest/services?_wadl + + diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/web.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/web.mustache new file mode 100644 index 00000000000..9d905ae076b --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/server/web.mustache @@ -0,0 +1,23 @@ + + + + + contextConfigLocation + WEB-INF/context.xml + + + org.springframework.web.context.ContextLoaderListener + + + CXF Service Servlet + CXFServiceServlet + org.apache.cxf.transport.servlet.CXFServlet + 1 + + + CXFServiceServlet + /rest/* + + + diff --git a/modules/swagger-codegen/src/main/resources/Javascript/api.mustache b/modules/swagger-codegen/src/main/resources/Javascript/api.mustache index 8d515b16b5a..e3990ed910a 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/api.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/api.mustache @@ -58,7 +58,7 @@ <#allParams><#required> // verify the required parameter '' is set if ( == undefined || == null) { - throw "Missing the required parameter '' when calling "; + throw new Error("Missing the required parameter '' when calling "); } diff --git a/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig b/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig index 7f2c3ec6642..02f5ce9c05d 100644 --- a/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig +++ b/modules/swagger-codegen/src/main/resources/META-INF/services/io.swagger.codegen.CodegenConfig @@ -12,6 +12,7 @@ io.swagger.codegen.languages.GoClientCodegen io.swagger.codegen.languages.GroovyClientCodegen io.swagger.codegen.languages.JavaClientCodegen io.swagger.codegen.languages.JavaJerseyServerCodegen +io.swagger.codegen.languages.JavaCXFClientCodegen io.swagger.codegen.languages.JavaCXFServerCodegen io.swagger.codegen.languages.JavaResteasyServerCodegen io.swagger.codegen.languages.JavaJAXRSSpecServerCodegen @@ -56,3 +57,4 @@ io.swagger.codegen.languages.LumenServerCodegen io.swagger.codegen.languages.GoServerCodegen io.swagger.codegen.languages.ErlangServerCodegen io.swagger.codegen.languages.UndertowCodegen +io.swagger.codegen.languages.JavaMSF4JServerCodegen diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/ApiException.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/ApiException.mustache new file mode 100644 index 00000000000..f6161147700 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/ApiException.mustache @@ -0,0 +1,10 @@ +package {{apiPackage}}; + +{{>generatedAnnotation}} +public class ApiException extends Exception{ + private int code; + public ApiException (int code, String msg) { + super(msg); + this.code = code; + } +} diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/ApiOriginFilter.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/ApiOriginFilter.mustache new file mode 100644 index 00000000000..b8af270a05a --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/ApiOriginFilter.mustache @@ -0,0 +1,22 @@ +package {{apiPackage}}; + +import java.io.IOException; + +import javax.servlet.*; +import javax.servlet.http.HttpServletResponse; + +{{>generatedAnnotation}} +public class ApiOriginFilter implements javax.servlet.Filter { + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException, ServletException { + HttpServletResponse res = (HttpServletResponse) response; + res.addHeader("Access-Control-Allow-Origin", "*"); + res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); + res.addHeader("Access-Control-Allow-Headers", "Content-Type"); + chain.doFilter(request, response); + } + + public void destroy() {} + + public void init(FilterConfig filterConfig) throws ServletException {} +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/ApiResponseMessage.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/ApiResponseMessage.mustache new file mode 100644 index 00000000000..c883e16b5e6 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/ApiResponseMessage.mustache @@ -0,0 +1,69 @@ +package {{apiPackage}}; + +import javax.xml.bind.annotation.XmlTransient; + +@javax.xml.bind.annotation.XmlRootElement +{{>generatedAnnotation}} +public class ApiResponseMessage { + public static final int ERROR = 1; + public static final int WARNING = 2; + public static final int INFO = 3; + public static final int OK = 4; + public static final int TOO_BUSY = 5; + + int code; + String type; + String message; + + public ApiResponseMessage(){} + + public ApiResponseMessage(int code, String message){ + this.code = code; + switch(code){ + case ERROR: + setType("error"); + break; + case WARNING: + setType("warning"); + break; + case INFO: + setType("info"); + break; + case OK: + setType("ok"); + break; + case TOO_BUSY: + setType("too busy"); + break; + default: + setType("unknown"); + break; + } + this.message = message; + } + + @XmlTransient + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/Application.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/Application.mustache new file mode 100644 index 00000000000..6e6140b79e7 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/Application.mustache @@ -0,0 +1,21 @@ +package {{invokerPackage}}; + +import org.wso2.msf4j.MicroservicesRunner; + +/** + * Application entry point. + * + * @since 1.0.0-SNAPSHOT + */ +public class Application { + public static void main(String[] args) { + +System.out.println("starting Micro Services"); +//Before you run service replace .deploy(new ()) with your actual service class like .deploy(new ApisAPI()) then it will start that service. +//If you have multiple service classes add them in , seperated manner. +//Ex: .deploy(new PetApi()) + new MicroservicesRunner() + .deploy(new PetApi()) + .start(); + } +} diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/JodaDateTimeProvider.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/JodaDateTimeProvider.mustache new file mode 100644 index 00000000000..f9421790983 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/JodaDateTimeProvider.mustache @@ -0,0 +1,44 @@ +package {{apiPackage}}; + +import com.sun.jersey.core.spi.component.ComponentContext; +import com.sun.jersey.spi.inject.Injectable; +import com.sun.jersey.spi.inject.PerRequestTypeInjectableProvider; + +import javax.ws.rs.QueryParam; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; +import javax.ws.rs.core.UriInfo; +import javax.ws.rs.ext.Provider; +import org.joda.time.DateTime; +import java.util.List; + +@Provider +public class JodaDateTimeProvider extends PerRequestTypeInjectableProvider { + private final UriInfo uriInfo; + + public JodaDateTimeProvider(@Context UriInfo uriInfo) { + super(DateTime.class); + this.uriInfo = uriInfo; + } + + @Override + public Injectable getInjectable(final ComponentContext cc, final QueryParam a) { + return new Injectable() { + @Override + public DateTime getValue() { + final List values = uriInfo.getQueryParameters().get(a.value()); + + if (values == null || values.isEmpty()) + return null; + if (values.size() > 1) { + throw new WebApplicationException(Response.status(Status.BAD_REQUEST). + entity(a.value() + " cannot contain multiple values").build()); + } + + return DateTime.parse(values.get(0)); + } + }; + } +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/JodaLocalDateProvider.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/JodaLocalDateProvider.mustache new file mode 100644 index 00000000000..7bd4027e63d --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/JodaLocalDateProvider.mustache @@ -0,0 +1,44 @@ +package {{apiPackage}}; + +import com.sun.jersey.core.spi.component.ComponentContext; +import com.sun.jersey.spi.inject.Injectable; +import com.sun.jersey.spi.inject.PerRequestTypeInjectableProvider; + +import javax.ws.rs.QueryParam; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; +import javax.ws.rs.core.UriInfo; +import javax.ws.rs.ext.Provider; +import org.joda.time.LocalDate; +import java.util.List; + +@Provider +public class JodaLocalDateProvider extends PerRequestTypeInjectableProvider { + private final UriInfo uriInfo; + + public JodaLocalDateProvider(@Context UriInfo uriInfo) { + super(LocalDate.class); + this.uriInfo = uriInfo; + } + + @Override + public Injectable getInjectable(final ComponentContext cc, final QueryParam a) { + return new Injectable() { + @Override + public LocalDate getValue() { + final List values = uriInfo.getQueryParameters().get(a.value()); + + if (values == null || values.isEmpty()) + return null; + if (values.size() > 1) { + throw new WebApplicationException(Response.status(Status.BAD_REQUEST). + entity(a.value() + " cannot contain multiple values").build()); + } + + return LocalDate.parse(values.get(0)); + } + }; + } +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/LocalDateProvider.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/LocalDateProvider.mustache new file mode 100644 index 00000000000..8c4cd4cbd15 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/LocalDateProvider.mustache @@ -0,0 +1,44 @@ +package {{apiPackage}}; + +import com.sun.jersey.core.spi.component.ComponentContext; +import com.sun.jersey.spi.inject.Injectable; +import com.sun.jersey.spi.inject.PerRequestTypeInjectableProvider; + +import javax.ws.rs.QueryParam; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; +import javax.ws.rs.core.UriInfo; +import javax.ws.rs.ext.Provider; +import java.time.LocalDate; +import java.util.List; + +@Provider +public class LocalDateProvider extends PerRequestTypeInjectableProvider { + private final UriInfo uriInfo; + + public LocalDateProvider(@Context UriInfo uriInfo) { + super(LocalDate.class); + this.uriInfo = uriInfo; + } + + @Override + public Injectable getInjectable(final ComponentContext cc, final QueryParam a) { + return new Injectable() { + @Override + public LocalDate getValue() { + final List values = uriInfo.getQueryParameters().get(a.value()); + + if (values == null || values.isEmpty()) + return null; + if (values.size() > 1) { + throw new WebApplicationException(Response.status(Status.BAD_REQUEST). + entity(a.value() + " cannot contain multiple values").build()); + } + + return LocalDate.parse(values.get(0)); + } + }; + } +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/NotFoundException.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/NotFoundException.mustache new file mode 100644 index 00000000000..40c25c5ea5c --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/NotFoundException.mustache @@ -0,0 +1,10 @@ +package {{apiPackage}}; + +{{>generatedAnnotation}} +public class NotFoundException extends ApiException { + private int code; + public NotFoundException (int code, String msg) { + super(code, msg); + this.code = code; + } +} diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/OffsetDateTimeProvider.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/OffsetDateTimeProvider.mustache new file mode 100644 index 00000000000..876aeb327be --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/OffsetDateTimeProvider.mustache @@ -0,0 +1,44 @@ +package {{apiPackage}}; + +import com.sun.jersey.core.spi.component.ComponentContext; +import com.sun.jersey.spi.inject.Injectable; +import com.sun.jersey.spi.inject.PerRequestTypeInjectableProvider; + +import javax.ws.rs.QueryParam; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; +import javax.ws.rs.core.UriInfo; +import javax.ws.rs.ext.Provider; +import java.time.OffsetDateTime; +import java.util.List; + +@Provider +public class OffsetDateTimeProvider extends PerRequestTypeInjectableProvider { + private final UriInfo uriInfo; + + public OffsetDateTimeProvider(@Context UriInfo uriInfo) { + super(OffsetDateTime.class); + this.uriInfo = uriInfo; + } + + @Override + public Injectable getInjectable(final ComponentContext cc, final QueryParam a) { + return new Injectable() { + @Override + public OffsetDateTime getValue() { + final List values = uriInfo.getQueryParameters().get(a.value()); + + if (values == null || values.isEmpty()) + return null; + if (values.size() > 1) { + throw new WebApplicationException(Response.status(Status.BAD_REQUEST). + entity(a.value() + " cannot contain multiple values").build()); + } + + return OffsetDateTime.parse(values.get(0)); + } + }; + } +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/README.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/README.mustache new file mode 100644 index 00000000000..b8a8abc32ad --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/README.mustache @@ -0,0 +1,23 @@ +# Swagger Jersey generated server + +## Overview +This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the +[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This +is an example of building a swagger-enabled JAX-RS server. + +This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. + +To run the server, please execute the following: + +``` +mvn clean package jetty:run +``` + +You can then view the swagger listing here: + +``` +http://localhost:{{serverPort}}{{contextPath}}/swagger.json +``` + +Note that if you have configured the `host` to be something other than localhost, the calls through +swagger-ui will be directed to that host and not localhost! \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/RFC3339DateFormat.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/RFC3339DateFormat.mustache new file mode 100644 index 00000000000..061e000f5a2 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/RFC3339DateFormat.mustache @@ -0,0 +1,19 @@ +package {{apiPackage}}; + +import com.fasterxml.jackson.databind.util.ISO8601DateFormat; +import com.fasterxml.jackson.databind.util.ISO8601Utils; + +import java.text.FieldPosition; +import java.util.Date; + +public class RFC3339DateFormat extends ISO8601DateFormat { + + // Same as ISO8601DateFormat but serializing milliseconds. + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + String value = ISO8601Utils.format(date, true); + toAppendTo.append(value); + return toAppendTo; + } + +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/StringUtil.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/StringUtil.mustache new file mode 100644 index 00000000000..073966b0c21 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/StringUtil.mustache @@ -0,0 +1,42 @@ +package {{invokerPackage}}; + +{{>generatedAnnotation}} +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) return true; + if (value != null && value.equalsIgnoreCase(str)) return true; + } + return false; + } + + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) return ""; + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } +} diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/allowableValues.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/allowableValues.mustache new file mode 100644 index 00000000000..a48256d027a --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/allowableValues.mustache @@ -0,0 +1 @@ +{{#allowableValues}}allowableValues="{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}{{^values}}range=[{{#min}}{{.}}{{/min}}{{^min}}-infinity{{/min}}, {{#max}}{{.}}{{/max}}{{^max}}infinity{{/max}}]{{/values}}"{{/allowableValues}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/api.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/api.mustache new file mode 100644 index 00000000000..f90d2564187 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/api.mustache @@ -0,0 +1,56 @@ +package {{package}}; + +import {{modelPackage}}.*; +import {{package}}.{{classname}}Service; +import {{package}}.factories.{{classname}}ServiceFactory; + +import io.swagger.annotations.ApiParam; +import io.swagger.jaxrs.*; + +{{#imports}}import {{import}}; +{{/imports}} + +import java.util.List; +import {{package}}.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.FormDataParam; + +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.*; + +@Path("/{{baseName}}") +{{#hasConsumes}}@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}} +{{#hasProduces}}@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}} +@io.swagger.annotations.Api(description = "the {{baseName}} API") +{{>generatedAnnotation}} +{{#operations}} +public class {{classname}} { + private final {{classname}}Service delegate = {{classname}}ServiceFactory.get{{classname}}(); + +{{#operation}} + @{{httpMethod}} + {{#subresourceOperation}}@Path("{{path}}"){{/subresourceOperation}} + {{#hasConsumes}}@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}} + {{#hasProduces}}@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}} + @io.swagger.annotations.ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = { + {{#authMethods}}@io.swagger.annotations.Authorization(value = "{{name}}"{{#isOAuth}}, scopes = { + {{#scopes}}@io.swagger.annotations.AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{#hasMore}}, + {{/hasMore}}{{/scopes}} + }{{/isOAuth}}){{#hasMore}}, + {{/hasMore}}{{/authMethods}} + }{{/hasAuthMethods}}, tags={ {{#vendorExtensions.x-tags}}"{{tag}}",{{/vendorExtensions.x-tags}} }) + @io.swagger.annotations.ApiResponses(value = { {{#responses}} + @io.swagger.annotations.ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}){{#hasMore}}, + {{/hasMore}}{{/responses}} }) + public Response {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}) + throws NotFoundException { + return delegate.{{nickname}}({{#allParams}}{{#isFile}}{{paramName}}InputStream, {{paramName}}Detail{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}}{{#hasMore}},{{/hasMore}}{{/allParams}}); + } +{{/operation}} +} +{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/apiService.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/apiService.mustache new file mode 100644 index 00000000000..edaa0f9becb --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/apiService.mustache @@ -0,0 +1,26 @@ +package {{package}}; + +import {{package}}.*; +import {{modelPackage}}.*; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +{{#imports}}import {{import}}; +{{/imports}} + +import java.util.List; +import {{package}}.NotFoundException; + +import java.io.InputStream; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; + +{{>generatedAnnotation}} +{{#operations}} +public abstract class {{classname}}Service { + {{#operation}} + public abstract Response {{nickname}}({{#allParams}}{{>serviceQueryParams}}{{>servicePathParams}}{{>serviceHeaderParams}}{{>serviceBodyParams}}{{>serviceFormParams}} {{#hasMore}},{{/hasMore}}{{/allParams}}) throws NotFoundException; + {{/operation}} +} +{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/apiServiceFactory.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/apiServiceFactory.mustache new file mode 100644 index 00000000000..a638548227f --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/apiServiceFactory.mustache @@ -0,0 +1,12 @@ +package {{package}}.factories; + +import {{package}}.{{classname}}Service; +import {{package}}.impl.{{classname}}ServiceImpl; + +public class {{classname}}ServiceFactory { + private final static {{classname}}Service service = new {{classname}}ServiceImpl(); + + public static {{classname}}Service get{{classname}}() { + return service; + } +} diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/apiServiceImpl.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/apiServiceImpl.mustache new file mode 100644 index 00000000000..af1b56fc69c --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/apiServiceImpl.mustache @@ -0,0 +1,30 @@ +package {{package}}.impl; + +import {{package}}.*; +import {{modelPackage}}.*; + +{{#imports}}import {{import}}; +{{/imports}} + +import java.util.List; +import {{package}}.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; + +{{>generatedAnnotation}} +{{#operations}} +public class {{classname}}ServiceImpl extends {{classname}}Service { + {{#operation}} + @Override + public Response {{nickname}}({{#allParams}}{{>serviceQueryParams}}{{>servicePathParams}}{{>serviceHeaderParams}}{{>serviceBodyParams}}{{>serviceFormParams}}{{#hasMore}},{{/hasMore}} {{/allParams}}) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + {{/operation}} +} +{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/api_test.mastache~ b/modules/swagger-codegen/src/main/resources/MSF4J/api_test.mastache~ new file mode 100644 index 00000000000..e69de29bb2d diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/application.mastache~ b/modules/swagger-codegen/src/main/resources/MSF4J/application.mastache~ new file mode 100644 index 00000000000..e97da6f8895 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/application.mastache~ @@ -0,0 +1,18 @@ +package {{invokerPackage}}; + +import org.wso2.msf4j.MicroservicesRunner; + +/** + * Application entry point. + * + * @since 1.0.0-SNAPSHOT + */ +public class Application { + public static void main(String[] args) { + +System.out.println("starting========================================================="); + new MicroservicesRunner() + .deploy(new ApisApi()) + .start(); + } +} diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/bodyParams.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/bodyParams.mustache new file mode 100644 index 00000000000..2b28441d3d0 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/bodyParams.mustache @@ -0,0 +1 @@ +{{#isBodyParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) {{{dataType}}} {{paramName}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/bootstrap.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/bootstrap.mustache new file mode 100644 index 00000000000..f7e8efff419 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/bootstrap.mustache @@ -0,0 +1,31 @@ +package {{apiPackage}}; + +import io.swagger.jaxrs.config.SwaggerContextService; +import io.swagger.models.*; + +import io.swagger.models.auth.*; + +import javax.servlet.http.HttpServlet; +import javax.servlet.ServletContext; +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; + +public class Bootstrap extends HttpServlet { + @Override + public void init(ServletConfig config) throws ServletException { + Info info = new Info() + .title("{{title}}") + .description("{{{appDescription}}}") + .termsOfService("{{termsOfService}}") + .contact(new Contact() + .email("{{infoEmail}}")) + .license(new License() + .name("{{licenseInfo}}") + .url("{{licenseUrl}}")); + + ServletContext context = config.getServletContext(); + Swagger swagger = new Swagger().info(info); + + new SwaggerContextService().withServletConfig(config).updateSwagger(swagger); + } +} diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/enumClass.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/enumClass.mustache new file mode 100644 index 00000000000..c5c3143cb94 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/enumClass.mustache @@ -0,0 +1,44 @@ + /** + * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + */ + public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} { + {{#gson}} + {{#allowableValues}} + {{#enumVars}} + @SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) + {{{name}}}({{{value}}}){{^-last}}, + {{/-last}}{{#-last}};{{/-last}} + {{/enumVars}} + {{/allowableValues}} + {{/gson}} + {{^gson}} + {{#allowableValues}} + {{#enumVars}} + {{{name}}}({{{value}}}){{^-last}}, + {{/-last}}{{#-last}};{{/-last}} + {{/enumVars}} + {{/allowableValues}} + {{/gson}} + + private {{{datatype}}} value; + + {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{{datatype}}} value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue(String text) { + for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/enumOuterClass.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/enumOuterClass.mustache new file mode 100644 index 00000000000..76c2cbf5a76 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/enumOuterClass.mustache @@ -0,0 +1,42 @@ +{{#jackson}} +import com.fasterxml.jackson.annotation.JsonCreator; +{{/jackson}} + +/** + * {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + */ +public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} { + {{#gson}} + {{#allowableValues}}{{#enumVars}} + @SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) + {{{name}}}({{{value}}}){{^-last}}, + {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} + {{/gson}} + {{^gson}} + {{#allowableValues}}{{#enumVars}} + {{{name}}}({{{value}}}){{^-last}}, + {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} + {{/gson}} + + private {{{dataType}}} value; + + {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}({{{dataType}}} value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} fromValue(String text) { + for ({{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} b : {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } +} diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/formParams.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/formParams.mustache new file mode 100644 index 00000000000..9a7ff6ea6cf --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/formParams.mustache @@ -0,0 +1,3 @@ +{{#isFormParam}}{{#notFile}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{#vendorExtensions.x-multipart}}@FormDataParam("{{paramName}}") {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{^vendorExtensions.x-multipart}} {{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @FormParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/vendorExtensions.x-multipart}}{{/notFile}}{{#isFile}} + @FormDataParam("{{paramName}}") InputStream {{paramName}}InputStream, + @FormDataParam("{{paramName}}") FormDataContentDisposition {{paramName}}Detail{{/isFile}}{{/isFormParam}} diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/generatedAnnotation.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/generatedAnnotation.mustache new file mode 100644 index 00000000000..a47b6faa85b --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/generatedAnnotation.mustache @@ -0,0 +1 @@ +{{^hideGenerationTimestamp}}@javax.annotation.Generated(value = "{{generatorClass}}", date = "{{generatedDate}}"){{/hideGenerationTimestamp}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/headerParams.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/headerParams.mustache new file mode 100644 index 00000000000..1360d796826 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/headerParams.mustache @@ -0,0 +1 @@ +{{#isHeaderParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}})@HeaderParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isHeaderParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/jacksonJsonProvider.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/jacksonJsonProvider.mustache new file mode 100644 index 00000000000..e82da4051f7 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/jacksonJsonProvider.mustache @@ -0,0 +1,27 @@ +package {{apiPackage}}; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.joda.JodaModule; +import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; + +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.ext.Provider; + +@Provider +@Produces({MediaType.APPLICATION_JSON}) +public class JacksonJsonProvider extends JacksonJaxbJsonProvider { + + public JacksonJsonProvider() { + + ObjectMapper objectMapper = new ObjectMapper() + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .registerModule(new JodaModule()) + .setDateFormat(new RFC3339DateFormat()); + + setMapper(objectMapper); + } +} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/model.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/model.mustache new file mode 100644 index 00000000000..d52b90c8bec --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/model.mustache @@ -0,0 +1,19 @@ +package {{package}}; + +import java.util.Objects; +{{#imports}}import {{import}}; +{{/imports}} +{{#serializableModel}} +import java.io.Serializable; +{{/serializableModel}} + +{{#models}} +{{#model}} +{{#isEnum}} +{{>enumOuterClass}} +{{/isEnum}} +{{^isEnum}} +{{>pojo}} +{{/isEnum}} +{{/model}} +{{/models}} diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/pathParams.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/pathParams.mustache new file mode 100644 index 00000000000..8d80210b4b4 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/pathParams.mustache @@ -0,0 +1 @@ +{{#isPathParam}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) @PathParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/pojo.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/pojo.mustache new file mode 100644 index 00000000000..6e5c1b74115 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/pojo.mustache @@ -0,0 +1,122 @@ +/** + * {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}} + */{{#description}} +@ApiModel(description = "{{{description}}}"){{/description}} +{{>generatedAnnotation}} +public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { + {{#vars}} + {{#isEnum}} + {{^isContainer}} +{{>enumClass}} + {{/isContainer}} + {{/isEnum}} + {{#items.isEnum}} + {{#items}} + {{^isContainer}} +{{>enumClass}} + {{/isContainer}} + {{/items}} + {{/items.isEnum}} + {{#jackson}} + @JsonProperty("{{baseName}}") + {{/jackson}} + {{#gson}} + @SerializedName("{{baseName}}") + {{/gson}} + private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}}; + + {{/vars}} + {{#vars}} + {{^isReadOnly}} + public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { + this.{{name}} = {{name}}; + return this; + } + {{#isListContainer}} + + public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + this.{{name}}.add({{name}}Item); + return this; + } + {{/isListContainer}} + {{#isMapContainer}} + + public {{classname}} put{{nameInCamelCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + this.{{name}}.put(key, {{name}}Item); + return this; + } + {{/isMapContainer}} + + {{/isReadOnly}} + /** + {{#description}} + * {{{description}}} + {{/description}} + {{^description}} + * Get {{name}} + {{/description}} + {{#minimum}} + * minimum: {{minimum}} + {{/minimum}} + {{#maximum}} + * maximum: {{maximum}} + {{/maximum}} + * @return {{name}} + **/ + {{#vendorExtensions.extraAnnotation}} + {{vendorExtensions.extraAnnotation}} + {{/vendorExtensions.extraAnnotation}} + @ApiModelProperty({{#example}}example = "{{example}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") + public {{{datatypeWithEnum}}} {{getter}}() { + return {{name}}; + } + {{^isReadOnly}} + + public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { + this.{{name}} = {{name}}; + } + {{/isReadOnly}} + + {{/vars}} + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + }{{#hasVars}} + {{classname}} {{classVarName}} = ({{classname}}) o; + return {{#vars}}Objects.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} && + {{/hasMore}}{{/vars}}{{#parent}} && + super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} + return true;{{/hasVars}} + } + + @Override + public int hashCode() { + return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class {{classname}} {\n"); + {{#parent}}sb.append(" ").append(toIndentedString(super.toString())).append("\n");{{/parent}} + {{#vars}}sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n"); + {{/vars}}sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/pom.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/pom.mustache new file mode 100644 index 00000000000..ff9764e8e95 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/pom.mustache @@ -0,0 +1,103 @@ + + + + + org.wso2.msf4j + msf4j-service +2.0.0 + + + 4.0.0 + {{groupId}} + {{artifactId}} + jar + {{artifactId}} + {{artifactVersion}} + + src/main/java + + + + org.apache.maven.plugins + maven-jar-plugin + + + + io.swagger.api.Application + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + + + + + + javax.servlet + servlet-api + ${servlet-api-version} + + + org.wso2.msf4j + msf4j-all + 2.0.0 + + + com.fasterxml.jackson.datatype + jackson-datatype-joda + 2.4.1 + + + org.glassfish.jersey.containers + jersey-container-servlet-core + ${jersey2-version} + + + org.glassfish.jersey.media + jersey-media-multipart + ${jersey2-version} + + + + + + sonatype-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + true + + + + + {{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}} + ${java.version} + ${java.version} + 1.5.9 + 9.2.9.v20150224 + 2.22.2 + 4.12 + 1.1.7 + 2.5 + 2.22.2 + UTF-8 + + diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/queryParams.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/queryParams.mustache new file mode 100644 index 00000000000..9055e6f16dc --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/queryParams.mustache @@ -0,0 +1 @@ +{{#isQueryParam}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/returnTypes.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/returnTypes.mustache new file mode 100644 index 00000000000..c8f7a56938a --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/returnTypes.mustache @@ -0,0 +1 @@ +{{#returnContainer}}{{#isMapContainer}}Map{{/isMapContainer}}{{#isListContainer}}List<{{{returnType}}}>{{/isListContainer}}{{/returnContainer}}{{^returnContainer}}{{{returnType}}}{{/returnContainer}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/serviceBodyParams.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/serviceBodyParams.mustache new file mode 100644 index 00000000000..c7d1abfe527 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/serviceBodyParams.mustache @@ -0,0 +1 @@ +{{#isBodyParam}}{{{dataType}}} {{paramName}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/serviceFormParams.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/serviceFormParams.mustache new file mode 100644 index 00000000000..dc2d2eb1ecf --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/serviceFormParams.mustache @@ -0,0 +1 @@ +{{#isFormParam}}{{#notFile}}{{{dataType}}} {{paramName}}{{/notFile}}{{#isFile}}InputStream {{paramName}}InputStream, FormDataContentDisposition {{paramName}}Detail{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/serviceHeaderParams.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/serviceHeaderParams.mustache new file mode 100644 index 00000000000..bd03573d196 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/serviceHeaderParams.mustache @@ -0,0 +1 @@ +{{#isHeaderParam}}{{{dataType}}} {{paramName}}{{/isHeaderParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/servicePathParams.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/servicePathParams.mustache new file mode 100644 index 00000000000..6829cf8c7a6 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/servicePathParams.mustache @@ -0,0 +1 @@ +{{#isPathParam}}{{{dataType}}} {{paramName}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/serviceQueryParams.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/serviceQueryParams.mustache new file mode 100644 index 00000000000..ff79730471d --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/serviceQueryParams.mustache @@ -0,0 +1 @@ +{{#isQueryParam}}{{{dataType}}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/MSF4J/web.mustache b/modules/swagger-codegen/src/main/resources/MSF4J/web.mustache new file mode 100644 index 00000000000..520456fb128 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/MSF4J/web.mustache @@ -0,0 +1,63 @@ + + + + + jersey + org.glassfish.jersey.servlet.ServletContainer + + jersey.config.server.provider.packages + + io.swagger.jaxrs.listing, + io.swagger.sample.resource, + {{apiPackage}} + + + + jersey.config.server.provider.classnames + org.glassfish.jersey.media.multipart.MultiPartFeature + + + jersey.config.server.wadl.disableWadl + true + + 1 + + + + Jersey2Config + io.swagger.jersey.config.JerseyJaxrsConfig + + api.version + 1.0.0 + + + swagger.api.title + {{{title}}} + + + swagger.api.basepath + {{basePath}} + + + 2 + + + Bootstrap + {{apiPackage}}.Bootstrap + 2 + + + jersey + {{contextPath}}/* + + + ApiOriginFilter + {{apiPackage}}.ApiOriginFilter + + + ApiOriginFilter + /* + + diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/java/JavaClientOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/java/JavaClientOptionsTest.java index db3d1145e6b..b2555a3d771 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/java/JavaClientOptionsTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/java/JavaClientOptionsTest.java @@ -58,6 +58,8 @@ public class JavaClientOptionsTest extends AbstractOptionsTest { times = 1; //clientCodegen.setSupportJava6(Boolean.valueOf(JavaOptionsProvider.SUPPORT_JAVA6)); //times = 1; + clientCodegen.setUseBeanValidation(Boolean.valueOf(JavaOptionsProvider.USE_BEANVALIDATION)); + times = 1; }}; } } diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/jaxrs/JaxrsCXFServerOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/jaxrs/JaxrsCXFServerOptionsTest.java new file mode 100644 index 00000000000..99a88680a9e --- /dev/null +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/jaxrs/JaxrsCXFServerOptionsTest.java @@ -0,0 +1,80 @@ +package io.swagger.codegen.jaxrs; + +import io.swagger.codegen.AbstractOptionsTest; +import io.swagger.codegen.CodegenConfig; +import io.swagger.codegen.languages.JavaCXFServerCodegen; +import io.swagger.codegen.options.JavaCXFServerOptionsProvider; +import io.swagger.codegen.options.OptionsProvider; +import mockit.Expectations; +import mockit.Tested; + +public class JaxrsCXFServerOptionsTest extends AbstractOptionsTest { + + @Tested + private JavaCXFServerCodegen clientCodegen; + + public JaxrsCXFServerOptionsTest() { + super(new JavaCXFServerOptionsProvider()); + } + + protected JaxrsCXFServerOptionsTest(OptionsProvider optionsProvider) { + super(optionsProvider); + } + + @Override + protected CodegenConfig getCodegenConfig() { + return clientCodegen; + } + + @Override + protected void setExpectations() { + new Expectations(clientCodegen) {{ + clientCodegen.setModelPackage(JavaCXFServerOptionsProvider.MODEL_PACKAGE_VALUE); + times = 1; + clientCodegen.setApiPackage(JavaCXFServerOptionsProvider.API_PACKAGE_VALUE); + times = 1; + clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(JavaCXFServerOptionsProvider.SORT_PARAMS_VALUE)); + times = 1; + clientCodegen.setInvokerPackage(JavaCXFServerOptionsProvider.INVOKER_PACKAGE_VALUE); + times = 1; + clientCodegen.setGroupId(JavaCXFServerOptionsProvider.GROUP_ID_VALUE); + times = 1; + clientCodegen.setArtifactId(JavaCXFServerOptionsProvider.ARTIFACT_ID_VALUE); + times = 1; + clientCodegen.setArtifactVersion(JavaCXFServerOptionsProvider.ARTIFACT_VERSION_VALUE); + times = 1; + clientCodegen.setSourceFolder(JavaCXFServerOptionsProvider.SOURCE_FOLDER_VALUE); + times = 1; + clientCodegen.setLocalVariablePrefix(JavaCXFServerOptionsProvider.LOCAL_PREFIX_VALUE); + times = 1; + clientCodegen.setSerializableModel(Boolean.valueOf(JavaCXFServerOptionsProvider.SERIALIZABLE_MODEL_VALUE)); + times = 1; + clientCodegen.setFullJavaUtil(Boolean.valueOf(JavaCXFServerOptionsProvider.FULL_JAVA_UTIL_VALUE)); + times = 1; + clientCodegen.setSerializeBigDecimalAsString(true); + times = 1; + + clientCodegen.setUseBeanValidation(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_BEANVALIDATION)); + times = 1; + + clientCodegen.setGenerateSpringApplication(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_SWAGGER_FEATURE)); + times = 1; + clientCodegen.setUseWadlFeature(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_WADL_FEATURE)); + times = 1; + clientCodegen.setUseMultipartFeature(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_MULTIPART_FEATURE)); + times = 1; + clientCodegen.setUseGzipFeature(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_GZIP_FEATURE)); + times = 1; + clientCodegen.setUseLoggingFeature(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_LOGGING_FEATURE)); + times = 1; + clientCodegen.setUseBeanValidationFeature(Boolean.valueOf(JavaCXFServerOptionsProvider.USE_BEANVALIDATION_FEATURE)); + times = 1; + + clientCodegen.setGenerateSpringBootApplication(Boolean.valueOf(JavaCXFServerOptionsProvider.GENERATE_SPRING_BOOT_APPLICATION)); + times = 1; + + + + }}; + } +} diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaCXFServerOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaCXFServerOptionsProvider.java new file mode 100644 index 00000000000..97626bf87af --- /dev/null +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaCXFServerOptionsProvider.java @@ -0,0 +1,65 @@ +package io.swagger.codegen.options; + +import java.util.Map; + +import com.google.common.collect.ImmutableMap; + +import io.swagger.codegen.CodegenConstants; +import io.swagger.codegen.languages.JavaCXFServerCodegen; + +public class JavaCXFServerOptionsProvider extends JavaOptionsProvider { + + public static final String GENERATE_SPRING_APPLICATION = "true"; + + public static final String USE_SWAGGER_FEATURE = "true"; + + public static final String USE_WADL_FEATURE = "true"; + + public static final String USE_MULTIPART_FEATURE = "true"; + + public static final String USE_GZIP_FEATURE = "true"; + + public static final String USE_LOGGING_FEATURE = "true"; + + public static final String USE_BEANVALIDATION_FEATURE = "true"; + + public static final String GENERATE_SPRING_BOOT_APPLICATION = "true"; + + public static final String IMPL_FOLDER_VALUE = "src/main/java"; + + @Override + public boolean isServer() { + return true; + } + + @Override + public String getLanguage() { + return "jaxrs-cxf"; + } + + @Override + public Map createOptions() { + + Map parentOptions = super.createOptions(); + + ImmutableMap.Builder builder = new ImmutableMap.Builder() + .putAll(parentOptions); + + builder.put(CodegenConstants.IMPL_FOLDER, IMPL_FOLDER_VALUE); + builder.put("title", "Test title"); + + builder.put(JavaCXFServerCodegen.USE_BEANVALIDATION, JavaOptionsProvider.USE_BEANVALIDATION); + builder.put(JavaCXFServerCodegen.GENERATE_SPRING_APPLICATION, GENERATE_SPRING_APPLICATION); + builder.put(JavaCXFServerCodegen.USE_SWAGGER_FEATURE, USE_SWAGGER_FEATURE); + builder.put(JavaCXFServerCodegen.USE_WADL_FEATURE, USE_WADL_FEATURE); + builder.put(JavaCXFServerCodegen.USE_MULTIPART_FEATURE, USE_MULTIPART_FEATURE); + builder.put(JavaCXFServerCodegen.USE_GZIP_FEATURE, USE_GZIP_FEATURE); + builder.put(JavaCXFServerCodegen.USE_LOGGING_FEATURE, USE_LOGGING_FEATURE); + builder.put(JavaCXFServerCodegen.USE_BEANVALIDATION_FEATURE, USE_BEANVALIDATION_FEATURE); + + builder.put(JavaCXFServerCodegen.GENERATE_SPRING_BOOT_APPLICATION, GENERATE_SPRING_BOOT_APPLICATION); + + return builder.build(); + + } +} diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaClientOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaClientOptionsProvider.java index 15799f67c49..0e842f53ec1 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaClientOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaClientOptionsProvider.java @@ -18,6 +18,7 @@ public class JavaClientOptionsProvider extends JavaOptionsProvider { options.put(JavaClientCodegen.USE_RX_JAVA, "false"); options.put(JavaClientCodegen.PARCELABLE_MODEL, "false"); options.put(JavaClientCodegen.SUPPORT_JAVA6, "false"); + options.put(JavaClientCodegen.USE_BEANVALIDATION, "false"); return options; } diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaOptionsProvider.java index 9275bcf2ab9..15a553d53b3 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/JavaOptionsProvider.java @@ -20,6 +20,7 @@ public class JavaOptionsProvider implements OptionsProvider { public static final String FULL_JAVA_UTIL_VALUE = "true"; public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; //public static final String SUPPORT_JAVA6 = "true"; + public static final String USE_BEANVALIDATION = "false"; private ImmutableMap options; diff --git a/pom.xml b/pom.xml index c49750ce756..35fe6e869d7 100644 --- a/pom.xml +++ b/pom.xml @@ -424,6 +424,18 @@ samples/client/petstore/swift/default/SwaggerClientTests + + java-msf4j-server + + + env + java + + + + samples/server/petstore/java-msf4/ + + jaxrs-resteasy-server diff --git a/samples/client/petstore/javascript-promise/docs/FakeApi.md b/samples/client/petstore/javascript-promise/docs/FakeApi.md index b3bc1ae145f..24aca3b719b 100644 --- a/samples/client/petstore/javascript-promise/docs/FakeApi.md +++ b/samples/client/petstore/javascript-promise/docs/FakeApi.md @@ -87,7 +87,8 @@ var opts = { 'binary': "B", // String | None '_date': new Date("2013-10-20"), // Date | None 'dateTime': new Date("2013-10-20T19:20:30+01:00"), // Date | None - 'password': "password_example" // String | None + 'password': "password_example", // String | None + 'callback': "callback_example" // String | None }; apiInstance.testEndpointParameters(_number, _double, patternWithoutDelimiter, _byte, opts).then(function() { console.log('API called successfully.'); @@ -114,6 +115,7 @@ Name | Type | Description | Notes **_date** | **Date**| None | [optional] **dateTime** | **Date**| None | [optional] **password** | **String**| None | [optional] + **callback** | **String**| None | [optional] ### Return type diff --git a/samples/client/petstore/javascript-promise/src/ApiClient.js b/samples/client/petstore/javascript-promise/src/ApiClient.js index b3d66a68174..56de9dddbdb 100644 --- a/samples/client/petstore/javascript-promise/src/ApiClient.js +++ b/samples/client/petstore/javascript-promise/src/ApiClient.js @@ -65,8 +65,8 @@ */ this.authentications = { 'api_key': {type: 'apiKey', 'in': 'header', name: 'api_key'}, - 'http_basic_test': {type: 'basic'} - 'petstore_auth': {type: 'oauth2'}, + 'http_basic_test': {type: 'basic'}, + 'petstore_auth': {type: 'oauth2'} }; /** * The default HTTP headers to be included for all API calls. @@ -368,7 +368,10 @@ var contentType = this.jsonPreferredMime(contentTypes); if (contentType) { - request.type(contentType); + // Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746) + if(contentType != 'multipart/form-data') { + request.type(contentType); + } } else if (!request.header['Content-Type']) { request.type('application/json'); } diff --git a/samples/client/petstore/javascript-promise/src/api/FakeApi.js b/samples/client/petstore/javascript-promise/src/api/FakeApi.js index c4b4a1d8771..80ee81d5e34 100644 --- a/samples/client/petstore/javascript-promise/src/api/FakeApi.js +++ b/samples/client/petstore/javascript-promise/src/api/FakeApi.js @@ -67,7 +67,7 @@ // verify the required parameter 'body' is set if (body == undefined || body == null) { - throw "Missing the required parameter 'body' when calling testClientModel"; + throw new Error("Missing the required parameter 'body' when calling testClientModel"); } @@ -110,6 +110,7 @@ * @param {Date} opts._date None * @param {Date} opts.dateTime None * @param {String} opts.password None + * @param {String} opts.callback None * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ this.testEndpointParameters = function(_number, _double, patternWithoutDelimiter, _byte, opts) { @@ -118,22 +119,22 @@ // verify the required parameter '_number' is set if (_number == undefined || _number == null) { - throw "Missing the required parameter '_number' when calling testEndpointParameters"; + throw new Error("Missing the required parameter '_number' when calling testEndpointParameters"); } // verify the required parameter '_double' is set if (_double == undefined || _double == null) { - throw "Missing the required parameter '_double' when calling testEndpointParameters"; + throw new Error("Missing the required parameter '_double' when calling testEndpointParameters"); } // verify the required parameter 'patternWithoutDelimiter' is set if (patternWithoutDelimiter == undefined || patternWithoutDelimiter == null) { - throw "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"; + throw new Error("Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"); } // verify the required parameter '_byte' is set if (_byte == undefined || _byte == null) { - throw "Missing the required parameter '_byte' when calling testEndpointParameters"; + throw new Error("Missing the required parameter '_byte' when calling testEndpointParameters"); } @@ -156,7 +157,8 @@ 'binary': opts['binary'], 'date': opts['_date'], 'dateTime': opts['dateTime'], - 'password': opts['password'] + 'password': opts['password'], + 'callback': opts['callback'] }; var authNames = ['http_basic_test']; diff --git a/samples/client/petstore/javascript-promise/src/api/PetApi.js b/samples/client/petstore/javascript-promise/src/api/PetApi.js index 203b31905ed..d752a612bba 100644 --- a/samples/client/petstore/javascript-promise/src/api/PetApi.js +++ b/samples/client/petstore/javascript-promise/src/api/PetApi.js @@ -68,7 +68,7 @@ // verify the required parameter 'body' is set if (body == undefined || body == null) { - throw "Missing the required parameter 'body' when calling addPet"; + throw new Error("Missing the required parameter 'body' when calling addPet"); } @@ -108,7 +108,7 @@ // verify the required parameter 'petId' is set if (petId == undefined || petId == null) { - throw "Missing the required parameter 'petId' when calling deletePet"; + throw new Error("Missing the required parameter 'petId' when calling deletePet"); } @@ -147,7 +147,7 @@ // verify the required parameter 'status' is set if (status == undefined || status == null) { - throw "Missing the required parameter 'status' when calling findPetsByStatus"; + throw new Error("Missing the required parameter 'status' when calling findPetsByStatus"); } @@ -185,7 +185,7 @@ // verify the required parameter 'tags' is set if (tags == undefined || tags == null) { - throw "Missing the required parameter 'tags' when calling findPetsByTags"; + throw new Error("Missing the required parameter 'tags' when calling findPetsByTags"); } @@ -223,7 +223,7 @@ // verify the required parameter 'petId' is set if (petId == undefined || petId == null) { - throw "Missing the required parameter 'petId' when calling getPetById"; + throw new Error("Missing the required parameter 'petId' when calling getPetById"); } @@ -261,7 +261,7 @@ // verify the required parameter 'body' is set if (body == undefined || body == null) { - throw "Missing the required parameter 'body' when calling updatePet"; + throw new Error("Missing the required parameter 'body' when calling updatePet"); } @@ -302,7 +302,7 @@ // verify the required parameter 'petId' is set if (petId == undefined || petId == null) { - throw "Missing the required parameter 'petId' when calling updatePetWithForm"; + throw new Error("Missing the required parameter 'petId' when calling updatePetWithForm"); } @@ -346,7 +346,7 @@ // verify the required parameter 'petId' is set if (petId == undefined || petId == null) { - throw "Missing the required parameter 'petId' when calling uploadFile"; + throw new Error("Missing the required parameter 'petId' when calling uploadFile"); } diff --git a/samples/client/petstore/javascript-promise/src/api/StoreApi.js b/samples/client/petstore/javascript-promise/src/api/StoreApi.js index b184af1058e..5053b8a708c 100644 --- a/samples/client/petstore/javascript-promise/src/api/StoreApi.js +++ b/samples/client/petstore/javascript-promise/src/api/StoreApi.js @@ -68,7 +68,7 @@ // verify the required parameter 'orderId' is set if (orderId == undefined || orderId == null) { - throw "Missing the required parameter 'orderId' when calling deleteOrder"; + throw new Error("Missing the required parameter 'orderId' when calling deleteOrder"); } @@ -137,7 +137,7 @@ // verify the required parameter 'orderId' is set if (orderId == undefined || orderId == null) { - throw "Missing the required parameter 'orderId' when calling getOrderById"; + throw new Error("Missing the required parameter 'orderId' when calling getOrderById"); } @@ -175,7 +175,7 @@ // verify the required parameter 'body' is set if (body == undefined || body == null) { - throw "Missing the required parameter 'body' when calling placeOrder"; + throw new Error("Missing the required parameter 'body' when calling placeOrder"); } diff --git a/samples/client/petstore/javascript-promise/src/api/UserApi.js b/samples/client/petstore/javascript-promise/src/api/UserApi.js index 9186f84e2df..4e66740bd23 100644 --- a/samples/client/petstore/javascript-promise/src/api/UserApi.js +++ b/samples/client/petstore/javascript-promise/src/api/UserApi.js @@ -68,7 +68,7 @@ // verify the required parameter 'body' is set if (body == undefined || body == null) { - throw "Missing the required parameter 'body' when calling createUser"; + throw new Error("Missing the required parameter 'body' when calling createUser"); } @@ -105,7 +105,7 @@ // verify the required parameter 'body' is set if (body == undefined || body == null) { - throw "Missing the required parameter 'body' when calling createUsersWithArrayInput"; + throw new Error("Missing the required parameter 'body' when calling createUsersWithArrayInput"); } @@ -142,7 +142,7 @@ // verify the required parameter 'body' is set if (body == undefined || body == null) { - throw "Missing the required parameter 'body' when calling createUsersWithListInput"; + throw new Error("Missing the required parameter 'body' when calling createUsersWithListInput"); } @@ -179,7 +179,7 @@ // verify the required parameter 'username' is set if (username == undefined || username == null) { - throw "Missing the required parameter 'username' when calling deleteUser"; + throw new Error("Missing the required parameter 'username' when calling deleteUser"); } @@ -217,7 +217,7 @@ // verify the required parameter 'username' is set if (username == undefined || username == null) { - throw "Missing the required parameter 'username' when calling getUserByName"; + throw new Error("Missing the required parameter 'username' when calling getUserByName"); } @@ -256,12 +256,12 @@ // verify the required parameter 'username' is set if (username == undefined || username == null) { - throw "Missing the required parameter 'username' when calling loginUser"; + throw new Error("Missing the required parameter 'username' when calling loginUser"); } // verify the required parameter 'password' is set if (password == undefined || password == null) { - throw "Missing the required parameter 'password' when calling loginUser"; + throw new Error("Missing the required parameter 'password' when calling loginUser"); } @@ -332,12 +332,12 @@ // verify the required parameter 'username' is set if (username == undefined || username == null) { - throw "Missing the required parameter 'username' when calling updateUser"; + throw new Error("Missing the required parameter 'username' when calling updateUser"); } // verify the required parameter 'body' is set if (body == undefined || body == null) { - throw "Missing the required parameter 'body' when calling updateUser"; + throw new Error("Missing the required parameter 'body' when calling updateUser"); } diff --git a/samples/client/petstore/javascript/src/api/FakeApi.js b/samples/client/petstore/javascript/src/api/FakeApi.js index edda32926dc..04363a01688 100644 --- a/samples/client/petstore/javascript/src/api/FakeApi.js +++ b/samples/client/petstore/javascript/src/api/FakeApi.js @@ -75,7 +75,7 @@ // verify the required parameter 'body' is set if (body == undefined || body == null) { - throw "Missing the required parameter 'body' when calling testClientModel"; + throw new Error("Missing the required parameter 'body' when calling testClientModel"); } @@ -134,22 +134,22 @@ // verify the required parameter '_number' is set if (_number == undefined || _number == null) { - throw "Missing the required parameter '_number' when calling testEndpointParameters"; + throw new Error("Missing the required parameter '_number' when calling testEndpointParameters"); } // verify the required parameter '_double' is set if (_double == undefined || _double == null) { - throw "Missing the required parameter '_double' when calling testEndpointParameters"; + throw new Error("Missing the required parameter '_double' when calling testEndpointParameters"); } // verify the required parameter 'patternWithoutDelimiter' is set if (patternWithoutDelimiter == undefined || patternWithoutDelimiter == null) { - throw "Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"; + throw new Error("Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"); } // verify the required parameter '_byte' is set if (_byte == undefined || _byte == null) { - throw "Missing the required parameter '_byte' when calling testEndpointParameters"; + throw new Error("Missing the required parameter '_byte' when calling testEndpointParameters"); } diff --git a/samples/client/petstore/javascript/src/api/PetApi.js b/samples/client/petstore/javascript/src/api/PetApi.js index aae8c9844d0..158e3d3e84d 100644 --- a/samples/client/petstore/javascript/src/api/PetApi.js +++ b/samples/client/petstore/javascript/src/api/PetApi.js @@ -75,7 +75,7 @@ // verify the required parameter 'body' is set if (body == undefined || body == null) { - throw "Missing the required parameter 'body' when calling addPet"; + throw new Error("Missing the required parameter 'body' when calling addPet"); } @@ -122,7 +122,7 @@ // verify the required parameter 'petId' is set if (petId == undefined || petId == null) { - throw "Missing the required parameter 'petId' when calling deletePet"; + throw new Error("Missing the required parameter 'petId' when calling deletePet"); } @@ -169,7 +169,7 @@ // verify the required parameter 'status' is set if (status == undefined || status == null) { - throw "Missing the required parameter 'status' when calling findPetsByStatus"; + throw new Error("Missing the required parameter 'status' when calling findPetsByStatus"); } @@ -215,7 +215,7 @@ // verify the required parameter 'tags' is set if (tags == undefined || tags == null) { - throw "Missing the required parameter 'tags' when calling findPetsByTags"; + throw new Error("Missing the required parameter 'tags' when calling findPetsByTags"); } @@ -261,7 +261,7 @@ // verify the required parameter 'petId' is set if (petId == undefined || petId == null) { - throw "Missing the required parameter 'petId' when calling getPetById"; + throw new Error("Missing the required parameter 'petId' when calling getPetById"); } @@ -306,7 +306,7 @@ // verify the required parameter 'body' is set if (body == undefined || body == null) { - throw "Missing the required parameter 'body' when calling updatePet"; + throw new Error("Missing the required parameter 'body' when calling updatePet"); } @@ -354,7 +354,7 @@ // verify the required parameter 'petId' is set if (petId == undefined || petId == null) { - throw "Missing the required parameter 'petId' when calling updatePetWithForm"; + throw new Error("Missing the required parameter 'petId' when calling updatePetWithForm"); } @@ -406,7 +406,7 @@ // verify the required parameter 'petId' is set if (petId == undefined || petId == null) { - throw "Missing the required parameter 'petId' when calling uploadFile"; + throw new Error("Missing the required parameter 'petId' when calling uploadFile"); } diff --git a/samples/client/petstore/javascript/src/api/StoreApi.js b/samples/client/petstore/javascript/src/api/StoreApi.js index 5290e1bec0f..98149910aff 100644 --- a/samples/client/petstore/javascript/src/api/StoreApi.js +++ b/samples/client/petstore/javascript/src/api/StoreApi.js @@ -75,7 +75,7 @@ // verify the required parameter 'orderId' is set if (orderId == undefined || orderId == null) { - throw "Missing the required parameter 'orderId' when calling deleteOrder"; + throw new Error("Missing the required parameter 'orderId' when calling deleteOrder"); } @@ -160,7 +160,7 @@ // verify the required parameter 'orderId' is set if (orderId == undefined || orderId == null) { - throw "Missing the required parameter 'orderId' when calling getOrderById"; + throw new Error("Missing the required parameter 'orderId' when calling getOrderById"); } @@ -206,7 +206,7 @@ // verify the required parameter 'body' is set if (body == undefined || body == null) { - throw "Missing the required parameter 'body' when calling placeOrder"; + throw new Error("Missing the required parameter 'body' when calling placeOrder"); } diff --git a/samples/client/petstore/javascript/src/api/UserApi.js b/samples/client/petstore/javascript/src/api/UserApi.js index b5234f1881b..a63968da0e9 100644 --- a/samples/client/petstore/javascript/src/api/UserApi.js +++ b/samples/client/petstore/javascript/src/api/UserApi.js @@ -75,7 +75,7 @@ // verify the required parameter 'body' is set if (body == undefined || body == null) { - throw "Missing the required parameter 'body' when calling createUser"; + throw new Error("Missing the required parameter 'body' when calling createUser"); } @@ -119,7 +119,7 @@ // verify the required parameter 'body' is set if (body == undefined || body == null) { - throw "Missing the required parameter 'body' when calling createUsersWithArrayInput"; + throw new Error("Missing the required parameter 'body' when calling createUsersWithArrayInput"); } @@ -163,7 +163,7 @@ // verify the required parameter 'body' is set if (body == undefined || body == null) { - throw "Missing the required parameter 'body' when calling createUsersWithListInput"; + throw new Error("Missing the required parameter 'body' when calling createUsersWithListInput"); } @@ -207,7 +207,7 @@ // verify the required parameter 'username' is set if (username == undefined || username == null) { - throw "Missing the required parameter 'username' when calling deleteUser"; + throw new Error("Missing the required parameter 'username' when calling deleteUser"); } @@ -253,7 +253,7 @@ // verify the required parameter 'username' is set if (username == undefined || username == null) { - throw "Missing the required parameter 'username' when calling getUserByName"; + throw new Error("Missing the required parameter 'username' when calling getUserByName"); } @@ -300,12 +300,12 @@ // verify the required parameter 'username' is set if (username == undefined || username == null) { - throw "Missing the required parameter 'username' when calling loginUser"; + throw new Error("Missing the required parameter 'username' when calling loginUser"); } // verify the required parameter 'password' is set if (password == undefined || password == null) { - throw "Missing the required parameter 'password' when calling loginUser"; + throw new Error("Missing the required parameter 'password' when calling loginUser"); } @@ -390,12 +390,12 @@ // verify the required parameter 'username' is set if (username == undefined || username == null) { - throw "Missing the required parameter 'username' when calling updateUser"; + throw new Error("Missing the required parameter 'username' when calling updateUser"); } // verify the required parameter 'body' is set if (body == undefined || body == null) { - throw "Missing the required parameter 'body' when calling updateUser"; + throw new Error("Missing the required parameter 'body' when calling updateUser"); } diff --git a/samples/server/petstore/java-msf4j/.swagger-codegen-ignore b/samples/server/petstore/java-msf4j/.swagger-codegen-ignore new file mode 100644 index 00000000000..c5fa491b4c5 --- /dev/null +++ b/samples/server/petstore/java-msf4j/.swagger-codegen-ignore @@ -0,0 +1,23 @@ +# Swagger Codegen Ignore +# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/java-msf4j/LICENSE b/samples/server/petstore/java-msf4j/LICENSE new file mode 100644 index 00000000000..8dada3edaf5 --- /dev/null +++ b/samples/server/petstore/java-msf4j/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/samples/server/petstore/java-msf4j/README.md b/samples/server/petstore/java-msf4j/README.md new file mode 100644 index 00000000000..faa1cc0c2b7 --- /dev/null +++ b/samples/server/petstore/java-msf4j/README.md @@ -0,0 +1,23 @@ +# Swagger Jersey generated server + +## Overview +This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the +[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This +is an example of building a swagger-enabled JAX-RS server. + +This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. + +To run the server, please execute the following: + +``` +mvn clean package jetty:run +``` + +You can then view the swagger listing here: + +``` +http://localhost:8080/v2/swagger.json +``` + +Note that if you have configured the `host` to be something other than localhost, the calls through +swagger-ui will be directed to that host and not localhost! \ No newline at end of file diff --git a/samples/server/petstore/java-msf4j/pom.xml b/samples/server/petstore/java-msf4j/pom.xml new file mode 100644 index 00000000000..b408c98d9e1 --- /dev/null +++ b/samples/server/petstore/java-msf4j/pom.xml @@ -0,0 +1,103 @@ + + + + + org.wso2.msf4j + msf4j-service +2.0.0 + + + 4.0.0 + io.swagger + swagger-jaxrs-server + jar + swagger-jaxrs-server + 1.0.0 + + src/main/java + + + + org.apache.maven.plugins + maven-jar-plugin + + + + io.swagger.api.Application + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + + + + + + javax.servlet + servlet-api + ${servlet-api-version} + + + org.wso2.msf4j + msf4j-all + 2.0.0 + + + com.fasterxml.jackson.datatype + jackson-datatype-joda + 2.4.1 + + + org.glassfish.jersey.containers + jersey-container-servlet-core + ${jersey2-version} + + + org.glassfish.jersey.media + jersey-media-multipart + ${jersey2-version} + + + + + + sonatype-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + true + + + + + 1.7 + ${java.version} + ${java.version} + 1.5.9 + 9.2.9.v20150224 + 2.22.2 + 4.12 + 1.1.7 + 2.5 + 2.22.2 + UTF-8 + + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/ApiException.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/ApiException.java new file mode 100644 index 00000000000..97e535d3c21 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/ApiException.java @@ -0,0 +1,10 @@ +package io.swagger.api; + + +public class ApiException extends Exception{ + private int code; + public ApiException (int code, String msg) { + super(msg); + this.code = code; + } +} diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/ApiOriginFilter.java new file mode 100644 index 00000000000..38791eef046 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/ApiOriginFilter.java @@ -0,0 +1,22 @@ +package io.swagger.api; + +import java.io.IOException; + +import javax.servlet.*; +import javax.servlet.http.HttpServletResponse; + + +public class ApiOriginFilter implements javax.servlet.Filter { + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException, ServletException { + HttpServletResponse res = (HttpServletResponse) response; + res.addHeader("Access-Control-Allow-Origin", "*"); + res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); + res.addHeader("Access-Control-Allow-Headers", "Content-Type"); + chain.doFilter(request, response); + } + + public void destroy() {} + + public void init(FilterConfig filterConfig) throws ServletException {} +} \ No newline at end of file diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/ApiResponseMessage.java new file mode 100644 index 00000000000..87db95c1009 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/ApiResponseMessage.java @@ -0,0 +1,69 @@ +package io.swagger.api; + +import javax.xml.bind.annotation.XmlTransient; + +@javax.xml.bind.annotation.XmlRootElement + +public class ApiResponseMessage { + public static final int ERROR = 1; + public static final int WARNING = 2; + public static final int INFO = 3; + public static final int OK = 4; + public static final int TOO_BUSY = 5; + + int code; + String type; + String message; + + public ApiResponseMessage(){} + + public ApiResponseMessage(int code, String message){ + this.code = code; + switch(code){ + case ERROR: + setType("error"); + break; + case WARNING: + setType("warning"); + break; + case INFO: + setType("info"); + break; + case OK: + setType("ok"); + break; + case TOO_BUSY: + setType("too busy"); + break; + default: + setType("unknown"); + break; + } + this.message = message; + } + + @XmlTransient + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/Application.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/Application.java new file mode 100644 index 00000000000..8309ce8b142 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/Application.java @@ -0,0 +1,21 @@ +package io.swagger.api; + +import org.wso2.msf4j.MicroservicesRunner; + +/** + * Application entry point. + * + * @since 1.0.0-SNAPSHOT + */ +public class Application { + public static void main(String[] args) { + +System.out.println("starting Micro Services"); +//Before you run service replace .deploy(new ()) with your actual service class like .deploy(new ApisAPI()) then it will start that service. +//If you have multiple service classes add them in , seperated manner. +//Ex: .deploy(new PetApi()) + new MicroservicesRunner() + .deploy(new PetApi()) + .start(); + } +} diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApi.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApi.java new file mode 100644 index 00000000000..ca3257cd214 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApi.java @@ -0,0 +1,97 @@ +package io.swagger.api; + +import io.swagger.model.*; +import io.swagger.api.FakeApiService; +import io.swagger.api.factories.FakeApiServiceFactory; + +import io.swagger.annotations.ApiParam; +import io.swagger.jaxrs.*; + +import io.swagger.model.Client; +import java.util.Date; +import java.math.BigDecimal; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.FormDataParam; + +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.*; + +@Path("/fake") + + +@io.swagger.annotations.Api(description = "the fake API") + +public class FakeApi { + private final FakeApiService delegate = FakeApiServiceFactory.getFakeApi(); + + @PATCH + + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @io.swagger.annotations.ApiOperation(value = "To test \"client\" model", notes = "", response = Client.class, tags={ "fake", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + public Response testClientModel(@ApiParam(value = "client model" ,required=true) Client body +) + throws NotFoundException { + return delegate.testClientModel(body); + } + @POST + + @Consumes({ "application/xml; charset=utf-8", "application/json; charset=utf-8" }) + @Produces({ "application/xml; charset=utf-8", "application/json; charset=utf-8" }) + @io.swagger.annotations.ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", response = void.class, authorizations = { + @io.swagger.annotations.Authorization(value = "http_basic_test") + }, tags={ "fake", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = void.class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = void.class) }) + public Response testEndpointParameters(@ApiParam(value = "None", required=true) @FormParam("number") BigDecimal number +,@ApiParam(value = "None", required=true) @FormParam("double") Double _double +,@ApiParam(value = "None", required=true) @FormParam("pattern_without_delimiter") String patternWithoutDelimiter +,@ApiParam(value = "None", required=true) @FormParam("byte") byte[] _byte +,@ApiParam(value = "None") @FormParam("integer") Integer integer +,@ApiParam(value = "None") @FormParam("int32") Integer int32 +,@ApiParam(value = "None") @FormParam("int64") Long int64 +,@ApiParam(value = "None") @FormParam("float") Float _float +,@ApiParam(value = "None") @FormParam("string") String string +,@ApiParam(value = "None") @FormParam("binary") byte[] binary +,@ApiParam(value = "None") @FormParam("date") Date date +,@ApiParam(value = "None") @FormParam("dateTime") Date dateTime +,@ApiParam(value = "None") @FormParam("password") String password +,@ApiParam(value = "None") @FormParam("callback") String paramCallback +) + throws NotFoundException { + return delegate.testEndpointParameters(number,_double,patternWithoutDelimiter,_byte,integer,int32,int64,_float,string,binary,date,dateTime,password,paramCallback); + } + @GET + + @Consumes({ "application/json" }) + @Produces({ "application/json" }) + @io.swagger.annotations.ApiOperation(value = "To test enum parameters", notes = "", response = void.class, tags={ "fake", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = void.class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "Not found", response = void.class) }) + public Response testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @FormParam("enum_form_string_array") List enumFormStringArray +,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @FormParam("enum_form_string") String enumFormString +,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $")@HeaderParam("enum_header_string_array") List enumHeaderStringArray +,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString +,@ApiParam(value = "Query parameter enum test (string array)", allowableValues=">, $") @QueryParam("enum_query_string_array") List enumQueryStringArray +,@ApiParam(value = "Query parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @QueryParam("enum_query_string") String enumQueryString +,@ApiParam(value = "Query parameter enum test (double)") @QueryParam("enum_query_integer") BigDecimal enumQueryInteger +,@ApiParam(value = "Query parameter enum test (double)") @FormParam("enum_query_double") Double enumQueryDouble +) + throws NotFoundException { + return delegate.testEnumParameters(enumFormStringArray,enumFormString,enumHeaderStringArray,enumHeaderString,enumQueryStringArray,enumQueryString,enumQueryInteger,enumQueryDouble); + } +} diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApiService.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApiService.java new file mode 100644 index 00000000000..ae97d88b73a --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApiService.java @@ -0,0 +1,25 @@ +package io.swagger.api; + +import io.swagger.api.*; +import io.swagger.model.*; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import io.swagger.model.Client; +import java.util.Date; +import java.math.BigDecimal; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; + + +public abstract class FakeApiService { + public abstract Response testClientModel(Client body ) throws NotFoundException; + public abstract Response testEndpointParameters(BigDecimal number ,Double _double ,String patternWithoutDelimiter ,byte[] _byte ,Integer integer ,Integer int32 ,Long int64 ,Float _float ,String string ,byte[] binary ,Date date ,Date dateTime ,String password ,String paramCallback ) throws NotFoundException; + public abstract Response testEnumParameters(List enumFormStringArray ,String enumFormString ,List enumHeaderStringArray ,String enumHeaderString ,List enumQueryStringArray ,String enumQueryString ,BigDecimal enumQueryInteger ,Double enumQueryDouble ) throws NotFoundException; +} diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/JacksonJsonProvider.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/JacksonJsonProvider.java new file mode 100644 index 00000000000..f476187ce3f --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/JacksonJsonProvider.java @@ -0,0 +1,27 @@ +package io.swagger.api; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.joda.JodaModule; +import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; + +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.ext.Provider; + +@Provider +@Produces({MediaType.APPLICATION_JSON}) +public class JacksonJsonProvider extends JacksonJaxbJsonProvider { + + public JacksonJsonProvider() { + + ObjectMapper objectMapper = new ObjectMapper() + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .registerModule(new JodaModule()) + .setDateFormat(new RFC3339DateFormat()); + + setMapper(objectMapper); + } +} \ No newline at end of file diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/NotFoundException.java new file mode 100644 index 00000000000..b28b67ea4b2 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/NotFoundException.java @@ -0,0 +1,10 @@ +package io.swagger.api; + + +public class NotFoundException extends ApiException { + private int code; + public NotFoundException (int code, String msg) { + super(code, msg); + this.code = code; + } +} diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/PetApi.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/PetApi.java new file mode 100644 index 00000000000..641fcd6bd28 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/PetApi.java @@ -0,0 +1,187 @@ +package io.swagger.api; + +import io.swagger.model.*; +import io.swagger.api.PetApiService; +import io.swagger.api.factories.PetApiServiceFactory; + +import io.swagger.annotations.ApiParam; +import io.swagger.jaxrs.*; + +import io.swagger.model.Pet; +import java.io.File; +import io.swagger.model.ModelApiResponse; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.FormDataParam; + +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.*; + +@Path("/pet") + + +@io.swagger.annotations.Api(description = "the pet API") + +public class PetApi { + private final PetApiService delegate = PetApiServiceFactory.getPetApi(); + + @POST + + @Consumes({ "application/json", "application/xml" }) + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Add a new pet to the store", notes = "", response = void.class, authorizations = { + @io.swagger.annotations.Authorization(value = "petstore_auth", scopes = { + @io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }, tags={ "pet", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = void.class) }) + public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet body +) + throws NotFoundException { + return delegate.addPet(body); + } + @DELETE + @Path("/{petId}") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Deletes a pet", notes = "", response = void.class, authorizations = { + @io.swagger.annotations.Authorization(value = "petstore_auth", scopes = { + @io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }, tags={ "pet", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = void.class) }) + public Response deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathParam("petId") Long petId +,@ApiParam(value = "" )@HeaderParam("api_key") String apiKey +) + throws NotFoundException { + return delegate.deletePet(petId,apiKey); + } + @GET + @Path("/findByStatus") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { + @io.swagger.annotations.Authorization(value = "petstore_auth", scopes = { + @io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }, tags={ "pet", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), + + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Pet.class, responseContainer = "List") }) + public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter",required=true, allowableValues="available, pending, sold") @QueryParam("status") List status +) + throws NotFoundException { + return delegate.findPetsByStatus(status); + } + @GET + @Path("/findByTags") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { + @io.swagger.annotations.Authorization(value = "petstore_auth", scopes = { + @io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }, tags={ "pet", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), + + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class, responseContainer = "List") }) + public Response findPetsByTags(@ApiParam(value = "Tags to filter by",required=true) @QueryParam("tags") List tags +) + throws NotFoundException { + return delegate.findPetsByTags(tags); + } + @GET + @Path("/{petId}") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { + @io.swagger.annotations.Authorization(value = "api_key") + }, tags={ "pet", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class), + + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) + public Response getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathParam("petId") Long petId +) + throws NotFoundException { + return delegate.getPetById(petId); + } + @PUT + + @Consumes({ "application/json", "application/xml" }) + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Update an existing pet", notes = "", response = void.class, authorizations = { + @io.swagger.annotations.Authorization(value = "petstore_auth", scopes = { + @io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }, tags={ "pet", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = void.class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = void.class), + + @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = void.class) }) + public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet body +) + throws NotFoundException { + return delegate.updatePet(body); + } + @POST + @Path("/{petId}") + @Consumes({ "application/x-www-form-urlencoded" }) + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = void.class, authorizations = { + @io.swagger.annotations.Authorization(value = "petstore_auth", scopes = { + @io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }, tags={ "pet", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = void.class) }) + public Response updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathParam("petId") Long petId +,@ApiParam(value = "Updated name of the pet") @FormParam("name") String name +,@ApiParam(value = "Updated status of the pet") @FormParam("status") String status +) + throws NotFoundException { + return delegate.updatePetWithForm(petId,name,status); + } + @POST + @Path("/{petId}/uploadImage") + @Consumes({ "multipart/form-data" }) + @Produces({ "application/json" }) + @io.swagger.annotations.ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { + @io.swagger.annotations.Authorization(value = "petstore_auth", scopes = { + @io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }, tags={ "pet", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + public Response uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId +,@ApiParam(value = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata +, + @FormDataParam("file") InputStream fileInputStream, + @FormDataParam("file") FormDataContentDisposition fileDetail +) + throws NotFoundException { + return delegate.uploadFile(petId,additionalMetadata,fileInputStream, fileDetail); + } +} diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/PetApiService.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/PetApiService.java new file mode 100644 index 00000000000..cc55195c9dc --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/PetApiService.java @@ -0,0 +1,30 @@ +package io.swagger.api; + +import io.swagger.api.*; +import io.swagger.model.*; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import io.swagger.model.Pet; +import java.io.File; +import io.swagger.model.ModelApiResponse; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; + + +public abstract class PetApiService { + public abstract Response addPet(Pet body ) throws NotFoundException; + public abstract Response deletePet(Long petId ,String apiKey ) throws NotFoundException; + public abstract Response findPetsByStatus(List status ) throws NotFoundException; + public abstract Response findPetsByTags(List tags ) throws NotFoundException; + public abstract Response getPetById(Long petId ) throws NotFoundException; + public abstract Response updatePet(Pet body ) throws NotFoundException; + public abstract Response updatePetWithForm(Long petId ,String name ,String status ) throws NotFoundException; + public abstract Response uploadFile(Long petId ,String additionalMetadata ,InputStream fileInputStream, FormDataContentDisposition fileDetail ) throws NotFoundException; +} diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/RFC3339DateFormat.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/RFC3339DateFormat.java new file mode 100644 index 00000000000..7c9e260509e --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/RFC3339DateFormat.java @@ -0,0 +1,19 @@ +package io.swagger.api; + +import com.fasterxml.jackson.databind.util.ISO8601DateFormat; +import com.fasterxml.jackson.databind.util.ISO8601Utils; + +import java.text.FieldPosition; +import java.util.Date; + +public class RFC3339DateFormat extends ISO8601DateFormat { + + // Same as ISO8601DateFormat but serializing milliseconds. + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + String value = ISO8601Utils.format(date, true); + toAppendTo.append(value); + return toAppendTo; + } + +} \ No newline at end of file diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/StoreApi.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/StoreApi.java new file mode 100644 index 00000000000..4bd3369fb9c --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/StoreApi.java @@ -0,0 +1,91 @@ +package io.swagger.api; + +import io.swagger.model.*; +import io.swagger.api.StoreApiService; +import io.swagger.api.factories.StoreApiServiceFactory; + +import io.swagger.annotations.ApiParam; +import io.swagger.jaxrs.*; + +import java.util.Map; +import io.swagger.model.Order; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.FormDataParam; + +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.*; + +@Path("/store") + + +@io.swagger.annotations.Api(description = "the store API") + +public class StoreApi { + private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi(); + + @DELETE + @Path("/order/{orderId}") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = void.class, tags={ "store", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = void.class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = void.class) }) + public Response deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathParam("orderId") String orderId +) + throws NotFoundException { + return delegate.deleteOrder(orderId); + } + @GET + @Path("/inventory") + + @Produces({ "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { + @io.swagger.annotations.Authorization(value = "api_key") + }, tags={ "store", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Integer.class, responseContainer = "Map") }) + public Response getInventory() + throws NotFoundException { + return delegate.getInventory(); + } + @GET + @Path("/order/{orderId}") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), + + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Order.class) }) + public Response getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathParam("orderId") Long orderId +) + throws NotFoundException { + return delegate.getOrderById(orderId); + } + @POST + @Path("/order") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), + + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) + public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) Order body +) + throws NotFoundException { + return delegate.placeOrder(body); + } +} diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/StoreApiService.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/StoreApiService.java new file mode 100644 index 00000000000..40d6e37102a --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/StoreApiService.java @@ -0,0 +1,25 @@ +package io.swagger.api; + +import io.swagger.api.*; +import io.swagger.model.*; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import java.util.Map; +import io.swagger.model.Order; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; + + +public abstract class StoreApiService { + public abstract Response deleteOrder(String orderId ) throws NotFoundException; + public abstract Response getInventory() throws NotFoundException; + public abstract Response getOrderById(Long orderId ) throws NotFoundException; + public abstract Response placeOrder(Order body ) throws NotFoundException; +} diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/StringUtil.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/StringUtil.java new file mode 100644 index 00000000000..6f4a3dadbbf --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/StringUtil.java @@ -0,0 +1,42 @@ +package io.swagger.api; + + +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) return true; + if (value != null && value.equalsIgnoreCase(str)) return true; + } + return false; + } + + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) return ""; + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } +} diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/UserApi.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/UserApi.java new file mode 100644 index 00000000000..6db93811a67 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/UserApi.java @@ -0,0 +1,141 @@ +package io.swagger.api; + +import io.swagger.model.*; +import io.swagger.api.UserApiService; +import io.swagger.api.factories.UserApiServiceFactory; + +import io.swagger.annotations.ApiParam; +import io.swagger.jaxrs.*; + +import io.swagger.model.User; +import java.util.List; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; +import org.glassfish.jersey.media.multipart.FormDataParam; + +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; +import javax.ws.rs.*; + +@Path("/user") + + +@io.swagger.annotations.Api(description = "the user API") + +public class UserApi { + private final UserApiService delegate = UserApiServiceFactory.getUserApi(); + + @POST + + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = void.class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = void.class) }) + public Response createUser(@ApiParam(value = "Created user object" ,required=true) User body +) + throws NotFoundException { + return delegate.createUser(body); + } + @POST + @Path("/createWithArray") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = void.class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = void.class) }) + public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) List body +) + throws NotFoundException { + return delegate.createUsersWithArrayInput(body); + } + @POST + @Path("/createWithList") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = void.class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = void.class) }) + public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) List body +) + throws NotFoundException { + return delegate.createUsersWithListInput(body); + } + @DELETE + @Path("/{username}") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = void.class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = void.class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = void.class) }) + public Response deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathParam("username") String username +) + throws NotFoundException { + return delegate.deleteUser(username); + } + @GET + @Path("/{username}") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = User.class), + + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = User.class) }) + public Response getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true) @PathParam("username") String username +) + throws NotFoundException { + return delegate.getUserByName(username); + } + @GET + @Path("/login") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = String.class), + + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) + public Response loginUser(@ApiParam(value = "The user name for login",required=true) @QueryParam("username") String username +,@ApiParam(value = "The password for login in clear text",required=true) @QueryParam("password") String password +) + throws NotFoundException { + return delegate.loginUser(username,password); + } + @GET + @Path("/logout") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Logs out current logged in user session", notes = "", response = void.class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = void.class) }) + public Response logoutUser() + throws NotFoundException { + return delegate.logoutUser(); + } + @PUT + @Path("/{username}") + + @Produces({ "application/xml", "application/json" }) + @io.swagger.annotations.ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = void.class, tags={ "user", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied", response = void.class), + + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = void.class) }) + public Response updateUser(@ApiParam(value = "name that need to be deleted",required=true) @PathParam("username") String username +,@ApiParam(value = "Updated user object" ,required=true) User body +) + throws NotFoundException { + return delegate.updateUser(username,body); + } +} diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/UserApiService.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/UserApiService.java new file mode 100644 index 00000000000..2d41ae3a61d --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/UserApiService.java @@ -0,0 +1,29 @@ +package io.swagger.api; + +import io.swagger.api.*; +import io.swagger.model.*; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import io.swagger.model.User; +import java.util.List; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; + + +public abstract class UserApiService { + public abstract Response createUser(User body ) throws NotFoundException; + public abstract Response createUsersWithArrayInput(List body ) throws NotFoundException; + public abstract Response createUsersWithListInput(List body ) throws NotFoundException; + public abstract Response deleteUser(String username ) throws NotFoundException; + public abstract Response getUserByName(String username ) throws NotFoundException; + public abstract Response loginUser(String username ,String password ) throws NotFoundException; + public abstract Response logoutUser() throws NotFoundException; + public abstract Response updateUser(String username ,User body ) throws NotFoundException; +} diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/AdditionalPropertiesClass.java new file mode 100644 index 00000000000..f74f7d3d882 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/AdditionalPropertiesClass.java @@ -0,0 +1,110 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * AdditionalPropertiesClass + */ + +public class AdditionalPropertiesClass { + @JsonProperty("map_property") + private Map mapProperty = new HashMap(); + + @JsonProperty("map_of_map_property") + private Map> mapOfMapProperty = new HashMap>(); + + public AdditionalPropertiesClass mapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + return this; + } + + public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) { + this.mapProperty.put(key, mapPropertyItem); + return this; + } + + /** + * Get mapProperty + * @return mapProperty + **/ + @ApiModelProperty(value = "") + public Map getMapProperty() { + return mapProperty; + } + + public void setMapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + } + + public AdditionalPropertiesClass mapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + return this; + } + + public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map mapOfMapPropertyItem) { + this.mapOfMapProperty.put(key, mapOfMapPropertyItem); + return this; + } + + /** + * Get mapOfMapProperty + * @return mapOfMapProperty + **/ + @ApiModelProperty(value = "") + public Map> getMapOfMapProperty() { + return mapOfMapProperty; + } + + public void setMapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; + return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) && + Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty); + } + + @Override + public int hashCode() { + return Objects.hash(mapProperty, mapOfMapProperty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesClass {\n"); + + sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n"); + sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Animal.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Animal.java new file mode 100644 index 00000000000..de739ed501c --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Animal.java @@ -0,0 +1,97 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Animal + */ + +public class Animal { + @JsonProperty("className") + private String className = null; + + @JsonProperty("color") + private String color = "red"; + + public Animal className(String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + **/ + @ApiModelProperty(required = true, value = "") + public String getClassName() { + return className; + } + + public void setClassName(String className) { + this.className = className; + } + + public Animal color(String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + **/ + @ApiModelProperty(value = "") + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Animal animal = (Animal) o; + return Objects.equals(this.className, animal.className) && + Objects.equals(this.color, animal.color); + } + + @Override + public int hashCode() { + return Objects.hash(className, color); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Animal {\n"); + + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/AnimalFarm.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/AnimalFarm.java new file mode 100644 index 00000000000..c2b0084d9cd --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/AnimalFarm.java @@ -0,0 +1,50 @@ +package io.swagger.model; + +import java.util.Objects; +import io.swagger.model.Animal; +import java.util.ArrayList; +import java.util.List; + +/** + * AnimalFarm + */ + +public class AnimalFarm extends ArrayList { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnimalFarm {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java new file mode 100644 index 00000000000..803eb69e16a --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -0,0 +1,82 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +/** + * ArrayOfArrayOfNumberOnly + */ + +public class ArrayOfArrayOfNumberOnly { + @JsonProperty("ArrayArrayNumber") + private List> arrayArrayNumber = new ArrayList>(); + + public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + return this; + } + + public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { + this.arrayArrayNumber.add(arrayArrayNumberItem); + return this; + } + + /** + * Get arrayArrayNumber + * @return arrayArrayNumber + **/ + @ApiModelProperty(value = "") + public List> getArrayArrayNumber() { + return arrayArrayNumber; + } + + public void setArrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly = (ArrayOfArrayOfNumberOnly) o; + return Objects.equals(this.arrayArrayNumber, arrayOfArrayOfNumberOnly.arrayArrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayArrayNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfArrayOfNumberOnly {\n"); + + sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/ArrayOfNumberOnly.java new file mode 100644 index 00000000000..bebc2470927 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/ArrayOfNumberOnly.java @@ -0,0 +1,82 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +/** + * ArrayOfNumberOnly + */ + +public class ArrayOfNumberOnly { + @JsonProperty("ArrayNumber") + private List arrayNumber = new ArrayList(); + + public ArrayOfNumberOnly arrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + return this; + } + + public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { + this.arrayNumber.add(arrayNumberItem); + return this; + } + + /** + * Get arrayNumber + * @return arrayNumber + **/ + @ApiModelProperty(value = "") + public List getArrayNumber() { + return arrayNumber; + } + + public void setArrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfNumberOnly arrayOfNumberOnly = (ArrayOfNumberOnly) o; + return Objects.equals(this.arrayNumber, arrayOfNumberOnly.arrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfNumberOnly {\n"); + + sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/ArrayTest.java new file mode 100644 index 00000000000..19464a99acd --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/ArrayTest.java @@ -0,0 +1,138 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.model.ReadOnlyFirst; +import java.util.ArrayList; +import java.util.List; + +/** + * ArrayTest + */ + +public class ArrayTest { + @JsonProperty("array_of_string") + private List arrayOfString = new ArrayList(); + + @JsonProperty("array_array_of_integer") + private List> arrayArrayOfInteger = new ArrayList>(); + + @JsonProperty("array_array_of_model") + private List> arrayArrayOfModel = new ArrayList>(); + + public ArrayTest arrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + return this; + } + + public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { + this.arrayOfString.add(arrayOfStringItem); + return this; + } + + /** + * Get arrayOfString + * @return arrayOfString + **/ + @ApiModelProperty(value = "") + public List getArrayOfString() { + return arrayOfString; + } + + public void setArrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + return this; + } + + public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { + this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); + return this; + } + + /** + * Get arrayArrayOfInteger + * @return arrayArrayOfInteger + **/ + @ApiModelProperty(value = "") + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + + public void setArrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + return this; + } + + public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { + this.arrayArrayOfModel.add(arrayArrayOfModelItem); + return this; + } + + /** + * Get arrayArrayOfModel + * @return arrayArrayOfModel + **/ + @ApiModelProperty(value = "") + public List> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + + public void setArrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayTest arrayTest = (ArrayTest) o; + return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) && + Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && + Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayTest {\n"); + + sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); + sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); + sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Cat.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Cat.java new file mode 100644 index 00000000000..95bea570923 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Cat.java @@ -0,0 +1,76 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.model.Animal; + +/** + * Cat + */ + +public class Cat extends Animal { + @JsonProperty("declawed") + private Boolean declawed = null; + + public Cat declawed(Boolean declawed) { + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + **/ + @ApiModelProperty(value = "") + public Boolean getDeclawed() { + return declawed; + } + + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cat cat = (Cat) o; + return Objects.equals(this.declawed, cat.declawed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(declawed, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Category.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Category.java new file mode 100644 index 00000000000..ba1ecfdb2b8 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Category.java @@ -0,0 +1,97 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Category + */ + +public class Category { + @JsonProperty("id") + private Long id = null; + + @JsonProperty("name") + private String name = null; + + public Category id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Category name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(this.id, category.id) && + Objects.equals(this.name, category.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Category {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Client.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Client.java new file mode 100644 index 00000000000..fcb2b0a8340 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Client.java @@ -0,0 +1,74 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Client + */ + +public class Client { + @JsonProperty("client") + private String client = null; + + public Client client(String client) { + this.client = client; + return this; + } + + /** + * Get client + * @return client + **/ + @ApiModelProperty(value = "") + public String getClient() { + return client; + } + + public void setClient(String client) { + this.client = client; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Client client = (Client) o; + return Objects.equals(this.client, client.client); + } + + @Override + public int hashCode() { + return Objects.hash(client); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Client {\n"); + + sb.append(" client: ").append(toIndentedString(client)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Dog.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Dog.java new file mode 100644 index 00000000000..f8072688756 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Dog.java @@ -0,0 +1,76 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.model.Animal; + +/** + * Dog + */ + +public class Dog extends Animal { + @JsonProperty("breed") + private String breed = null; + + public Dog breed(String breed) { + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + **/ + @ApiModelProperty(value = "") + public String getBreed() { + return breed; + } + + public void setBreed(String breed) { + this.breed = breed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dog dog = (Dog) o; + return Objects.equals(this.breed, dog.breed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(breed, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" breed: ").append(toIndentedString(breed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/EnumArrays.java new file mode 100644 index 00000000000..959b35e6b13 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/EnumArrays.java @@ -0,0 +1,167 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +/** + * EnumArrays + */ + +public class EnumArrays { + /** + * Gets or Sets justSymbol + */ + public enum JustSymbolEnum { + GREATER_THAN_OR_EQUAL_TO(">="), + + DOLLAR("$"); + + private String value; + + JustSymbolEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static JustSymbolEnum fromValue(String text) { + for (JustSymbolEnum b : JustSymbolEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("just_symbol") + private JustSymbolEnum justSymbol = null; + + /** + * Gets or Sets arrayEnum + */ + public enum ArrayEnumEnum { + FISH("fish"), + + CRAB("crab"); + + private String value; + + ArrayEnumEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ArrayEnumEnum fromValue(String text) { + for (ArrayEnumEnum b : ArrayEnumEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("array_enum") + private List arrayEnum = new ArrayList(); + + public EnumArrays justSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + return this; + } + + /** + * Get justSymbol + * @return justSymbol + **/ + @ApiModelProperty(value = "") + public JustSymbolEnum getJustSymbol() { + return justSymbol; + } + + public void setJustSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + } + + public EnumArrays arrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + return this; + } + + public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { + this.arrayEnum.add(arrayEnumItem); + return this; + } + + /** + * Get arrayEnum + * @return arrayEnum + **/ + @ApiModelProperty(value = "") + public List getArrayEnum() { + return arrayEnum; + } + + public void setArrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumArrays enumArrays = (EnumArrays) o; + return Objects.equals(this.justSymbol, enumArrays.justSymbol) && + Objects.equals(this.arrayEnum, enumArrays.arrayEnum); + } + + @Override + public int hashCode() { + return Objects.hash(justSymbol, arrayEnum); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumArrays {\n"); + + sb.append(" justSymbol: ").append(toIndentedString(justSymbol)).append("\n"); + sb.append(" arrayEnum: ").append(toIndentedString(arrayEnum)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/EnumClass.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/EnumClass.java new file mode 100644 index 00000000000..d8ac42c4872 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/EnumClass.java @@ -0,0 +1,41 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonValue; + +import com.fasterxml.jackson.annotation.JsonCreator; + +/** + * Gets or Sets EnumClass + */ +public enum EnumClass { + + _ABC("_abc"), + + _EFG("-efg"), + + _XYZ_("(xyz)"); + + private String value; + + EnumClass(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumClass fromValue(String text) { + for (EnumClass b : EnumClass.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/EnumTest.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/EnumTest.java new file mode 100644 index 00000000000..446649217c8 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/EnumTest.java @@ -0,0 +1,214 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * EnumTest + */ + +public class EnumTest { + /** + * Gets or Sets enumString + */ + public enum EnumStringEnum { + UPPER("UPPER"), + + LOWER("lower"); + + private String value; + + EnumStringEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringEnum fromValue(String text) { + for (EnumStringEnum b : EnumStringEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("enum_string") + private EnumStringEnum enumString = null; + + /** + * Gets or Sets enumInteger + */ + public enum EnumIntegerEnum { + NUMBER_1(1), + + NUMBER_MINUS_1(-1); + + private Integer value; + + EnumIntegerEnum(Integer value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumIntegerEnum fromValue(String text) { + for (EnumIntegerEnum b : EnumIntegerEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("enum_integer") + private EnumIntegerEnum enumInteger = null; + + /** + * Gets or Sets enumNumber + */ + public enum EnumNumberEnum { + NUMBER_1_DOT_1(1.1), + + NUMBER_MINUS_1_DOT_2(-1.2); + + private Double value; + + EnumNumberEnum(Double value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumNumberEnum fromValue(String text) { + for (EnumNumberEnum b : EnumNumberEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("enum_number") + private EnumNumberEnum enumNumber = null; + + public EnumTest enumString(EnumStringEnum enumString) { + this.enumString = enumString; + return this; + } + + /** + * Get enumString + * @return enumString + **/ + @ApiModelProperty(value = "") + public EnumStringEnum getEnumString() { + return enumString; + } + + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; + } + + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return this; + } + + /** + * Get enumInteger + * @return enumInteger + **/ + @ApiModelProperty(value = "") + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + public EnumTest enumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return this; + } + + /** + * Get enumNumber + * @return enumNumber + **/ + @ApiModelProperty(value = "") + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumInteger, enumTest.enumInteger) && + Objects.equals(this.enumNumber, enumTest.enumNumber); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumInteger, enumNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumTest {\n"); + + sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/FormatTest.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/FormatTest.java new file mode 100644 index 00000000000..7c882eb3fee --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/FormatTest.java @@ -0,0 +1,362 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.Date; + +/** + * FormatTest + */ + +public class FormatTest { + @JsonProperty("integer") + private Integer integer = null; + + @JsonProperty("int32") + private Integer int32 = null; + + @JsonProperty("int64") + private Long int64 = null; + + @JsonProperty("number") + private BigDecimal number = null; + + @JsonProperty("float") + private Float _float = null; + + @JsonProperty("double") + private Double _double = null; + + @JsonProperty("string") + private String string = null; + + @JsonProperty("byte") + private byte[] _byte = null; + + @JsonProperty("binary") + private byte[] binary = null; + + @JsonProperty("date") + private Date date = null; + + @JsonProperty("dateTime") + private Date dateTime = null; + + @JsonProperty("uuid") + private String uuid = null; + + @JsonProperty("password") + private String password = null; + + public FormatTest integer(Integer integer) { + this.integer = integer; + return this; + } + + /** + * Get integer + * minimum: 10.0 + * maximum: 100.0 + * @return integer + **/ + @ApiModelProperty(value = "") + public Integer getInteger() { + return integer; + } + + public void setInteger(Integer integer) { + this.integer = integer; + } + + public FormatTest int32(Integer int32) { + this.int32 = int32; + return this; + } + + /** + * Get int32 + * minimum: 20.0 + * maximum: 200.0 + * @return int32 + **/ + @ApiModelProperty(value = "") + public Integer getInt32() { + return int32; + } + + public void setInt32(Integer int32) { + this.int32 = int32; + } + + public FormatTest int64(Long int64) { + this.int64 = int64; + return this; + } + + /** + * Get int64 + * @return int64 + **/ + @ApiModelProperty(value = "") + public Long getInt64() { + return int64; + } + + public void setInt64(Long int64) { + this.int64 = int64; + } + + public FormatTest number(BigDecimal number) { + this.number = number; + return this; + } + + /** + * Get number + * minimum: 32.1 + * maximum: 543.2 + * @return number + **/ + @ApiModelProperty(required = true, value = "") + public BigDecimal getNumber() { + return number; + } + + public void setNumber(BigDecimal number) { + this.number = number; + } + + public FormatTest _float(Float _float) { + this._float = _float; + return this; + } + + /** + * Get _float + * minimum: 54.3 + * maximum: 987.6 + * @return _float + **/ + @ApiModelProperty(value = "") + public Float getFloat() { + return _float; + } + + public void setFloat(Float _float) { + this._float = _float; + } + + public FormatTest _double(Double _double) { + this._double = _double; + return this; + } + + /** + * Get _double + * minimum: 67.8 + * maximum: 123.4 + * @return _double + **/ + @ApiModelProperty(value = "") + public Double getDouble() { + return _double; + } + + public void setDouble(Double _double) { + this._double = _double; + } + + public FormatTest string(String string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + **/ + @ApiModelProperty(value = "") + public String getString() { + return string; + } + + public void setString(String string) { + this.string = string; + } + + public FormatTest _byte(byte[] _byte) { + this._byte = _byte; + return this; + } + + /** + * Get _byte + * @return _byte + **/ + @ApiModelProperty(required = true, value = "") + public byte[] getByte() { + return _byte; + } + + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + public FormatTest binary(byte[] binary) { + this.binary = binary; + return this; + } + + /** + * Get binary + * @return binary + **/ + @ApiModelProperty(value = "") + public byte[] getBinary() { + return binary; + } + + public void setBinary(byte[] binary) { + this.binary = binary; + } + + public FormatTest date(Date date) { + this.date = date; + return this; + } + + /** + * Get date + * @return date + **/ + @ApiModelProperty(required = true, value = "") + public Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } + + public FormatTest dateTime(Date dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @ApiModelProperty(value = "") + public Date getDateTime() { + return dateTime; + } + + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + public FormatTest uuid(String uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @ApiModelProperty(value = "") + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public FormatTest password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @ApiModelProperty(required = true, value = "") + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormatTest formatTest = (FormatTest) o; + return Objects.equals(this.integer, formatTest.integer) && + Objects.equals(this.int32, formatTest.int32) && + Objects.equals(this.int64, formatTest.int64) && + Objects.equals(this.number, formatTest.number) && + Objects.equals(this._float, formatTest._float) && + Objects.equals(this._double, formatTest._double) && + Objects.equals(this.string, formatTest.string) && + Objects.equals(this._byte, formatTest._byte) && + Objects.equals(this.binary, formatTest.binary) && + Objects.equals(this.date, formatTest.date) && + Objects.equals(this.dateTime, formatTest.dateTime) && + Objects.equals(this.uuid, formatTest.uuid) && + Objects.equals(this.password, formatTest.password); + } + + @Override + public int hashCode() { + return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormatTest {\n"); + + sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); + sb.append(" int32: ").append(toIndentedString(int32)).append("\n"); + sb.append(" int64: ").append(toIndentedString(int64)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); + sb.append(" _double: ").append(toIndentedString(_double)).append("\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); + sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/HasOnlyReadOnly.java new file mode 100644 index 00000000000..3f5492a2e62 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/HasOnlyReadOnly.java @@ -0,0 +1,79 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * HasOnlyReadOnly + */ + +public class HasOnlyReadOnly { + @JsonProperty("bar") + private String bar = null; + + @JsonProperty("foo") + private String foo = null; + + /** + * Get bar + * @return bar + **/ + @ApiModelProperty(value = "") + public String getBar() { + return bar; + } + + /** + * Get foo + * @return foo + **/ + @ApiModelProperty(value = "") + public String getFoo() { + return foo; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HasOnlyReadOnly hasOnlyReadOnly = (HasOnlyReadOnly) o; + return Objects.equals(this.bar, hasOnlyReadOnly.bar) && + Objects.equals(this.foo, hasOnlyReadOnly.foo); + } + + @Override + public int hashCode() { + return Objects.hash(bar, foo); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HasOnlyReadOnly {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" foo: ").append(toIndentedString(foo)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/MapTest.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/MapTest.java new file mode 100644 index 00000000000..9ef30a045d0 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/MapTest.java @@ -0,0 +1,142 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * MapTest + */ + +public class MapTest { + @JsonProperty("map_map_of_string") + private Map> mapMapOfString = new HashMap>(); + + /** + * Gets or Sets inner + */ + public enum InnerEnum { + UPPER("UPPER"), + + LOWER("lower"); + + private String value; + + InnerEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static InnerEnum fromValue(String text) { + for (InnerEnum b : InnerEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("map_of_enum_string") + private Map mapOfEnumString = new HashMap(); + + public MapTest mapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + return this; + } + + public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { + this.mapMapOfString.put(key, mapMapOfStringItem); + return this; + } + + /** + * Get mapMapOfString + * @return mapMapOfString + **/ + @ApiModelProperty(value = "") + public Map> getMapMapOfString() { + return mapMapOfString; + } + + public void setMapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + } + + public MapTest mapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + return this; + } + + public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { + this.mapOfEnumString.put(key, mapOfEnumStringItem); + return this; + } + + /** + * Get mapOfEnumString + * @return mapOfEnumString + **/ + @ApiModelProperty(value = "") + public Map getMapOfEnumString() { + return mapOfEnumString; + } + + public void setMapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MapTest mapTest = (MapTest) o; + return Objects.equals(this.mapMapOfString, mapTest.mapMapOfString) && + Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString); + } + + @Override + public int hashCode() { + return Objects.hash(mapMapOfString, mapOfEnumString); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MapTest {\n"); + + sb.append(" mapMapOfString: ").append(toIndentedString(mapMapOfString)).append("\n"); + sb.append(" mapOfEnumString: ").append(toIndentedString(mapOfEnumString)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 00000000000..5a55ab81d68 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,130 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.model.Animal; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * MixedPropertiesAndAdditionalPropertiesClass + */ + +public class MixedPropertiesAndAdditionalPropertiesClass { + @JsonProperty("uuid") + private String uuid = null; + + @JsonProperty("dateTime") + private Date dateTime = null; + + @JsonProperty("map") + private Map map = new HashMap(); + + public MixedPropertiesAndAdditionalPropertiesClass uuid(String uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @ApiModelProperty(value = "") + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public MixedPropertiesAndAdditionalPropertiesClass dateTime(Date dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @ApiModelProperty(value = "") + public Date getDateTime() { + return dateTime; + } + + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + public MixedPropertiesAndAdditionalPropertiesClass map(Map map) { + this.map = map; + return this; + } + + public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { + this.map.put(key, mapItem); + return this; + } + + /** + * Get map + * @return map + **/ + @ApiModelProperty(value = "") + public Map getMap() { + return map; + } + + public void setMap(Map map) { + this.map = map; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; + return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && + Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && + Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, dateTime, map); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" map: ").append(toIndentedString(map)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Model200Response.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Model200Response.java new file mode 100644 index 00000000000..09ad4d0d60e --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Model200Response.java @@ -0,0 +1,98 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Model for testing model name starting with number + */ +@ApiModel(description = "Model for testing model name starting with number") + +public class Model200Response { + @JsonProperty("name") + private Integer name = null; + + @JsonProperty("class") + private String propertyClass = null; + + public Model200Response name(Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(value = "") + public Integer getName() { + return name; + } + + public void setName(Integer name) { + this.name = name; + } + + public Model200Response propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @ApiModelProperty(value = "") + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Model200Response _200Response = (Model200Response) o; + return Objects.equals(this.name, _200Response.name) && + Objects.equals(this.propertyClass, _200Response.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(name, propertyClass); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Model200Response {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/ModelApiResponse.java new file mode 100644 index 00000000000..82f447004ee --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/ModelApiResponse.java @@ -0,0 +1,120 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * ModelApiResponse + */ + +public class ModelApiResponse { + @JsonProperty("code") + private Integer code = null; + + @JsonProperty("type") + private String type = null; + + @JsonProperty("message") + private String message = null; + + public ModelApiResponse code(Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + **/ + @ApiModelProperty(value = "") + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public ModelApiResponse type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @ApiModelProperty(value = "") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public ModelApiResponse message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @ApiModelProperty(value = "") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(this.code, _apiResponse.code) && + Objects.equals(this.type, _apiResponse.type) && + Objects.equals(this.message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelApiResponse {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/ModelReturn.java new file mode 100644 index 00000000000..884a45c598e --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/ModelReturn.java @@ -0,0 +1,75 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Model for testing reserved words + */ +@ApiModel(description = "Model for testing reserved words") + +public class ModelReturn { + @JsonProperty("return") + private Integer _return = null; + + public ModelReturn _return(Integer _return) { + this._return = _return; + return this; + } + + /** + * Get _return + * @return _return + **/ + @ApiModelProperty(value = "") + public Integer getReturn() { + return _return; + } + + public void setReturn(Integer _return) { + this._return = _return; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelReturn _return = (ModelReturn) o; + return Objects.equals(this._return, _return._return); + } + + @Override + public int hashCode() { + return Objects.hash(_return); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + + sb.append(" _return: ").append(toIndentedString(_return)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Name.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Name.java new file mode 100644 index 00000000000..09085fb52dc --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Name.java @@ -0,0 +1,126 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Model for testing model name same as property name + */ +@ApiModel(description = "Model for testing model name same as property name") + +public class Name { + @JsonProperty("name") + private Integer name = null; + + @JsonProperty("snake_case") + private Integer snakeCase = null; + + @JsonProperty("property") + private String property = null; + + @JsonProperty("123Number") + private Integer _123Number = null; + + public Name name(Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(required = true, value = "") + public Integer getName() { + return name; + } + + public void setName(Integer name) { + this.name = name; + } + + /** + * Get snakeCase + * @return snakeCase + **/ + @ApiModelProperty(value = "") + public Integer getSnakeCase() { + return snakeCase; + } + + public Name property(String property) { + this.property = property; + return this; + } + + /** + * Get property + * @return property + **/ + @ApiModelProperty(value = "") + public String getProperty() { + return property; + } + + public void setProperty(String property) { + this.property = property; + } + + /** + * Get _123Number + * @return _123Number + **/ + @ApiModelProperty(value = "") + public Integer get123Number() { + return _123Number; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Name name = (Name) o; + return Objects.equals(this.name, name.name) && + Objects.equals(this.snakeCase, name.snakeCase) && + Objects.equals(this.property, name.property) && + Objects.equals(this._123Number, name._123Number); + } + + @Override + public int hashCode() { + return Objects.hash(name, snakeCase, property, _123Number); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Name {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n"); + sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append(" _123Number: ").append(toIndentedString(_123Number)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/NumberOnly.java new file mode 100644 index 00000000000..9424f7a4b5e --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/NumberOnly.java @@ -0,0 +1,75 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; + +/** + * NumberOnly + */ + +public class NumberOnly { + @JsonProperty("JustNumber") + private BigDecimal justNumber = null; + + public NumberOnly justNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + return this; + } + + /** + * Get justNumber + * @return justNumber + **/ + @ApiModelProperty(value = "") + public BigDecimal getJustNumber() { + return justNumber; + } + + public void setJustNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NumberOnly numberOnly = (NumberOnly) o; + return Objects.equals(this.justNumber, numberOnly.justNumber); + } + + @Override + public int hashCode() { + return Objects.hash(justNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumberOnly {\n"); + + sb.append(" justNumber: ").append(toIndentedString(justNumber)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Order.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Order.java new file mode 100644 index 00000000000..1dfe20badf0 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Order.java @@ -0,0 +1,224 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.Date; + +/** + * Order + */ + +public class Order { + @JsonProperty("id") + private Long id = null; + + @JsonProperty("petId") + private Long petId = null; + + @JsonProperty("quantity") + private Integer quantity = null; + + @JsonProperty("shipDate") + private Date shipDate = null; + + /** + * Order Status + */ + public enum StatusEnum { + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String text) { + for (StatusEnum b : StatusEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("status") + private StatusEnum status = null; + + @JsonProperty("complete") + private Boolean complete = false; + + public Order id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Order petId(Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + **/ + @ApiModelProperty(value = "") + public Long getPetId() { + return petId; + } + + public void setPetId(Long petId) { + this.petId = petId; + } + + public Order quantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + **/ + @ApiModelProperty(value = "") + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + public Order shipDate(Date shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + **/ + @ApiModelProperty(value = "") + public Date getShipDate() { + return shipDate; + } + + public void setShipDate(Date shipDate) { + this.shipDate = shipDate; + } + + public Order status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + **/ + @ApiModelProperty(value = "Order Status") + public StatusEnum getStatus() { + return status; + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + public Order complete(Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + **/ + @ApiModelProperty(value = "") + public Boolean getComplete() { + return complete; + } + + public void setComplete(Boolean complete) { + this.complete = complete; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(this.id, order.id) && + Objects.equals(this.petId, order.petId) && + Objects.equals(this.quantity, order.quantity) && + Objects.equals(this.shipDate, order.shipDate) && + Objects.equals(this.status, order.status) && + Objects.equals(this.complete, order.complete); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Order {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); + sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); + sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" complete: ").append(toIndentedString(complete)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Pet.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Pet.java new file mode 100644 index 00000000000..823d25e05a0 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Pet.java @@ -0,0 +1,237 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.model.Category; +import io.swagger.model.Tag; +import java.util.ArrayList; +import java.util.List; + +/** + * Pet + */ + +public class Pet { + @JsonProperty("id") + private Long id = null; + + @JsonProperty("category") + private Category category = null; + + @JsonProperty("name") + private String name = null; + + @JsonProperty("photoUrls") + private List photoUrls = new ArrayList(); + + @JsonProperty("tags") + private List tags = new ArrayList(); + + /** + * pet status in the store + */ + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String text) { + for (StatusEnum b : StatusEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + return null; + } + } + + @JsonProperty("status") + private StatusEnum status = null; + + public Pet id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Pet category(Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + **/ + @ApiModelProperty(value = "") + public Category getCategory() { + return category; + } + + public void setCategory(Category category) { + this.category = category; + } + + public Pet name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(example = "doggie", required = true, value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Pet photoUrls(List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + **/ + @ApiModelProperty(required = true, value = "") + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + public Pet tags(List tags) { + this.tags = tags; + return this; + } + + public Pet addTagsItem(Tag tagsItem) { + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @ApiModelProperty(value = "") + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public Pet status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + **/ + @ApiModelProperty(value = "pet status in the store") + public StatusEnum getStatus() { + return status; + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(this.id, pet.id) && + Objects.equals(this.category, pet.category) && + Objects.equals(this.name, pet.name) && + Objects.equals(this.photoUrls, pet.photoUrls) && + Objects.equals(this.tags, pet.tags) && + Objects.equals(this.status, pet.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Pet {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/ReadOnlyFirst.java new file mode 100644 index 00000000000..50a2a7e4184 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/ReadOnlyFirst.java @@ -0,0 +1,88 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * ReadOnlyFirst + */ + +public class ReadOnlyFirst { + @JsonProperty("bar") + private String bar = null; + + @JsonProperty("baz") + private String baz = null; + + /** + * Get bar + * @return bar + **/ + @ApiModelProperty(value = "") + public String getBar() { + return bar; + } + + public ReadOnlyFirst baz(String baz) { + this.baz = baz; + return this; + } + + /** + * Get baz + * @return baz + **/ + @ApiModelProperty(value = "") + public String getBaz() { + return baz; + } + + public void setBaz(String baz) { + this.baz = baz; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; + return Objects.equals(this.bar, readOnlyFirst.bar) && + Objects.equals(this.baz, readOnlyFirst.baz); + } + + @Override + public int hashCode() { + return Objects.hash(bar, baz); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadOnlyFirst {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" baz: ").append(toIndentedString(baz)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/SpecialModelName.java new file mode 100644 index 00000000000..2cdc99de90e --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/SpecialModelName.java @@ -0,0 +1,74 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * SpecialModelName + */ + +public class SpecialModelName { + @JsonProperty("$special[property.name]") + private Long specialPropertyName = null; + + public SpecialModelName specialPropertyName(Long specialPropertyName) { + this.specialPropertyName = specialPropertyName; + return this; + } + + /** + * Get specialPropertyName + * @return specialPropertyName + **/ + @ApiModelProperty(value = "") + public Long getSpecialPropertyName() { + return specialPropertyName; + } + + public void setSpecialPropertyName(Long specialPropertyName) { + this.specialPropertyName = specialPropertyName; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpecialModelName specialModelName = (SpecialModelName) o; + return Objects.equals(this.specialPropertyName, specialModelName.specialPropertyName); + } + + @Override + public int hashCode() { + return Objects.hash(specialPropertyName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + + sb.append(" specialPropertyName: ").append(toIndentedString(specialPropertyName)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Tag.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Tag.java new file mode 100644 index 00000000000..846812a5031 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/Tag.java @@ -0,0 +1,97 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Tag + */ + +public class Tag { + @JsonProperty("id") + private Long id = null; + + @JsonProperty("name") + private String name = null; + + public Tag id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Tag name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(this.id, tag.id) && + Objects.equals(this.name, tag.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Tag {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/User.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/User.java new file mode 100644 index 00000000000..52c5fff826e --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/User.java @@ -0,0 +1,235 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * User + */ + +public class User { + @JsonProperty("id") + private Long id = null; + + @JsonProperty("username") + private String username = null; + + @JsonProperty("firstName") + private String firstName = null; + + @JsonProperty("lastName") + private String lastName = null; + + @JsonProperty("email") + private String email = null; + + @JsonProperty("password") + private String password = null; + + @JsonProperty("phone") + private String phone = null; + + @JsonProperty("userStatus") + private Integer userStatus = null; + + public User id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public User username(String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + **/ + @ApiModelProperty(value = "") + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public User firstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + **/ + @ApiModelProperty(value = "") + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public User lastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + **/ + @ApiModelProperty(value = "") + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public User email(String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @ApiModelProperty(value = "") + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public User password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @ApiModelProperty(value = "") + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public User phone(String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @ApiModelProperty(value = "") + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public User userStatus(Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + **/ + @ApiModelProperty(value = "User Status") + public Integer getUserStatus() { + return userStatus; + } + + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(this.id, user.id) && + Objects.equals(this.username, user.username) && + Objects.equals(this.firstName, user.firstName) && + Objects.equals(this.lastName, user.lastName) && + Objects.equals(this.email, user.email) && + Objects.equals(this.password, user.password) && + Objects.equals(this.phone, user.phone) && + Objects.equals(this.userStatus, user.userStatus); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class User {\n"); + + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); + sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); + sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/factories/FakeApiServiceFactory.java b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/factories/FakeApiServiceFactory.java new file mode 100644 index 00000000000..101a55e18a9 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/factories/FakeApiServiceFactory.java @@ -0,0 +1,12 @@ +package io.swagger.api.factories; + +import io.swagger.api.FakeApiService; +import io.swagger.api.impl.FakeApiServiceImpl; + +public class FakeApiServiceFactory { + private final static FakeApiService service = new FakeApiServiceImpl(); + + public static FakeApiService getFakeApi() { + return service; + } +} diff --git a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/factories/PetApiServiceFactory.java b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/factories/PetApiServiceFactory.java new file mode 100644 index 00000000000..3ab0d559503 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/factories/PetApiServiceFactory.java @@ -0,0 +1,12 @@ +package io.swagger.api.factories; + +import io.swagger.api.PetApiService; +import io.swagger.api.impl.PetApiServiceImpl; + +public class PetApiServiceFactory { + private final static PetApiService service = new PetApiServiceImpl(); + + public static PetApiService getPetApi() { + return service; + } +} diff --git a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/factories/StoreApiServiceFactory.java b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/factories/StoreApiServiceFactory.java new file mode 100644 index 00000000000..d4008b473a1 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/factories/StoreApiServiceFactory.java @@ -0,0 +1,12 @@ +package io.swagger.api.factories; + +import io.swagger.api.StoreApiService; +import io.swagger.api.impl.StoreApiServiceImpl; + +public class StoreApiServiceFactory { + private final static StoreApiService service = new StoreApiServiceImpl(); + + public static StoreApiService getStoreApi() { + return service; + } +} diff --git a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/factories/UserApiServiceFactory.java b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/factories/UserApiServiceFactory.java new file mode 100644 index 00000000000..17ff7a10bc8 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/factories/UserApiServiceFactory.java @@ -0,0 +1,12 @@ +package io.swagger.api.factories; + +import io.swagger.api.UserApiService; +import io.swagger.api.impl.UserApiServiceImpl; + +public class UserApiServiceFactory { + private final static UserApiService service = new UserApiServiceImpl(); + + public static UserApiService getUserApi() { + return service; + } +} diff --git a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java new file mode 100644 index 00000000000..f4fb6865495 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java @@ -0,0 +1,37 @@ +package io.swagger.api.impl; + +import io.swagger.api.*; +import io.swagger.model.*; + +import io.swagger.model.Client; +import java.util.Date; +import java.math.BigDecimal; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; + + +public class FakeApiServiceImpl extends FakeApiService { + @Override + public Response testClientModel(Client body ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, byte[] binary, Date date, Date dateTime, String password, String paramCallback ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response testEnumParameters(List enumFormStringArray, String enumFormString, List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, BigDecimal enumQueryInteger, Double enumQueryDouble ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java new file mode 100644 index 00000000000..e99c9fa1e75 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java @@ -0,0 +1,62 @@ +package io.swagger.api.impl; + +import io.swagger.api.*; +import io.swagger.model.*; + +import io.swagger.model.Pet; +import java.io.File; +import io.swagger.model.ModelApiResponse; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; + + +public class PetApiServiceImpl extends PetApiService { + @Override + public Response addPet(Pet body ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response deletePet(Long petId, String apiKey ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response findPetsByStatus(List status ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response findPetsByTags(List tags ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response getPetById(Long petId ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response updatePet(Pet body ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response updatePetWithForm(Long petId, String name, String status ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response uploadFile(Long petId, String additionalMetadata, InputStream fileInputStream, FormDataContentDisposition fileDetail ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java new file mode 100644 index 00000000000..9df17bebc17 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/StoreApiServiceImpl.java @@ -0,0 +1,41 @@ +package io.swagger.api.impl; + +import io.swagger.api.*; +import io.swagger.model.*; + +import java.util.Map; +import io.swagger.model.Order; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; + + +public class StoreApiServiceImpl extends StoreApiService { + @Override + public Response deleteOrder(String orderId ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response getInventory() throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response getOrderById(Long orderId ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response placeOrder(Order body ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java new file mode 100644 index 00000000000..bab444ea620 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/UserApiServiceImpl.java @@ -0,0 +1,61 @@ +package io.swagger.api.impl; + +import io.swagger.api.*; +import io.swagger.model.*; + +import io.swagger.model.User; +import java.util.List; + +import java.util.List; +import io.swagger.api.NotFoundException; + +import java.io.InputStream; + +import org.glassfish.jersey.media.multipart.FormDataContentDisposition; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; + + +public class UserApiServiceImpl extends UserApiService { + @Override + public Response createUser(User body ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response createUsersWithArrayInput(List body ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response createUsersWithListInput(List body ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response deleteUser(String username ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response getUserByName(String username ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response loginUser(String username, String password ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response logoutUser() throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response updateUser(String username, User body ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } +} diff --git a/samples/server/petstore/nancyfx/IO.Swagger.sln b/samples/server/petstore/nancyfx/IO.Swagger.sln index 46c91d37d01..e6fd22af6f6 100644 --- a/samples/server/petstore/nancyfx/IO.Swagger.sln +++ b/samples/server/petstore/nancyfx/IO.Swagger.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 VisualStudioVersion = 12.0.0.0 MinimumVisualStudioVersion = 10.0.0.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IO.Swagger", "src\IO.Swagger\IO.Swagger.csproj", "{7D50D142-14E1-4E99-842B-18D3AF159948}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -10,10 +10,17 @@ Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution +<<<<<<< HEAD +{7D50D142-14E1-4E99-842B-18D3AF159948}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +{7D50D142-14E1-4E99-842B-18D3AF159948}.Debug|Any CPU.Build.0 = Debug|Any CPU +{7D50D142-14E1-4E99-842B-18D3AF159948}.Release|Any CPU.ActiveCfg = Release|Any CPU +{7D50D142-14E1-4E99-842B-18D3AF159948}.Release|Any CPU.Build.0 = Release|Any CPU +======= {1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}.Debug|Any CPU.Build.0 = Debug|Any CPU {1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}.Release|Any CPU.ActiveCfg = Release|Any CPU {1CE943E7-586D-4D9C-BE8B-3E005FDC39D1}.Release|Any CPU.Build.0 = Release|Any CPU +>>>>>>> 92c474b2c235f4635e4be43a97c7941fec64dc82 {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -22,4 +29,4 @@ EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection -EndGlobal \ No newline at end of file +EndGlobal diff --git a/samples/server/petstore/nancyfx/src/IO.Swagger/IO.Swagger.csproj b/samples/server/petstore/nancyfx/src/IO.Swagger/IO.Swagger.csproj index 4c1283eae38..60535f7aae6 100644 --- a/samples/server/petstore/nancyfx/src/IO.Swagger/IO.Swagger.csproj +++ b/samples/server/petstore/nancyfx/src/IO.Swagger/IO.Swagger.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - {1CE943E7-586D-4D9C-BE8B-3E005FDC39D1} + {7D50D142-14E1-4E99-842B-18D3AF159948} Library Properties IO.Swagger.v2 @@ -63,4 +63,3 @@ -