forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/master' into 2.3.0
This commit is contained in:
commit
e964702550
1
.gitignore
vendored
1
.gitignore
vendored
@ -163,3 +163,4 @@ samples/client/petstore/typescript-node/npm/npm-debug.log
|
||||
|
||||
# aspnetcore
|
||||
samples/server/petstore/aspnetcore/.vs/
|
||||
effective.pom
|
||||
|
34
bin/java-petstore-resttemplate-withxml.sh
Executable file
34
bin/java-petstore-resttemplate-withxml.sh
Executable file
@ -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 -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-resttemplate.json -o samples/client/petstore/java/resttemplate-withXml -DhideGenerationTimestamp=true,withXml=true"
|
||||
|
||||
echo "Removing files and folders under samples/client/petstore/java/resttemplate/src/main"
|
||||
rm -rf samples/client/petstore/java/resttemplate-withXml/src/main
|
||||
find samples/client/petstore/java/resttemplate-withXml -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
|
||||
java $JAVA_OPTS -jar $executable $ags
|
31
bin/java-vertx-async-petstore-server.sh
Executable file
31
bin/java-vertx-async-petstore-server.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/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 -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l java-vertx -o samples/server/petstore/java-vertx/async -DvertxSwaggerRouterVersion=1.2.0"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
31
bin/java-vertx-rx-petstore-server.sh
Executable file
31
bin/java-vertx-rx-petstore-server.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/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 -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l java-vertx -o samples/server/petstore/java-vertx/rx -DvertxSwaggerRouterVersion=1.2.0,rxInterface=true"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
10
bin/windows/java-vertx-async-petstore-server.bat
Normal file
10
bin/windows/java-vertx-async-petstore-server.bat
Normal file
@ -0,0 +1,10 @@
|
||||
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l java-vertx -o samples\server\petstore\java-vertx\async -DvertxSwaggerRouterVersion=1.2.0
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
10
bin/windows/java-vertx-rx-petstore-server.bat
Normal file
10
bin/windows/java-vertx-rx-petstore-server.bat
Normal file
@ -0,0 +1,10 @@
|
||||
set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar
|
||||
|
||||
If Not Exist %executable% (
|
||||
mvn clean package
|
||||
)
|
||||
|
||||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
|
||||
set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l java-vertx -o samples\server\petstore\java-vertx\rx -DvertxSwaggerRouterVersion=1.2.0,rxInterface=true
|
||||
|
||||
java %JAVA_OPTS% -jar %executable% %ags%
|
@ -238,6 +238,12 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
@Parameter(name = "generateApiDocumentation", required = false)
|
||||
private Boolean generateApiDocumentation = true;
|
||||
|
||||
/**
|
||||
* Generate the api documentation
|
||||
*/
|
||||
@Parameter(name = "withXml", required = false)
|
||||
private Boolean withXml = false;
|
||||
|
||||
/**
|
||||
* Skip the execution.
|
||||
*/
|
||||
@ -384,6 +390,7 @@ public class CodeGenMojo extends AbstractMojo {
|
||||
System.setProperty("modelDocs", generateModelDocumentation.toString());
|
||||
System.setProperty("apiTests", generateApiTests.toString());
|
||||
System.setProperty("apiDocs", generateApiDocumentation.toString());
|
||||
System.setProperty("withXml", withXml.toString());
|
||||
|
||||
if (configOptions != null) {
|
||||
|
||||
|
@ -19,7 +19,7 @@ public class CodegenModel {
|
||||
public List<CodegenModel> interfaceModels;
|
||||
public List<CodegenModel> children;
|
||||
|
||||
public String name, classname, title, description, classVarName, modelJson, dataType;
|
||||
public String name, classname, title, description, classVarName, modelJson, dataType, xmlPrefix, xmlNamespace, xmlName;
|
||||
public String classFilename; // store the class file name, mainly used for import
|
||||
public String unescapedDescription;
|
||||
public String discriminator;
|
||||
@ -92,6 +92,12 @@ public class CodegenModel {
|
||||
return false;
|
||||
if (dataType != null ? !dataType.equals(that.dataType) : that.dataType != null)
|
||||
return false;
|
||||
if (xmlPrefix != null ? !xmlPrefix.equals(that.xmlPrefix) : that.xmlPrefix != null)
|
||||
return false;
|
||||
if (xmlNamespace != null ? !xmlNamespace.equals(that.xmlNamespace) : that.xmlNamespace != null)
|
||||
return false;
|
||||
if (xmlName != null ? !xmlName.equals(that.xmlName) : that.xmlName != null)
|
||||
return false;
|
||||
if (classFilename != null ? !classFilename.equals(that.classFilename) : that.classFilename != null)
|
||||
return false;
|
||||
if (unescapedDescription != null ? !unescapedDescription.equals(that.unescapedDescription) : that.unescapedDescription != null)
|
||||
@ -152,6 +158,9 @@ public class CodegenModel {
|
||||
result = 31 * result + (classVarName != null ? classVarName.hashCode() : 0);
|
||||
result = 31 * result + (modelJson != null ? modelJson.hashCode() : 0);
|
||||
result = 31 * result + (dataType != null ? dataType.hashCode() : 0);
|
||||
result = 31 * result + (xmlPrefix != null ? xmlPrefix.hashCode() : 0);
|
||||
result = 31 * result + (xmlNamespace != null ? xmlNamespace.hashCode() : 0);
|
||||
result = 31 * result + (xmlName != null ? xmlName.hashCode() : 0);
|
||||
result = 31 * result + (classFilename != null ? classFilename.hashCode() : 0);
|
||||
result = 31 * result + (unescapedDescription != null ? unescapedDescription.hashCode() : 0);
|
||||
result = 31 * result + (discriminator != null ? discriminator.hashCode() : 0);
|
||||
|
@ -55,6 +55,12 @@ public class CodegenProperty implements Cloneable {
|
||||
public Integer maxItems;
|
||||
public Integer minItems;
|
||||
|
||||
// XML
|
||||
public boolean isXmlAttribute = false;
|
||||
public String xmlPrefix;
|
||||
public String xmlName;
|
||||
public String xmlNamespace;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
@ -125,6 +131,10 @@ public class CodegenProperty implements Cloneable {
|
||||
result = prime * result + Objects.hashCode(enumName);
|
||||
result = prime * result + ((maxItems == null) ? 0 : maxItems.hashCode());
|
||||
result = prime * result + ((minItems == null) ? 0 : minItems.hashCode());
|
||||
result = prime * result + ((isXmlAttribute ? 13:31));
|
||||
result = prime * result + ((xmlPrefix == null) ? 0 : xmlPrefix.hashCode());
|
||||
result = prime * result + ((xmlName == null) ? 0 : xmlName.hashCode());
|
||||
result = prime * result + ((xmlNamespace == null) ? 0 : xmlNamespace.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -300,6 +310,18 @@ public class CodegenProperty implements Cloneable {
|
||||
if (this.minItems != other.minItems && (this.minItems == null || !this.minItems.equals(other.minItems))) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.isXmlAttribute, other.isXmlAttribute)) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.xmlPrefix, other.xmlPrefix)) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.xmlName, other.xmlName)) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.xmlNamespace, other.xmlNamespace)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1292,7 +1292,14 @@ public class DefaultCodegen {
|
||||
m.vendorExtensions = model.getVendorExtensions();
|
||||
|
||||
if (model instanceof ModelImpl) {
|
||||
m.discriminator = ((ModelImpl) model).getDiscriminator();
|
||||
ModelImpl modelImpl = (ModelImpl) model;
|
||||
m.discriminator = modelImpl.getDiscriminator();
|
||||
|
||||
if (modelImpl.getXml() != null) {
|
||||
m.xmlPrefix = modelImpl.getXml().getPrefix();
|
||||
m.xmlNamespace = modelImpl.getXml().getNamespace();
|
||||
m.xmlName = modelImpl.getXml().getName();
|
||||
}
|
||||
}
|
||||
|
||||
if (model instanceof ArrayModel) {
|
||||
@ -1316,8 +1323,14 @@ public class DefaultCodegen {
|
||||
int modelImplCnt = 0; // only one inline object allowed in a ComposedModel
|
||||
for (Model innerModel: ((ComposedModel)model).getAllOf()) {
|
||||
if (innerModel instanceof ModelImpl) {
|
||||
ModelImpl modelImpl = (ModelImpl) innerModel;
|
||||
if (m.discriminator == null) {
|
||||
m.discriminator = ((ModelImpl) innerModel).getDiscriminator();
|
||||
m.discriminator = modelImpl.getDiscriminator();
|
||||
}
|
||||
if (modelImpl.getXml() != null) {
|
||||
m.xmlPrefix = modelImpl.getXml().getPrefix();
|
||||
m.xmlNamespace = modelImpl.getXml().getNamespace();
|
||||
m.xmlName = modelImpl.getXml().getName();
|
||||
}
|
||||
if (modelImplCnt++ > 1) {
|
||||
LOGGER.warn("More than one inline schema specified in allOf:. Only the first one is recognized. All others are ignored.");
|
||||
@ -1517,6 +1530,14 @@ public class DefaultCodegen {
|
||||
if (p.getReadOnly() != null) {
|
||||
property.isReadOnly = p.getReadOnly();
|
||||
}
|
||||
if (p.getXml() != null) {
|
||||
if (p.getXml().getAttribute() != null) {
|
||||
property.isXmlAttribute = p.getXml().getAttribute();
|
||||
}
|
||||
property.xmlPrefix = p.getXml().getPrefix();
|
||||
property.xmlName = p.getXml().getName();
|
||||
property.xmlNamespace = p.getXml().getNamespace();
|
||||
}
|
||||
property.vendorExtensions = p.getVendorExtensions();
|
||||
|
||||
String type = getSwaggerType(p);
|
||||
|
@ -0,0 +1,42 @@
|
||||
package io.swagger.codegen.languages;
|
||||
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.CodegenProperty;
|
||||
import io.swagger.codegen.DefaultCodegen;
|
||||
import io.swagger.models.properties.Property;
|
||||
|
||||
abstract public class AbstractCppCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
@Override
|
||||
public String toVarName(String name) {
|
||||
if (typeMapping.keySet().contains(name) || typeMapping.values().contains(name)
|
||||
|| importMapping.values().contains(name) || defaultIncludes.contains(name)
|
||||
|| languageSpecificPrimitives.contains(name)) {
|
||||
return sanitizeName(name);
|
||||
}
|
||||
|
||||
if (name.length() > 1) {
|
||||
return sanitizeName(Character.toUpperCase(name.charAt(0)) + name.substring(1));
|
||||
}
|
||||
|
||||
return sanitizeName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toParamName(String name) {
|
||||
return sanitizeName(super.toParamName(name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenProperty fromProperty(String name, Property p) {
|
||||
CodegenProperty property = super.fromProperty(name, p);
|
||||
String nameInCamelCase = property.nameInCamelCase;
|
||||
if (nameInCamelCase.length() > 1) {
|
||||
nameInCamelCase = sanitizeName(Character.toLowerCase(nameInCamelCase.charAt(0)) + nameInCamelCase.substring(1));
|
||||
} else {
|
||||
nameInCamelCase = sanitizeName(nameInCamelCase);
|
||||
}
|
||||
property.nameInCamelCase = nameInCamelCase;
|
||||
return property;
|
||||
}
|
||||
}
|
@ -46,10 +46,12 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
public static final String DEFAULT_LIBRARY = "<default>";
|
||||
public static final String DATE_LIBRARY = "dateLibrary";
|
||||
public static final String JAVA8_MODE = "java8";
|
||||
public static final String WITH_XML = "withXml";
|
||||
public static final String SUPPORT_JAVA6 = "supportJava6";
|
||||
|
||||
protected String dateLibrary = "threetenbp";
|
||||
protected boolean java8Mode = false;
|
||||
protected boolean withXml = false;
|
||||
protected String invokerPackage = "io.swagger";
|
||||
protected String groupId = "io.swagger";
|
||||
protected String artifactId = "swagger-java";
|
||||
@ -148,6 +150,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
.SERIALIZE_BIG_DECIMAL_AS_STRING_DESC));
|
||||
cliOptions.add(CliOption.newBoolean(FULL_JAVA_UTIL, "whether to use fully qualified name for classes under java.util. This option only works for Java API client"));
|
||||
cliOptions.add(new CliOption("hideGenerationTimestamp", "hides the timestamp when files were generated"));
|
||||
cliOptions.add(CliOption.newBoolean(WITH_XML, "whether to include support for application/xml content type. This option only works for Java API client (resttemplate)"));
|
||||
|
||||
CliOption dateLibrary = new CliOption(DATE_LIBRARY, "Option. Date library to use");
|
||||
Map<String, String> dateOptions = new HashMap<String, String>();
|
||||
@ -317,6 +320,11 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
additionalProperties.put(FULL_JAVA_UTIL, fullJavaUtil);
|
||||
additionalProperties.put("javaUtilPrefix", javaUtilPrefix);
|
||||
|
||||
if (additionalProperties.containsKey(WITH_XML)) {
|
||||
this.setWithXml(Boolean.valueOf(additionalProperties.get(WITH_XML).toString()));
|
||||
}
|
||||
additionalProperties.put(WITH_XML, withXml);
|
||||
|
||||
// make api and model doc path available in mustache template
|
||||
additionalProperties.put("apiDocPath", apiDocPath);
|
||||
additionalProperties.put("modelDocPath", modelDocPath);
|
||||
@ -375,6 +383,13 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
}
|
||||
}
|
||||
|
||||
if(additionalProperties.containsKey(WITH_XML)) {
|
||||
setWithXml(Boolean.parseBoolean(additionalProperties.get(WITH_XML).toString()));
|
||||
if ( withXml ) {
|
||||
additionalProperties.put(WITH_XML, "true");
|
||||
}
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(DATE_LIBRARY)) {
|
||||
setDateLibrary(additionalProperties.get("dateLibrary").toString());
|
||||
}
|
||||
@ -1145,6 +1160,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
this.fullJavaUtil = fullJavaUtil;
|
||||
}
|
||||
|
||||
public void setWithXml(boolean withXml) {
|
||||
this.withXml = withXml;
|
||||
}
|
||||
|
||||
public void setDateLibrary(String library) {
|
||||
this.dateLibrary = library;
|
||||
}
|
||||
|
@ -45,8 +45,8 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
protected String apiDirName = "Api";
|
||||
protected String modelDirName = "Model";
|
||||
protected String variableNamingConvention= "snake_case";
|
||||
protected String apiDocPath = docsBasePath + "/" + apiDirName;
|
||||
protected String modelDocPath = docsBasePath + "/" + modelDirName;
|
||||
protected String apiDocPath = docsBasePath + File.separator + apiDirName;
|
||||
protected String modelDocPath = docsBasePath + File.separator + modelDirName;
|
||||
|
||||
public AbstractPhpCodegen() {
|
||||
super();
|
||||
@ -198,10 +198,10 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
additionalProperties.put("escapedInvokerPackage", invokerPackage.replace("\\", "\\\\"));
|
||||
|
||||
// make api and model src path available in mustache template
|
||||
additionalProperties.put("apiSrcPath", "./" + toSrcPath(apiPackage, srcBasePath));
|
||||
additionalProperties.put("modelSrcPath", "./" + toSrcPath(modelPackage, srcBasePath));
|
||||
additionalProperties.put("apiTestPath", "./" + testBasePath + "/" + apiDirName);
|
||||
additionalProperties.put("modelTestPath", "./" + testBasePath + "/" + modelDirName);
|
||||
additionalProperties.put("apiSrcPath", "." + File.separator + toSrcPath(apiPackage, srcBasePath));
|
||||
additionalProperties.put("modelSrcPath", "." + File.separator + toSrcPath(modelPackage, srcBasePath));
|
||||
additionalProperties.put("apiTestPath", "." + File.separator + testBasePath + File.separator + apiDirName);
|
||||
additionalProperties.put("modelTestPath", "." + File.separator + testBasePath + File.separator + modelDirName);
|
||||
|
||||
// make api and model doc path available in mustache template
|
||||
additionalProperties.put("apiDocPath", apiDocPath);
|
||||
@ -261,32 +261,32 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
|
||||
|
||||
@Override
|
||||
public String apiFileFolder() {
|
||||
return (outputFolder + "/" + toPackagePath(apiPackage, srcBasePath));
|
||||
return (outputFolder + File.separator + toPackagePath(apiPackage, srcBasePath));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelFileFolder() {
|
||||
return (outputFolder + "/" + toPackagePath(modelPackage, srcBasePath));
|
||||
return (outputFolder + File.separator + toPackagePath(modelPackage, srcBasePath));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiTestFileFolder() {
|
||||
return (outputFolder + "/" + getPackagePath() + "/" + testBasePath + "/" + apiDirName);
|
||||
return (outputFolder + File.separator + getPackagePath() + File.separator + testBasePath + File.separator + apiDirName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelTestFileFolder() {
|
||||
return (outputFolder + "/" + getPackagePath() + "/" + testBasePath + "/" + modelDirName);
|
||||
return (outputFolder + File.separator + getPackagePath() + File.separator + testBasePath + File.separator + modelDirName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiDocFileFolder() {
|
||||
return (outputFolder + "/" + getPackagePath() + "/" + apiDocPath);
|
||||
return (outputFolder + File.separator + getPackagePath() + File.separator + apiDocPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelDocFileFolder() {
|
||||
return (outputFolder + "/" + getPackagePath() + "/" + modelDocPath);
|
||||
return (outputFolder + File.separator + getPackagePath() + File.separator + modelDocPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,22 +1,47 @@
|
||||
package io.swagger.codegen.languages;
|
||||
|
||||
import static com.google.common.base.Strings.isNullOrEmpty;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import io.swagger.codegen.*;
|
||||
import io.swagger.codegen.examples.ExampleGenerator;
|
||||
|
||||
import io.swagger.codegen.CliOption;
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.CodegenModel;
|
||||
import io.swagger.codegen.CodegenOperation;
|
||||
import io.swagger.codegen.CodegenParameter;
|
||||
import io.swagger.codegen.CodegenProperty;
|
||||
import io.swagger.codegen.CodegenType;
|
||||
import io.swagger.codegen.SupportingFile;
|
||||
import io.swagger.codegen.utils.ModelUtils;
|
||||
import io.swagger.models.Model;
|
||||
import io.swagger.models.Operation;
|
||||
import io.swagger.models.Response;
|
||||
import io.swagger.models.Swagger;
|
||||
import io.swagger.models.properties.*;
|
||||
import io.swagger.models.properties.ArrayProperty;
|
||||
import io.swagger.models.properties.BaseIntegerProperty;
|
||||
import io.swagger.models.properties.BooleanProperty;
|
||||
import io.swagger.models.properties.DateProperty;
|
||||
import io.swagger.models.properties.DateTimeProperty;
|
||||
import io.swagger.models.properties.DecimalProperty;
|
||||
import io.swagger.models.properties.DoubleProperty;
|
||||
import io.swagger.models.properties.FileProperty;
|
||||
import io.swagger.models.properties.FloatProperty;
|
||||
import io.swagger.models.properties.IntegerProperty;
|
||||
import io.swagger.models.properties.LongProperty;
|
||||
import io.swagger.models.properties.MapProperty;
|
||||
import io.swagger.models.properties.Property;
|
||||
import io.swagger.models.properties.RefProperty;
|
||||
import io.swagger.models.properties.StringProperty;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.File;
|
||||
|
||||
import static com.google.common.base.Strings.isNullOrEmpty;
|
||||
|
||||
public class CppRestClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public class CppRestClientCodegen extends AbstractCppCodegen {
|
||||
|
||||
public static final String DECLSPEC = "declspec";
|
||||
public static final String DEFAULT_INCLUDE = "defaultInclude";
|
||||
@ -381,21 +406,6 @@ public class CppRestClientCodegen extends DefaultCodegen implements CodegenConfi
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toVarName(String name) {
|
||||
if (typeMapping.keySet().contains(name) || typeMapping.values().contains(name)
|
||||
|| importMapping.values().contains(name) || defaultIncludes.contains(name)
|
||||
|| languageSpecificPrimitives.contains(name)) {
|
||||
return name;
|
||||
}
|
||||
|
||||
if (name.length() > 1) {
|
||||
return Character.toUpperCase(name.charAt(0)) + name.substring(1);
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toApiName(String type) {
|
||||
return Character.toUpperCase(type.charAt(0)) + type.substring(1) + "Api";
|
||||
|
@ -0,0 +1,272 @@
|
||||
package io.swagger.codegen.languages;
|
||||
|
||||
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.models.HttpMethod;
|
||||
import io.swagger.models.Model;
|
||||
import io.swagger.models.Operation;
|
||||
import io.swagger.models.Path;
|
||||
import io.swagger.models.Swagger;
|
||||
import io.swagger.util.Json;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class JavaVertXServerCodegen extends AbstractJavaCodegen {
|
||||
|
||||
protected String resourceFolder = "src/main/resources";
|
||||
protected String rootPackage = "io.swagger.server.api";
|
||||
protected String apiVersion = "1.0.0-SNAPSHOT";
|
||||
|
||||
public static final String ROOT_PACKAGE = "rootPackage";
|
||||
|
||||
public static final String RX_INTERFACE_OPTION = "rxInterface";
|
||||
public static final String VERTX_SWAGGER_ROUTER_VERSION_OPTION = "vertxSwaggerRouterVersion";
|
||||
|
||||
/**
|
||||
* A Java Vert.X generator. It uses java8 date API. It can be configured with 2 CLI options :
|
||||
*
|
||||
* rxInterface : type Boolean if true, API interfaces are generated with RX and methods return
|
||||
* Single and Comparable. default : false
|
||||
*
|
||||
* vertxSwaggerRouterVersion : type String Specify the version of the swagger router library
|
||||
*/
|
||||
public JavaVertXServerCodegen() {
|
||||
super();
|
||||
|
||||
// set the output folder here
|
||||
outputFolder = "generated-code" + File.separator + "javaVertXServer";
|
||||
|
||||
modelTemplateFiles.clear();
|
||||
modelTemplateFiles.put("model.mustache", ".java");
|
||||
|
||||
apiTemplateFiles.clear();
|
||||
apiTemplateFiles.put("api.mustache", ".java");
|
||||
apiTemplateFiles.put("apiVerticle.mustache", "Verticle.java");
|
||||
apiTemplateFiles.put("apiException.mustache", "Exception.java");
|
||||
|
||||
embeddedTemplateDir = templateDir = "JavaVertXServer";
|
||||
|
||||
apiPackage = rootPackage + ".verticle";
|
||||
|
||||
modelPackage = rootPackage + ".model";
|
||||
|
||||
additionalProperties.put(ROOT_PACKAGE, rootPackage);
|
||||
|
||||
groupId = "io.swagger";
|
||||
artifactId = "swagger-java-vertx-server";
|
||||
artifactVersion = apiVersion;
|
||||
|
||||
this.setDateLibrary("java8");
|
||||
|
||||
cliOptions.add(CliOption.newBoolean(RX_INTERFACE_OPTION,
|
||||
"When specified, API interfaces are generated with RX "
|
||||
+ "and methods return Single<> and Comparable."));
|
||||
cliOptions.add(CliOption.newString(VERTX_SWAGGER_ROUTER_VERSION_OPTION,
|
||||
"Specify the version of the swagger router library"));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the type of generator.
|
||||
*
|
||||
* @return the CodegenType for this generator
|
||||
* @see io.swagger.codegen.CodegenType
|
||||
*/
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.SERVER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures a friendly name for the generator. This will be used by the generator to select
|
||||
* the library with the -l flag.
|
||||
*
|
||||
* @return the friendly name for the generator
|
||||
*/
|
||||
public String getName() {
|
||||
return "java-vertx";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns human-friendly help for the generator. Provide the consumer with help tips,
|
||||
* parameters here
|
||||
*
|
||||
* @return A string value for the help message
|
||||
*/
|
||||
public String getHelp() {
|
||||
return "Generates a java-Vert.X Server library.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
|
||||
apiTestTemplateFiles.clear();
|
||||
|
||||
importMapping.remove("JsonCreator");
|
||||
importMapping.remove("com.fasterxml.jackson.annotation.JsonProperty");
|
||||
importMapping.put("JsonInclude", "com.fasterxml.jackson.annotation.JsonInclude");
|
||||
importMapping.put("JsonProperty", "com.fasterxml.jackson.annotation.JsonProperty");
|
||||
importMapping.put("JsonValue", "com.fasterxml.jackson.annotation.JsonValue");
|
||||
importMapping.put("MainApiException", rootPackage + ".MainApiException");
|
||||
|
||||
modelDocTemplateFiles.clear();
|
||||
apiDocTemplateFiles.clear();
|
||||
|
||||
supportingFiles.clear();
|
||||
supportingFiles.add(new SupportingFile("swagger.mustache", resourceFolder, "swagger.json"));
|
||||
supportingFiles.add(new SupportingFile("MainApiVerticle.mustache",
|
||||
sourceFolder + File.separator + rootPackage.replace(".", File.separator),
|
||||
"MainApiVerticle.java"));
|
||||
supportingFiles.add(new SupportingFile("MainApiException.mustache",
|
||||
sourceFolder + File.separator + rootPackage.replace(".", File.separator),
|
||||
"MainApiException.java"));
|
||||
|
||||
writeOptional(outputFolder, new SupportingFile("vertx-default-jul-logging.mustache",
|
||||
resourceFolder, "vertx-default-jul-logging.properties"));
|
||||
writeOptional(outputFolder, new SupportingFile("pom.mustache", "", "pom.xml"));
|
||||
writeOptional(outputFolder, new SupportingFile("README.mustache", "", "README.md"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
|
||||
super.postProcessModelProperty(model, property);
|
||||
if (!model.isEnum) {
|
||||
model.imports.add("JsonInclude");
|
||||
model.imports.add("JsonProperty");
|
||||
if (model.hasEnums) {
|
||||
model.imports.add("JsonValue");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
|
||||
Map<String, Object> newObjs = super.postProcessOperations(objs);
|
||||
Map<String, Object> operations = (Map<String, Object>) newObjs.get("operations");
|
||||
if (operations != null) {
|
||||
List<CodegenOperation> ops = (List<CodegenOperation>) operations.get("operation");
|
||||
for (CodegenOperation operation : ops) {
|
||||
operation.httpMethod = operation.httpMethod.toLowerCase();
|
||||
|
||||
if ("Void".equalsIgnoreCase(operation.returnType)) {
|
||||
operation.returnType = null;
|
||||
}
|
||||
|
||||
if (operation.getHasPathParams()) {
|
||||
operation.path = camelizePath(operation.path);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return newObjs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenOperation fromOperation(String path, String httpMethod, Operation operation,
|
||||
Map<String, Model> definitions, Swagger swagger) {
|
||||
CodegenOperation codegenOperation =
|
||||
super.fromOperation(path, httpMethod, operation, definitions, swagger);
|
||||
codegenOperation.imports.add("MainApiException");
|
||||
return codegenOperation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodegenModel fromModel(String name, Model model, Map<String, Model> allDefinitions) {
|
||||
CodegenModel codegenModel = super.fromModel(name, model, allDefinitions);
|
||||
codegenModel.imports.remove("ApiModel");
|
||||
codegenModel.imports.remove("ApiModelProperty");
|
||||
return codegenModel;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preprocessSwagger(Swagger swagger) {
|
||||
super.preprocessSwagger(swagger);
|
||||
|
||||
// add full swagger definition in a mustache parameter
|
||||
String swaggerDef = Json.pretty(swagger);
|
||||
this.additionalProperties.put("fullSwagger", swaggerDef);
|
||||
|
||||
// add server port from the swagger file, 8080 by default
|
||||
String host = swagger.getHost();
|
||||
String port = extractPortFromHost(host);
|
||||
this.additionalProperties.put("serverPort", port);
|
||||
|
||||
// retrieve api version from swagger file, 1.0.0-SNAPSHOT by default
|
||||
if (swagger.getInfo() != null && swagger.getInfo().getVersion() != null) {
|
||||
artifactVersion = apiVersion = swagger.getInfo().getVersion();
|
||||
} else {
|
||||
artifactVersion = apiVersion;
|
||||
}
|
||||
|
||||
/*
|
||||
* manage operation & custom serviceId because operationId field is not
|
||||
* required and may be empty
|
||||
*/
|
||||
Map<String, Path> paths = swagger.getPaths();
|
||||
if (paths != null) {
|
||||
for (Entry<String, Path> entry : paths.entrySet()) {
|
||||
manageOperationNames(entry.getValue(), entry.getKey());
|
||||
}
|
||||
}
|
||||
this.additionalProperties.remove("gson");
|
||||
}
|
||||
|
||||
private void manageOperationNames(Path path, String pathname) {
|
||||
String serviceIdTemp;
|
||||
|
||||
Map<HttpMethod, Operation> operationMap = path.getOperationMap();
|
||||
if (operationMap != null) {
|
||||
for (Entry<HttpMethod, Operation> entry : operationMap.entrySet()) {
|
||||
serviceIdTemp = computeServiceId(pathname, entry);
|
||||
entry.getValue().setVendorExtension("x-serviceid", serviceIdTemp);
|
||||
entry.getValue().setVendorExtension("x-serviceid-varname",
|
||||
serviceIdTemp.toUpperCase() + "_SERVICE_ID");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String computeServiceId(String pathname, Entry<HttpMethod, Operation> entry) {
|
||||
String operationId = entry.getValue().getOperationId();
|
||||
return (operationId != null) ? operationId
|
||||
: entry.getKey().name()
|
||||
+ pathname.replaceAll("-", "_").replaceAll("/", "_").replaceAll("[{}]", "");
|
||||
}
|
||||
|
||||
protected String extractPortFromHost(String host) {
|
||||
if (host != null) {
|
||||
int portSeparatorIndex = host.indexOf(':');
|
||||
if (portSeparatorIndex >= 0 && portSeparatorIndex + 1 < host.length()) {
|
||||
return host.substring(portSeparatorIndex + 1);
|
||||
}
|
||||
}
|
||||
return "8080";
|
||||
}
|
||||
|
||||
private String camelizePath(String path) {
|
||||
String word = path;
|
||||
Pattern pattern = Pattern.compile("\\{([^/]*)\\}");
|
||||
Matcher matcher = pattern.matcher(word);
|
||||
while (matcher.find()) {
|
||||
word = matcher.replaceFirst(":" + matcher.group(1));
|
||||
matcher = pattern.matcher(word);
|
||||
}
|
||||
pattern = Pattern.compile("(_)(.)");
|
||||
matcher = pattern.matcher(word);
|
||||
while (matcher.find()) {
|
||||
word = matcher.replaceFirst(matcher.group(2).toUpperCase());
|
||||
matcher = pattern.matcher(word);
|
||||
}
|
||||
return word;
|
||||
}
|
||||
}
|
@ -1,18 +1,42 @@
|
||||
package io.swagger.codegen.languages;
|
||||
|
||||
|
||||
import io.swagger.codegen.*;
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import io.swagger.codegen.CodegenModel;
|
||||
import io.swagger.codegen.CodegenOperation;
|
||||
import io.swagger.codegen.CodegenParameter;
|
||||
import io.swagger.codegen.CodegenProperty;
|
||||
import io.swagger.codegen.CodegenType;
|
||||
import io.swagger.codegen.DefaultCodegen;
|
||||
import io.swagger.codegen.SupportingFile;
|
||||
import io.swagger.models.Model;
|
||||
import io.swagger.models.Operation;
|
||||
import io.swagger.models.Response;
|
||||
import io.swagger.models.Swagger;
|
||||
import io.swagger.models.properties.*;
|
||||
import io.swagger.models.properties.ArrayProperty;
|
||||
import io.swagger.models.properties.BaseIntegerProperty;
|
||||
import io.swagger.models.properties.BooleanProperty;
|
||||
import io.swagger.models.properties.DateProperty;
|
||||
import io.swagger.models.properties.DateTimeProperty;
|
||||
import io.swagger.models.properties.DecimalProperty;
|
||||
import io.swagger.models.properties.DoubleProperty;
|
||||
import io.swagger.models.properties.FileProperty;
|
||||
import io.swagger.models.properties.FloatProperty;
|
||||
import io.swagger.models.properties.IntegerProperty;
|
||||
import io.swagger.models.properties.LongProperty;
|
||||
import io.swagger.models.properties.MapProperty;
|
||||
import io.swagger.models.properties.Property;
|
||||
import io.swagger.models.properties.RefProperty;
|
||||
import io.swagger.models.properties.StringProperty;
|
||||
|
||||
import javax.validation.constraints.Null;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
public class PistacheServerCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public class PistacheServerCodegen extends AbstractCppCodegen {
|
||||
protected String implFolder = "impl";
|
||||
|
||||
@Override
|
||||
@ -376,21 +400,6 @@ public class PistacheServerCodegen extends DefaultCodegen implements CodegenConf
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toVarName(String name) {
|
||||
if (typeMapping.keySet().contains(name) || typeMapping.values().contains(name)
|
||||
|| importMapping.values().contains(name) || defaultIncludes.contains(name)
|
||||
|| languageSpecificPrimitives.contains(name)) {
|
||||
return name;
|
||||
}
|
||||
|
||||
if (name.length() > 1) {
|
||||
return Character.toUpperCase(name.charAt(0)) + name.substring(1);
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toApiName(String type) {
|
||||
return Character.toUpperCase(type.charAt(0)) + type.substring(1) + "Api";
|
||||
|
@ -10,19 +10,13 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import io.swagger.codegen.CliOption;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.CodegenModel;
|
||||
import io.swagger.codegen.CodegenOperation;
|
||||
import io.swagger.codegen.CodegenParameter;
|
||||
import io.swagger.codegen.CodegenProperty;
|
||||
import io.swagger.codegen.CodegenType;
|
||||
import io.swagger.codegen.DefaultCodegen;
|
||||
import io.swagger.codegen.SupportingFile;
|
||||
import io.swagger.models.Model;
|
||||
import io.swagger.models.Operation;
|
||||
import io.swagger.models.Response;
|
||||
import io.swagger.models.Swagger;
|
||||
import io.swagger.models.properties.ArrayProperty;
|
||||
import io.swagger.models.properties.BaseIntegerProperty;
|
||||
import io.swagger.models.properties.BooleanProperty;
|
||||
@ -39,7 +33,7 @@ import io.swagger.models.properties.Property;
|
||||
import io.swagger.models.properties.RefProperty;
|
||||
import io.swagger.models.properties.StringProperty;
|
||||
|
||||
public class RestbedCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public class RestbedCodegen extends AbstractCppCodegen {
|
||||
|
||||
public static final String DECLSPEC = "declspec";
|
||||
public static final String DEFAULT_INCLUDE = "defaultInclude";
|
||||
@ -233,44 +227,52 @@ public class RestbedCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
|
||||
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
||||
List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation");
|
||||
List<CodegenOperation> newOpList = new ArrayList<CodegenOperation>();
|
||||
for (CodegenOperation op : operationList) {
|
||||
String path = new String(op.path);
|
||||
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
||||
List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation");
|
||||
List<CodegenOperation> newOpList = new ArrayList<CodegenOperation>();
|
||||
for (CodegenOperation op : operationList) {
|
||||
String path = new String(op.path);
|
||||
|
||||
String[] items = path.split("/", -1);
|
||||
List<String> splitPath = new ArrayList<String>();
|
||||
op.path = "";
|
||||
for (String item: items) {
|
||||
if (item.matches("^\\{(.*)\\}$")) {
|
||||
item = item.substring(0, item.length()-1);
|
||||
item += ": .*}";
|
||||
}
|
||||
splitPath.add(item);
|
||||
op.path += item + "/";
|
||||
}
|
||||
boolean foundInNewList = false;
|
||||
for (CodegenOperation op1 : newOpList) {
|
||||
if (!foundInNewList) {
|
||||
if (op1.path.equals(op.path)) {
|
||||
foundInNewList = true;
|
||||
List<CodegenOperation> currentOtherMethodList = (List<CodegenOperation>) op1.vendorExtensions.get("x-codegen-otherMethods");
|
||||
if (currentOtherMethodList == null) {
|
||||
currentOtherMethodList = new ArrayList<CodegenOperation>();
|
||||
}
|
||||
op.operationIdCamelCase = op1.operationIdCamelCase;
|
||||
currentOtherMethodList.add(op);
|
||||
op1.vendorExtensions.put("x-codegen-otherMethods", currentOtherMethodList);
|
||||
String[] items = path.split("/", -1);
|
||||
String resourceNameCamelCase = "";
|
||||
op.path = "";
|
||||
for (String item: items) {
|
||||
if (item.length() > 1) {
|
||||
if (item.matches("^\\{(.*)\\}$")) {
|
||||
String tmpResourceName = item.substring(1, item.length()-1);
|
||||
resourceNameCamelCase += Character.toUpperCase(tmpResourceName.charAt(0)) + tmpResourceName.substring(1);
|
||||
item = item.substring(0, item.length()-1);
|
||||
item += ": .*}";
|
||||
} else {
|
||||
resourceNameCamelCase += Character.toUpperCase(item.charAt(0)) + item.substring(1);
|
||||
}
|
||||
} else if (item.length() == 1) {
|
||||
resourceNameCamelCase += Character.toUpperCase(item.charAt(0));
|
||||
}
|
||||
op.path += item + "/";
|
||||
}
|
||||
op.vendorExtensions.put("x-codegen-resourceName", resourceNameCamelCase);
|
||||
boolean foundInNewList = false;
|
||||
for (CodegenOperation op1 : newOpList) {
|
||||
if (!foundInNewList) {
|
||||
if (op1.path.equals(op.path)) {
|
||||
foundInNewList = true;
|
||||
List<CodegenOperation> currentOtherMethodList = (List<CodegenOperation>) op1.vendorExtensions.get("x-codegen-otherMethods");
|
||||
if (currentOtherMethodList == null) {
|
||||
currentOtherMethodList = new ArrayList<CodegenOperation>();
|
||||
}
|
||||
op.operationIdCamelCase = op1.operationIdCamelCase;
|
||||
currentOtherMethodList.add(op);
|
||||
op1.vendorExtensions.put("x-codegen-otherMethods", currentOtherMethodList);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!foundInNewList) {
|
||||
newOpList.add(op);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!foundInNewList) {
|
||||
newOpList.add(op);
|
||||
}
|
||||
}
|
||||
operations.put("operation", newOpList);
|
||||
return objs;
|
||||
operations.put("operation", newOpList);
|
||||
return objs;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -387,21 +389,6 @@ public class RestbedCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toVarName(String name) {
|
||||
if (typeMapping.keySet().contains(name) || typeMapping.values().contains(name)
|
||||
|| importMapping.values().contains(name) || defaultIncludes.contains(name)
|
||||
|| languageSpecificPrimitives.contains(name)) {
|
||||
return name;
|
||||
}
|
||||
|
||||
if (name.length() > 1) {
|
||||
return Character.toUpperCase(name.charAt(0)) + name.substring(1);
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toApiName(String type) {
|
||||
return Character.toUpperCase(type.charAt(0)) + type.substring(1) + "Api";
|
||||
|
@ -16,7 +16,6 @@ public class SymfonyServerCodegen extends AbstractPhpCodegen implements CodegenC
|
||||
@SuppressWarnings("hiding")
|
||||
static Logger LOGGER = LoggerFactory.getLogger(SymfonyServerCodegen.class);
|
||||
|
||||
public static final String VARIABLE_NAMING_CONVENTION = "variableNamingConvention";
|
||||
public static final String BUNDLE_NAME = "bundleName";
|
||||
public static final String COMPOSER_VENDOR_NAME = "composerVendorName";
|
||||
public static final String COMPOSER_PROJECT_NAME = "composerProjectName";
|
||||
@ -66,9 +65,9 @@ public class SymfonyServerCodegen extends AbstractPhpCodegen implements CodegenC
|
||||
setBundleName("SwaggerServer");
|
||||
packagePath = "SymfonyBundle-php";
|
||||
modelDirName = "Model";
|
||||
docsBasePath = "Resources/docs";
|
||||
apiDocPath = docsBasePath + "/" + apiDirName;
|
||||
modelDocPath = docsBasePath + "/" + modelDirName;
|
||||
docsBasePath = "Resources" + File.separator + "docs";
|
||||
apiDocPath = docsBasePath + File.separator + apiDirName;
|
||||
modelDocPath = docsBasePath + File.separator + modelDirName;
|
||||
outputFolder = "generated-code" + File.separator + "php";
|
||||
apiTemplateFiles.put("api_controller.mustache", ".php");
|
||||
modelTestTemplateFiles.put("model_test.mustache", ".php");
|
||||
@ -153,7 +152,7 @@ public class SymfonyServerCodegen extends AbstractPhpCodegen implements CodegenC
|
||||
|
||||
|
||||
public String controllerFileFolder() {
|
||||
return (outputFolder + "/" + toPackagePath(controllerPackage, srcBasePath));
|
||||
return (outputFolder + File.separator + toPackagePath(controllerPackage, srcBasePath));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -219,16 +218,6 @@ public class SymfonyServerCodegen extends AbstractPhpCodegen implements CodegenC
|
||||
additionalProperties.put(COMPOSER_VENDOR_NAME, composerVendorName);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.ARTIFACT_VERSION)) {
|
||||
this.setArtifactVersion((String) additionalProperties.get(CodegenConstants.ARTIFACT_VERSION));
|
||||
} else {
|
||||
additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(VARIABLE_NAMING_CONVENTION)) {
|
||||
this.setParameterNamingConvention((String) additionalProperties.get(VARIABLE_NAMING_CONVENTION));
|
||||
}
|
||||
|
||||
additionalProperties.put("escapedInvokerPackage", invokerPackage.replace("\\", "\\\\"));
|
||||
additionalProperties.put("controllerPackage", controllerPackage);
|
||||
additionalProperties.put("apiTestsPackage", apiTestsPackage);
|
||||
@ -241,13 +230,13 @@ public class SymfonyServerCodegen extends AbstractPhpCodegen implements CodegenC
|
||||
additionalProperties.put("bundleAlias", bundleAlias);
|
||||
|
||||
// make api and model src path available in mustache template
|
||||
additionalProperties.put("apiSrcPath", "./" + toSrcPath(apiPackage, srcBasePath));
|
||||
additionalProperties.put("modelSrcPath", "./" + toSrcPath(modelPackage, srcBasePath));
|
||||
additionalProperties.put("testsSrcPath", "./" + toSrcPath(testsPackage, srcBasePath));
|
||||
additionalProperties.put("apiTestsSrcPath", "./" + toSrcPath(apiTestsPackage, srcBasePath));
|
||||
additionalProperties.put("modelTestsSrcPath", "./" + toSrcPath(modelTestsPackage, srcBasePath));
|
||||
additionalProperties.put("apiTestPath", "./" + testsDirName + "/" + apiDirName);
|
||||
additionalProperties.put("modelTestPath", "./" + testsDirName + "/" + modelDirName);
|
||||
additionalProperties.put("apiSrcPath", "." + File.separator + toSrcPath(apiPackage, srcBasePath));
|
||||
additionalProperties.put("modelSrcPath", "." + File.separator + toSrcPath(modelPackage, srcBasePath));
|
||||
additionalProperties.put("testsSrcPath", "." + File.separator + toSrcPath(testsPackage, srcBasePath));
|
||||
additionalProperties.put("apiTestsSrcPath", "." + File.separator + toSrcPath(apiTestsPackage, srcBasePath));
|
||||
additionalProperties.put("modelTestsSrcPath", "." + File.separator + toSrcPath(modelTestsPackage, srcBasePath));
|
||||
additionalProperties.put("apiTestPath", "." + File.separator + testsDirName + File.separator + apiDirName);
|
||||
additionalProperties.put("modelTestPath", "." + File.separator + testsDirName + File.separator + modelDirName);
|
||||
|
||||
// make api and model doc path available in mustache template
|
||||
additionalProperties.put("apiDocPath", apiDocPath);
|
||||
@ -256,15 +245,18 @@ public class SymfonyServerCodegen extends AbstractPhpCodegen implements CodegenC
|
||||
// make test path available in mustache template
|
||||
additionalProperties.put("testsDirName", testsDirName);
|
||||
|
||||
final String configDir = getPackagePath() + File.separator + "Resources" + File.separator + "config";
|
||||
final String dependencyInjectionDir = getPackagePath() + File.separator + "DependencyInjection";
|
||||
|
||||
supportingFiles.add(new SupportingFile("Controller.mustache", toPackagePath(controllerPackage, srcBasePath), "Controller.php"));
|
||||
supportingFiles.add(new SupportingFile("Bundle.mustache", getPackagePath(), bundleClassName + ".php"));
|
||||
supportingFiles.add(new SupportingFile("Extension.mustache", getPackagePath() + "/DependencyInjection", bundleExtensionName + ".php"));
|
||||
supportingFiles.add(new SupportingFile("ApiPass.mustache", getPackagePath() + "/DependencyInjection/Compiler", bundleName + "ApiPass.php"));
|
||||
supportingFiles.add(new SupportingFile("Extension.mustache", dependencyInjectionDir, bundleExtensionName + ".php"));
|
||||
supportingFiles.add(new SupportingFile("ApiPass.mustache", dependencyInjectionDir + File.separator + "Compiler", bundleName + "ApiPass.php"));
|
||||
supportingFiles.add(new SupportingFile("ApiServer.mustache", toPackagePath(apiPackage, srcBasePath), "ApiServer.php"));
|
||||
supportingFiles.add(new SupportingFile("ModelSerializer.mustache", toPackagePath(modelPackage, srcBasePath), "ModelSerializer.php"));
|
||||
supportingFiles.add(new SupportingFile("ModelInterface.mustache", toPackagePath(modelPackage, srcBasePath), "ModelInterface.php"));
|
||||
supportingFiles.add(new SupportingFile("routing.mustache", getPackagePath() + "/Resources/config", "routing.yml"));
|
||||
supportingFiles.add(new SupportingFile("services.mustache", getPackagePath() + "/Resources/config", "services.yml"));
|
||||
supportingFiles.add(new SupportingFile("routing.mustache", configDir, "routing.yml"));
|
||||
supportingFiles.add(new SupportingFile("services.mustache", configDir, "services.yml"));
|
||||
supportingFiles.add(new SupportingFile("composer.mustache", getPackagePath(), "composer.json"));
|
||||
supportingFiles.add(new SupportingFile("autoload.mustache", getPackagePath(), "autoload.php"));
|
||||
supportingFiles.add(new SupportingFile("README.mustache", getPackagePath(), "README.md"));
|
||||
@ -281,6 +273,7 @@ public class SymfonyServerCodegen extends AbstractPhpCodegen implements CodegenC
|
||||
operations.put("controllerName", toControllerName((String) operations.get("pathPrefix")));
|
||||
operations.put("symfonyService", toSymfonyService((String) operations.get("pathPrefix")));
|
||||
|
||||
HashSet<CodegenSecurity> authMethods = new HashSet<>();
|
||||
HashSet<String> imports = new HashSet<>();
|
||||
List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation");
|
||||
for (CodegenOperation op : operationList) {
|
||||
@ -310,9 +303,15 @@ public class SymfonyServerCodegen extends AbstractPhpCodegen implements CodegenC
|
||||
imports.add(exception);
|
||||
}
|
||||
}
|
||||
|
||||
// Add operation's authentication methods to whole interface
|
||||
if (op.authMethods != null) {
|
||||
authMethods.addAll(op.authMethods);
|
||||
}
|
||||
}
|
||||
|
||||
operations.put("imports", new ArrayList<>(imports));
|
||||
operations.put("authMethods", authMethods);
|
||||
|
||||
return objs;
|
||||
}
|
||||
@ -332,11 +331,16 @@ public class SymfonyServerCodegen extends AbstractPhpCodegen implements CodegenC
|
||||
final String importType = var.datatype.replaceFirst("\\[\\]$", "");
|
||||
final String dataType = extractSimpleName(var.datatype);
|
||||
final boolean isScalarType = typeMapping.containsValue(importType);
|
||||
var.vendorExtensions.put("x-fullType", var.datatype);
|
||||
if (!isScalarType) {
|
||||
var.vendorExtensions.put("x-typeAnnotation", dataType.endsWith("[]") ? "array" : dataType);
|
||||
imports.add(importType);
|
||||
var.datatype = dataType;
|
||||
}
|
||||
|
||||
if (var.isBoolean) {
|
||||
var.getter = var.getter.replaceAll("^get", "is");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -355,12 +359,12 @@ public class SymfonyServerCodegen extends AbstractPhpCodegen implements CodegenC
|
||||
|
||||
@Override
|
||||
public String apiTestFileFolder() {
|
||||
return (outputFolder + "/" + toPackagePath(apiTestsPackage, srcBasePath));
|
||||
return (outputFolder + File.separator + toPackagePath(apiTestsPackage, srcBasePath));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelTestFileFolder() {
|
||||
return (outputFolder + "/" + toPackagePath(modelTestsPackage, srcBasePath));
|
||||
return (outputFolder + File.separator + toPackagePath(modelTestsPackage, srcBasePath));
|
||||
}
|
||||
|
||||
public void setComposerVendorName(String composerVendorName) {
|
||||
@ -429,14 +433,14 @@ public class SymfonyServerCodegen extends AbstractPhpCodegen implements CodegenC
|
||||
if (name.isEmpty()) {
|
||||
return "DefaultApiInterface";
|
||||
}
|
||||
return initialCaps(name) + "ApiInterface";
|
||||
return camelize(name, false) + "ApiInterface";
|
||||
}
|
||||
|
||||
protected String toControllerName(String name) {
|
||||
if (name.isEmpty()) {
|
||||
return "DefaultController";
|
||||
}
|
||||
return initialCaps(name) + "Controller";
|
||||
return camelize(name, false) + "Controller";
|
||||
}
|
||||
|
||||
protected String toSymfonyService(String name) {
|
||||
|
@ -212,6 +212,16 @@
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{#withXml}}
|
||||
|
||||
<!-- XML Support -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
|
||||
{{/withXml}}
|
||||
{{#joda}}
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
|
@ -746,7 +746,7 @@ public class ApiClient {
|
||||
clientConfig.register(json);
|
||||
clientConfig.register(JacksonFeature.class);
|
||||
if (debugging) {
|
||||
clientConfig.register(LoggingFilter.class);
|
||||
clientConfig.register(new LoggingFilter(java.util.logging.Logger.getLogger(LoggingFilter.class.getName()), true));
|
||||
}
|
||||
return ClientBuilder.newClient(clientConfig);
|
||||
}
|
||||
|
@ -222,6 +222,16 @@
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{#withXml}}
|
||||
|
||||
<!-- XML processing: JAXB -->
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jersey.media</groupId>
|
||||
<artifactId>jersey-media-jaxb</artifactId>
|
||||
<version>${jersey-version}</version>
|
||||
</dependency>
|
||||
|
||||
{{/withXml}}
|
||||
{{#joda}}
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
|
@ -150,6 +150,16 @@
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{#withXml}}
|
||||
|
||||
<!-- XML processing: Jackson -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
|
||||
{{/withXml}}
|
||||
{{#java8}}
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
|
@ -1,5 +1,9 @@
|
||||
package {{invokerPackage}};
|
||||
|
||||
{{#withXml}}
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator;
|
||||
{{/withXml}}
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -17,6 +21,11 @@ import org.springframework.http.client.BufferingClientHttpRequestFactory;
|
||||
import org.springframework.http.client.ClientHttpRequestExecution;
|
||||
import org.springframework.http.client.ClientHttpRequestInterceptor;
|
||||
import org.springframework.http.client.ClientHttpResponse;
|
||||
{{#withXml}}
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.http.converter.xml.MappingJackson2XmlHttpMessageConverter;
|
||||
{{/withXml}}
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
@ -565,7 +574,14 @@ public class ApiClient {
|
||||
* @return RestTemplate
|
||||
*/
|
||||
protected RestTemplate buildRestTemplate() {
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
{{#withXml}}List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>();
|
||||
messageConverters.add(new MappingJackson2HttpMessageConverter());
|
||||
XmlMapper xmlMapper = new XmlMapper();
|
||||
xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true);
|
||||
messageConverters.add(new MappingJackson2XmlHttpMessageConverter(xmlMapper));
|
||||
|
||||
RestTemplate restTemplate = new RestTemplate(messageConverters);
|
||||
{{/withXml}}{{^withXml}}RestTemplate restTemplate = new RestTemplate();{{/withXml}}
|
||||
{{#threetenbp}}
|
||||
for(HttpMessageConverter converter:restTemplate.getMessageConverters()){
|
||||
if(converter instanceof AbstractJackson2HttpMessageConverter){
|
||||
|
@ -133,5 +133,8 @@ dependencies {
|
||||
{{#threetenbp}}
|
||||
compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$jackson_threeten_version"
|
||||
{{/threetenbp}}
|
||||
{{#withXml}}
|
||||
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jackson_version"
|
||||
{{/withXml}}
|
||||
testCompile "junit:junit:$junit_version"
|
||||
}
|
||||
|
@ -218,6 +218,16 @@
|
||||
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{#withXml}}
|
||||
|
||||
<!-- XML processing: Jackson -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
|
||||
{{/withXml}}
|
||||
{{#java8}}
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
|
@ -260,6 +260,16 @@
|
||||
<artifactId>jackson-datatype-{{^java8}}joda{{/java8}}{{#java8}}jsr310{{/java8}}</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{#withXml}}
|
||||
|
||||
<!-- XML processing: Jackson -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
|
||||
{{/withXml}}
|
||||
<dependency>
|
||||
<groupId>com.typesafe.play</groupId>
|
||||
<artifactId>play-java-ws_2.11</artifactId>
|
||||
|
@ -14,6 +14,15 @@ import {{import}};
|
||||
{{#serializableModel}}
|
||||
import java.io.Serializable;
|
||||
{{/serializableModel}}
|
||||
{{#jackson}}
|
||||
{{#withXml}}
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
{{/withXml}}
|
||||
{{/jackson}}
|
||||
{{#withXml}}
|
||||
import javax.xml.bind.annotation.*;
|
||||
{{/withXml}}
|
||||
{{#parcelableModel}}
|
||||
import android.os.Parcelable;
|
||||
import android.os.Parcel;
|
||||
|
@ -2,7 +2,7 @@
|
||||
* {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}
|
||||
*/{{#description}}
|
||||
@ApiModel(description = "{{{description}}}"){{/description}}
|
||||
{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}
|
||||
{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}}
|
||||
public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcelableModel}}implements Parcelable {{#serializableModel}}, Serializable {{/serializableModel}}{{/parcelableModel}}{{^parcelableModel}}{{#serializableModel}}implements Serializable {{/serializableModel}}{{/parcelableModel}}{
|
||||
{{#serializableModel}}
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -23,7 +23,18 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela
|
||||
{{/items.isEnum}}
|
||||
{{#jackson}}
|
||||
@JsonProperty("{{baseName}}")
|
||||
{{#withXml}}
|
||||
@JacksonXmlProperty({{#isXmlAttribute}}isAttribute = true, {{/isXmlAttribute}}{{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}")
|
||||
{{/withXml}}
|
||||
{{/jackson}}
|
||||
{{#withXml}}
|
||||
{{#isXmlAttribute}}
|
||||
@XmlAttribute(name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}")
|
||||
{{/isXmlAttribute}}
|
||||
{{^isXmlAttribute}}
|
||||
@XmlElement({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}")
|
||||
{{/isXmlAttribute}}
|
||||
{{/withXml}}
|
||||
{{#gson}}
|
||||
@SerializedName("{{baseName}}")
|
||||
{{/gson}}
|
||||
|
@ -223,6 +223,16 @@
|
||||
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
{{#withXml}}
|
||||
|
||||
<!-- XML processing: Jackson -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
|
||||
{{/withXml}}
|
||||
{{#joda}}
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
|
@ -0,0 +1,6 @@
|
||||
{{#withXml}}
|
||||
{{#jackson}}
|
||||
@JacksonXmlRootElement({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{classname}}{{/xmlName}}")
|
||||
{{/jackson}}
|
||||
@XmlRootElement({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{classname}}{{/xmlName}}")
|
||||
@XmlAccessorType(XmlAccessType.FIELD){{/withXml}}
|
@ -55,6 +55,15 @@
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${springfox-version}</version>
|
||||
</dependency>
|
||||
{{#withXml}}
|
||||
|
||||
<!-- XML processing: Jackson -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
</dependency>
|
||||
|
||||
{{/withXml}}
|
||||
{{#java8}}
|
||||
|
||||
<dependency>
|
||||
|
@ -10,7 +10,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableSwagger2
|
||||
@ComponentScan(basePackages = "{{basePackage}}")
|
||||
@ComponentScan(basePackages = { "{{basePackage}}", "{{apiPackage}}" })
|
||||
public class Swagger2SpringBoot implements CommandLineRunner {
|
||||
|
||||
@Override
|
||||
|
@ -50,6 +50,15 @@
|
||||
<groupId>org.springframework.security.oauth</groupId>
|
||||
<artifactId>spring-security-oauth2</artifactId>
|
||||
</dependency>
|
||||
{{#withXml}}
|
||||
|
||||
<!-- XML processing: Jackson -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
</dependency>
|
||||
|
||||
{{/withXml}}
|
||||
{{#java8}}
|
||||
|
||||
<dependency>
|
||||
|
@ -105,6 +105,16 @@
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${springfox-version}</version>
|
||||
</dependency>
|
||||
{{#withXml}}
|
||||
|
||||
<!-- XML processing: Jackson -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
<version>${jackson-version}</version>
|
||||
</dependency>
|
||||
|
||||
{{/withXml}}
|
||||
{{#java8}}
|
||||
|
||||
<dependency>
|
||||
|
@ -10,6 +10,15 @@ import java.io.Serializable;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.*;
|
||||
{{/useBeanValidation}}
|
||||
{{#jackson}}
|
||||
{{#withXml}}
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
{{/withXml}}
|
||||
{{/jackson}}
|
||||
{{#withXml}}
|
||||
import javax.xml.bind.annotation.*;
|
||||
{{/withXml}}
|
||||
|
||||
{{#models}}
|
||||
{{#model}}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}
|
||||
*/{{#description}}
|
||||
@ApiModel(description = "{{{description}}}"){{/description}}
|
||||
{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}
|
||||
{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}}
|
||||
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
|
||||
{{#serializableModel}}
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -22,7 +22,8 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
|
||||
{{/items}}
|
||||
{{/items.isEnum}}
|
||||
{{#jackson}}
|
||||
@JsonProperty("{{baseName}}")
|
||||
@JsonProperty("{{baseName}}"){{#withXml}}
|
||||
@JacksonXmlProperty({{#isXmlAttribute}}isAttribute = true, {{/isXmlAttribute}}{{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}"){{/withXml}}
|
||||
{{/jackson}}
|
||||
{{#gson}}
|
||||
@SerializedName("{{baseName}}")
|
||||
|
@ -0,0 +1,6 @@
|
||||
{{#withXml}}
|
||||
{{#jackson}}
|
||||
@JacksonXmlRootElement({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{classname}}{{/xmlName}}")
|
||||
{{/jackson}}
|
||||
@XmlRootElement({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}name = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{classname}}{{/xmlName}}")
|
||||
@XmlAccessorType(XmlAccessType.FIELD){{/withXml}}
|
@ -0,0 +1,18 @@
|
||||
service.{{operationId}}({{#hasParams}}{{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{^hasMore}}, {{/hasMore}}{{/allParams}}{{/hasParams}}result -> {
|
||||
if (result.succeeded())
|
||||
{{#returnType}}
|
||||
{{#isListContainer}}
|
||||
message.reply(new JsonArray(Json.encode(result.result())).encodePrettily());
|
||||
{{/isListContainer}}
|
||||
{{^isListContainer}}
|
||||
message.reply(new JsonObject(Json.encode(result.result())).encodePrettily());
|
||||
{{/isListContainer}}
|
||||
{{/returnType}}
|
||||
{{^returnType}}
|
||||
message.reply(null);
|
||||
{{/returnType}}
|
||||
else {
|
||||
Throwable cause = result.cause();
|
||||
manageError(message, cause, "{{#vendorExtensions}}{{x-serviceid}}{{/vendorExtensions}}");
|
||||
}
|
||||
});
|
@ -0,0 +1 @@
|
||||
void {{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{^hasMore}}, {{/hasMore}}{{/allParams}}Handler<AsyncResult<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}>> handler);
|
@ -0,0 +1,22 @@
|
||||
package {{rootPackage}};
|
||||
|
||||
public class MainApiException extends Exception {
|
||||
private int statusCode;
|
||||
private String statusMessage;
|
||||
|
||||
public MainApiException(int statusCode, String statusMessage) {
|
||||
super();
|
||||
this.statusCode = statusCode;
|
||||
this.statusMessage = statusMessage;
|
||||
}
|
||||
|
||||
public int getStatusCode() {
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
public String getStatusMessage() {
|
||||
return statusMessage;
|
||||
}
|
||||
|
||||
public static final MainApiException INTERNAL_SERVER_ERROR = new MainApiException(500, "Internal Server Error");
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package {{rootPackage}};
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import com.github.phiz71.vertx.swagger.router.OperationIdServiceIdResolver;
|
||||
import com.github.phiz71.vertx.swagger.router.SwaggerRouter;
|
||||
|
||||
import io.swagger.models.Swagger;
|
||||
import io.swagger.parser.SwaggerParser;
|
||||
import io.vertx.core.AbstractVerticle;
|
||||
import io.vertx.core.Future;
|
||||
import io.vertx.core.file.FileSystem;
|
||||
import io.vertx.core.json.Json;
|
||||
import io.vertx.core.logging.Logger;
|
||||
import io.vertx.core.logging.LoggerFactory;
|
||||
import io.vertx.ext.web.Router;
|
||||
|
||||
public class MainApiVerticle extends AbstractVerticle {
|
||||
final static Logger LOGGER = LoggerFactory.getLogger(MainApiVerticle.class);
|
||||
|
||||
final Router router = Router.router(vertx);
|
||||
|
||||
@Override
|
||||
public void start(Future<Void> startFuture) throws Exception {
|
||||
Json.mapper.registerModule(new JavaTimeModule());
|
||||
FileSystem vertxFileSystem = vertx.fileSystem();
|
||||
vertxFileSystem.readFile("swagger.json", readFile -> {
|
||||
if (readFile.succeeded()) {
|
||||
Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8")));
|
||||
Router swaggerRouter = SwaggerRouter.swaggerRouter(Router.router(vertx), swagger, vertx.eventBus(), new OperationIdServiceIdResolver());
|
||||
|
||||
deployVerticles(startFuture);
|
||||
|
||||
vertx.createHttpServer()
|
||||
.requestHandler(swaggerRouter::accept)
|
||||
.listen({{serverPort}});
|
||||
startFuture.complete();
|
||||
} else {
|
||||
startFuture.fail(readFile.cause());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void deployVerticles(Future<Void> startFuture) {
|
||||
{{#apiInfo}}{{#apis}}
|
||||
vertx.deployVerticle("{{apiPackage}}.{{classname}}Verticle", res -> {
|
||||
if (res.succeeded()) {
|
||||
LOGGER.info("{{classname}}Verticle : Deployed");
|
||||
} else {
|
||||
startFuture.fail(res.cause());
|
||||
LOGGER.error("{{classname}}Verticle : Deployement failed");
|
||||
}
|
||||
});
|
||||
{{/apis}}{{/apiInfo}}
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
Project generated on : {{generatedDate}}
|
@ -0,0 +1,18 @@
|
||||
service.{{operationId}}({{#hasParams}}{{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{/hasParams}}).subscribe(
|
||||
{{#returnType}}
|
||||
result -> {
|
||||
{{#isListContainer}}
|
||||
message.reply(new JsonArray(Json.encode(result)).encodePrettily());
|
||||
{{/isListContainer}}
|
||||
{{^isListContainer}}
|
||||
message.reply(new JsonObject(Json.encode(result)).encodePrettily());
|
||||
{{/isListContainer}}
|
||||
{{/returnType}}
|
||||
{{^returnType}}
|
||||
() -> {
|
||||
message.reply(null);
|
||||
{{/returnType}}
|
||||
},
|
||||
error -> {
|
||||
manageError(message, error, "{{#vendorExtensions}}{{x-serviceid}}{{/vendorExtensions}}");
|
||||
});
|
@ -0,0 +1 @@
|
||||
public {{#returnType}}Single<{{{returnType}}}>{{/returnType}}{{^returnType}}Completable{{/returnType}} {{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}},{{/hasMore}}{{/allParams}});
|
@ -0,0 +1,31 @@
|
||||
package {{package}};
|
||||
|
||||
{{#imports}}import {{import}};
|
||||
{{/imports}}
|
||||
|
||||
{{#rxInterface}}
|
||||
import rx.Completable;
|
||||
import rx.Single;
|
||||
{{/rxInterface}}
|
||||
{{^rxInterface}}
|
||||
import io.vertx.core.AsyncResult;
|
||||
import io.vertx.core.Handler;
|
||||
{{/rxInterface}}
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface {{classname}} {
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
//{{#vendorExtensions}}{{x-serviceid}}{{/vendorExtensions}}
|
||||
{{#rxInterface}}
|
||||
{{>RxMethod}}
|
||||
{{/rxInterface}}
|
||||
{{^rxInterface}}
|
||||
{{>AsyncMethod}}
|
||||
{{/rxInterface}}
|
||||
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package {{package}};
|
||||
|
||||
{{#imports}}import {{import}};
|
||||
{{/imports}}
|
||||
|
||||
public final class {{classname}}Exception extends MainApiException {
|
||||
public {{classname}}Exception(int statusCode, String statusMessage) {
|
||||
super(statusCode, statusMessage);
|
||||
}
|
||||
|
||||
{{#operations}}{{#operation}}{{#responses}}{{^isDefault}}public static final {{classname}}Exception {{baseName}}_{{{operationId}}}_{{{code}}}_Exception = new {{classname}}Exception({{{code}}}, "{{{message}}}");
|
||||
{{/isDefault}}{{/responses}}{{/operation}}{{/operations}}
|
||||
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package {{package}};
|
||||
|
||||
import io.vertx.core.AbstractVerticle;
|
||||
import io.vertx.core.eventbus.Message;
|
||||
import io.vertx.core.json.Json;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.logging.Logger;
|
||||
import io.vertx.core.logging.LoggerFactory;
|
||||
|
||||
{{#imports}}import {{import}};
|
||||
{{/imports}}
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class {{classname}}Verticle extends AbstractVerticle {
|
||||
final static Logger LOGGER = LoggerFactory.getLogger({{classname}}Verticle.class);
|
||||
|
||||
{{#operations}}{{#operation}}{{#vendorExtensions}}final static String {{x-serviceid-varname}} = "{{x-serviceid}}";
|
||||
{{/vendorExtensions}}{{/operation}}{{/operations}}
|
||||
//TODO : create Implementation
|
||||
{{classname}} service = new {{classname}}Impl();
|
||||
|
||||
@Override
|
||||
public void start() throws Exception {
|
||||
{{#operations}}{{#operation}}
|
||||
//Consumer for {{#vendorExtensions}}{{x-serviceid}}{{/vendorExtensions}}
|
||||
vertx.eventBus().<JsonObject> consumer({{#vendorExtensions}}{{x-serviceid-varname}}{{/vendorExtensions}}).handler(message -> {
|
||||
try {
|
||||
{{#hasParams}}
|
||||
{{#allParams}}
|
||||
{{#isListContainer}}
|
||||
{{{dataType}}} {{paramName}} = Json.mapper.readValue(message.body().getJsonArray("{{baseName}}").encode(),
|
||||
Json.mapper.getTypeFactory().constructCollectionType(List.class, {{{baseType}}}.class));
|
||||
{{/isListContainer}}
|
||||
{{^isListContainer}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isString}}
|
||||
{{{dataType}}} {{paramName}} = message.body().getString("{{baseName}}");
|
||||
{{/isString}}
|
||||
{{^isString}}
|
||||
{{{dataType}}} {{paramName}} = Json.mapper.readValue(message.body().getString("{{baseName}}"), {{{dataType}}}.class);
|
||||
{{/isString}}
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
{{{dataType}}} {{paramName}} = Json.mapper.readValue(message.body().getJsonObject("{{baseName}}").encode(), {{{dataType}}}.class);
|
||||
{{/isPrimitiveType}}
|
||||
{{/isListContainer}}
|
||||
{{/allParams}}
|
||||
{{/hasParams}}
|
||||
{{#rxInterface}}
|
||||
{{>RxCall}}
|
||||
{{/rxInterface}}
|
||||
{{^rxInterface}}
|
||||
{{>AsyncCall}}
|
||||
{{/rxInterface}}
|
||||
} catch (Exception e) {
|
||||
logUnexpectedError("{{#vendorExtensions}}{{x-serviceid}}{{/vendorExtensions}}", e);
|
||||
message.fail(MainApiException.INTERNAL_SERVER_ERROR.getStatusCode(), MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage());
|
||||
}
|
||||
});
|
||||
{{/operation}}{{/operations}}
|
||||
}
|
||||
|
||||
private void manageError(Message<JsonObject> message, Throwable cause, String serviceName) {
|
||||
int code = MainApiException.INTERNAL_SERVER_ERROR.getStatusCode();
|
||||
String statusMessage = MainApiException.INTERNAL_SERVER_ERROR.getStatusMessage();
|
||||
if (cause instanceof MainApiException) {
|
||||
code = ((MainApiException)cause).getStatusCode();
|
||||
statusMessage = ((MainApiException)cause).getStatusMessage();
|
||||
} else {
|
||||
logUnexpectedError(serviceName, cause);
|
||||
}
|
||||
|
||||
message.fail(code, statusMessage);
|
||||
}
|
||||
|
||||
private void logUnexpectedError(String serviceName, Throwable cause) {
|
||||
LOGGER.error("Unexpected error in "+ serviceName, cause);
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
|
||||
public enum {{{datatypeWithEnum}}} {
|
||||
{{#allowableValues}}{{#enumVars}}{{{name}}}({{{value}}}){{^-last}},
|
||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
|
||||
private String value;
|
||||
|
||||
{{{datatypeWithEnum}}}(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
public enum {{classname}} {
|
||||
{{#allowableValues}}{{.}}{{^-last}}, {{/-last}}{{/allowableValues}}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package {{package}};
|
||||
|
||||
import java.util.Objects;
|
||||
{{#imports}}import {{import}};
|
||||
{{/imports}}
|
||||
{{#serializableModel}}import java.io.Serializable;
|
||||
{{/serializableModel}}{{#models}}{{#model}}{{#description}}
|
||||
/**
|
||||
* {{description}}
|
||||
**/
|
||||
{{/description}}{{^description}}
|
||||
{{/description}}{{#isEnum}}{{>enumOuterClass}}{{/isEnum}}{{^isEnum}}{{>pojo}}{{/isEnum}}{{/model}}{{/models}}
|
@ -0,0 +1,71 @@
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
|
||||
{{#vars}}{{#isEnum}}
|
||||
|
||||
{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
||||
|
||||
{{>enumClass}}{{/items}}{{/items.isEnum}}
|
||||
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}}
|
||||
|
||||
public {{classname}} () {
|
||||
|
||||
}
|
||||
|
||||
public {{classname}} ({{#vars}}{{{datatypeWithEnum}}} {{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}) {
|
||||
{{#vars}}
|
||||
this.{{name}} = {{name}};
|
||||
{{/vars}}
|
||||
}
|
||||
|
||||
{{#vars}}
|
||||
{{#vendorExtensions.extraAnnotation}}{{vendorExtensions.extraAnnotation}}{{/vendorExtensions.extraAnnotation}}
|
||||
@JsonProperty("{{baseName}}")
|
||||
public {{{datatypeWithEnum}}} {{getter}}() {
|
||||
return {{name}};
|
||||
}
|
||||
public void {{setter}}({{{datatypeWithEnum}}} {{name}}) {
|
||||
this.{{name}} = {{name}};
|
||||
}
|
||||
|
||||
{{/vars}}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
{{classname}} {{classVarName}} = ({{classname}}) o;{{#hasVars}}
|
||||
return {{#vars}}Objects.equals({{name}}, {{classVarName}}.{{name}}){{#hasMore}} &&
|
||||
{{/hasMore}}{{^hasMore}};{{/hasMore}}{{/vars}}{{/hasVars}}{{^hasVars}}
|
||||
return true;{{/hasVars}}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}});
|
||||
}
|
||||
|
||||
@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(Object o) {
|
||||
if (o == null) {
|
||||
return "null";
|
||||
}
|
||||
return o.toString().replace("\n", "\n ");
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>{{groupId}}</groupId>
|
||||
<artifactId>{{artifactId}}</artifactId>
|
||||
<version>{{artifactVersion}}</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>{{appName}}</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<junit.version>4.12</junit.version>
|
||||
<vertx.version>3.4.1</vertx.version>
|
||||
<maven-compiler-plugin.version>3.3</maven-compiler-plugin.version>
|
||||
<vertx-swagger-router.version>{{vertxSwaggerRouterVersion}}</vertx-swagger-router.version>
|
||||
<maven-shade-plugin.version>2.3</maven-shade-plugin.version>
|
||||
<jackson-datatype-jsr310.version>2.7.4</jackson-datatype-jsr310.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.vertx</groupId>
|
||||
<artifactId>vertx-unit</artifactId>
|
||||
<version>${vertx.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.phiz71</groupId>
|
||||
<artifactId>vertx-swagger-router</artifactId>
|
||||
<version>${vertx-swagger-router.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>${jackson-datatype-jsr310.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${maven-compiler-plugin.version}</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>${maven-shade-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<transformers>
|
||||
<transformer
|
||||
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||
<manifestEntries>
|
||||
<Main-Class>io.vertx.core.Starter</Main-Class>
|
||||
<Main-Verticle>{{rootPackage}}.MainApiVerticle</Main-Verticle>
|
||||
</manifestEntries>
|
||||
</transformer>
|
||||
</transformers>
|
||||
<artifactSet />
|
||||
<outputFile>${project.build.directory}/${project.artifactId}-${project.version}-fat.jar</outputFile>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -0,0 +1 @@
|
||||
{{{fullSwagger}}}
|
@ -0,0 +1,30 @@
|
||||
#
|
||||
# Copyright 2014 Red Hat, Inc.
|
||||
#
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# and Apache License v2.0 which accompanies this distribution.
|
||||
#
|
||||
# The Eclipse Public License is available at
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# The Apache License v2.0 is available at
|
||||
# http://www.opensource.org/licenses/apache2.0.php
|
||||
#
|
||||
# You may elect to redistribute this code under either of these licenses.
|
||||
#
|
||||
handlers=java.util.logging.ConsoleHandler,java.util.logging.FileHandler
|
||||
java.util.logging.SimpleFormatter.format=%5$s %6$s\n
|
||||
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
|
||||
java.util.logging.ConsoleHandler.level=FINEST
|
||||
java.util.logging.FileHandler.level=INFO
|
||||
java.util.logging.FileHandler.formatter=io.vertx.core.logging.VertxLoggerFormatter
|
||||
|
||||
# Put the log in the system temporary directory
|
||||
java.util.logging.FileHandler.pattern=vertx.log
|
||||
|
||||
.level=INFO
|
||||
io.vertx.ext.web.level=FINEST
|
||||
io.vertx.level=INFO
|
||||
com.hazelcast.level=INFO
|
||||
io.netty.util.internal.PlatformDependent.level=SEVERE
|
@ -35,6 +35,7 @@ io.swagger.codegen.languages.JavaResteasyEapServerCodegen
|
||||
io.swagger.codegen.languages.JavaResteasyServerCodegen
|
||||
io.swagger.codegen.languages.JavascriptClientCodegen
|
||||
io.swagger.codegen.languages.JavascriptClosureAngularClientCodegen
|
||||
io.swagger.codegen.languages.JavaVertXServerCodegen
|
||||
io.swagger.codegen.languages.KotlinClientCodegen
|
||||
io.swagger.codegen.languages.LumenServerCodegen
|
||||
io.swagger.codegen.languages.NancyFXServerCodegen
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
/// </summary>
|
||||
{{^isNotContainer}}{{{datatype}}}& {{getter}}();
|
||||
{{/isNotContainer}}{{#isNotContainer}}{{{datatype}}} {{getter}}() const;
|
||||
{{/isNotContainer}}{{^required}}bool {{baseName}}IsSet() const;
|
||||
{{/isNotContainer}}{{^required}}bool {{nameInCamelCase}}IsSet() const;
|
||||
void unset{{name}}();
|
||||
{{/required}}
|
||||
void {{setter}}({{{datatype}}} value);
|
||||
|
@ -577,7 +577,7 @@ void {{classname}}::{{setter}}({{{datatype}}} value)
|
||||
}
|
||||
{{/isNotContainer}}
|
||||
{{^required}}
|
||||
bool {{classname}}::{{baseName}}IsSet() const
|
||||
bool {{classname}}::{{nameInCamelCase}}IsSet() const
|
||||
{
|
||||
return m_{{name}}IsSet;
|
||||
}
|
||||
|
@ -34,83 +34,209 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
class Controller extends BaseController
|
||||
{
|
||||
|
||||
/**
|
||||
* This will return a response with code 400. Usage example:
|
||||
*
|
||||
* return $this->createBadRequestResponse('Unable to access this page!');
|
||||
*
|
||||
* @param string $message A message
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function createBadRequestResponse($message = 'Bad Request.')
|
||||
{
|
||||
return new Response($message, 400);
|
||||
}
|
||||
/**
|
||||
* This will return a response with code 400. Usage example:
|
||||
* return $this->createBadRequestResponse('Unable to access this page!');
|
||||
*
|
||||
* @param string $message A message
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function createBadRequestResponse($message = 'Bad Request.')
|
||||
{
|
||||
return new Response($message, 400);
|
||||
}
|
||||
|
||||
/**
|
||||
* This will return an error response. Usage example:
|
||||
*
|
||||
* return $this->createErrorResponse(new UnauthorizedHttpException());
|
||||
*
|
||||
* @param HttpException $exception An HTTP exception
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function createErrorResponse(HttpException $exception)
|
||||
{
|
||||
$statusCode = $exception->getStatusCode();
|
||||
$headers = array_merge($exception->getHeaders(), ['Content-Type' => 'application/json']);
|
||||
/**
|
||||
* This will return an error response. Usage example:
|
||||
* return $this->createErrorResponse(new UnauthorizedHttpException());
|
||||
*
|
||||
* @param HttpException $exception An HTTP exception
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function createErrorResponse(HttpException $exception)
|
||||
{
|
||||
$statusCode = $exception->getStatusCode();
|
||||
$headers = array_merge($exception->getHeaders(), ['Content-Type' => 'application/json']);
|
||||
|
||||
$json = $this->exceptionToArray($exception);
|
||||
$json["statusCode"] = $statusCode;
|
||||
$json = $this->exceptionToArray($exception);
|
||||
$json['statusCode'] = $statusCode;
|
||||
|
||||
return new Response(json_encode($json, 15, 512), $statusCode, $headers);
|
||||
}
|
||||
return new Response(json_encode($json, 15, 512), $statusCode, $headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes data to a given type format.
|
||||
*
|
||||
* @param mixed $data The data to serialize.
|
||||
* @param string $class The source data class.
|
||||
* @param string $format The target serialization format.
|
||||
* @return string A serialized data string.
|
||||
*/
|
||||
public function serialize($data, $format)
|
||||
{
|
||||
return $this->get('{{bundleAlias}}.model.model_serializer')->serialize($data, $format);
|
||||
}
|
||||
/**
|
||||
* Serializes data to a given type format.
|
||||
*
|
||||
* @param mixed $data The data to serialize.
|
||||
* @param string $class The source data class.
|
||||
* @param string $format The target serialization format.
|
||||
*
|
||||
* @return string A serialized data string.
|
||||
*/
|
||||
public function serialize($data, $format)
|
||||
{
|
||||
return $this->get('{{bundleAlias}}.model.model_serializer')->serialize($data, $format);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes data from a given type format.
|
||||
*
|
||||
* @param string $data The data to deserialize.
|
||||
* @param string $class The target data class.
|
||||
* @param string $format The source serialization format.
|
||||
* @return mixed A deserialized data.
|
||||
*/
|
||||
public function deserialize($data, $class, $format)
|
||||
{
|
||||
return $this->get('{{bundleAlias}}.model.model_serializer')->deserialize($data, $class, $format);
|
||||
}
|
||||
/**
|
||||
* Deserializes data from a given type format.
|
||||
*
|
||||
* @param string $data The data to deserialize.
|
||||
* @param string $class The target data class.
|
||||
* @param string $format The source serialization format.
|
||||
*
|
||||
* @return mixed A deserialized data.
|
||||
*/
|
||||
public function deserialize($data, $class, $format)
|
||||
{
|
||||
return $this->get('{{bundleAlias}}.model.model_serializer')->deserialize($data, $class, $format);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an exception to a serializable array.
|
||||
*
|
||||
* @param \Exception|null $exception
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function exceptionToArray(\Exception $exception = null)
|
||||
{
|
||||
if (null === $exception) {
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Decodes a string value.
|
||||
*
|
||||
* @param string $string The string value to decode.
|
||||
* @param string $dataType The data type of the parameter.
|
||||
*
|
||||
* @return mixed The decoded value.
|
||||
*/
|
||||
public function fromString($string, $dataType)
|
||||
{
|
||||
if ($dataType === 'integer' || $dataType === 'number') {
|
||||
return $this->toNumber($string);
|
||||
}
|
||||
if ($dataType === 'bool') {
|
||||
return $this->toBoolean($string);
|
||||
}
|
||||
if ($dataType === '\DateTime') {
|
||||
return $this->toDateTime($string);
|
||||
}
|
||||
|
||||
return [
|
||||
"message" => $exception->getMessage(),
|
||||
"type" => get_class($exception),
|
||||
"previous" => $this->exceptionToArray($exception->getPrevious()),
|
||||
];
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes a header value.
|
||||
*
|
||||
* @param string $header The header value to decode.
|
||||
* @param string $dataType The data type of the parameter.
|
||||
*
|
||||
* @return mixed The decoded value.
|
||||
*/
|
||||
public function fromHeader($header, $dataType)
|
||||
{
|
||||
return $this->fromString($header, $dataType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes a query value.
|
||||
*
|
||||
* @param string $query The query value to decode.
|
||||
* @param string $dataType The data type of the parameter.
|
||||
*
|
||||
* @return mixed The decoded value.
|
||||
*/
|
||||
public function fromQuery($query, $dataType)
|
||||
{
|
||||
return $this->fromString($query, $dataType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes a path value.
|
||||
*
|
||||
* @param string $path The path value to decode.
|
||||
* @param string $dataType The data type of the parameter.
|
||||
*
|
||||
* @return mixed The decoded value.
|
||||
*/
|
||||
public function fromPath($path, $dataType)
|
||||
{
|
||||
return $this->fromString($path, $dataType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes a form value.
|
||||
*
|
||||
* @param string $form The form value to decode.
|
||||
* @param string $dataType The data type of the parameter.
|
||||
*
|
||||
* @return mixed The decoded value.
|
||||
*/
|
||||
public function fromForm($form, $dataType)
|
||||
{
|
||||
return $this->fromString($form, $dataType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decoded a string to a number.
|
||||
*
|
||||
* @param string $string The string to decode.
|
||||
*
|
||||
* @return number|null A decoded number, or null, if not a valid string.
|
||||
*/
|
||||
private function toNumber($string)
|
||||
{
|
||||
if (is_numeric($string)) {
|
||||
return $string + 0;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decoded a string to a boolean.
|
||||
*
|
||||
* @param string $string The string to decode.
|
||||
*
|
||||
* @return boolean|null A decoded boolean, or null, if not a valid string.
|
||||
*/
|
||||
private function toBoolean($string)
|
||||
{
|
||||
if ($string === 'true') {
|
||||
return true;
|
||||
}
|
||||
if ($string === 'false') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decoded a string to a date time.
|
||||
*
|
||||
* @param string $string The string to decode.
|
||||
*
|
||||
* @return \DateTime|null A decoded date time, or null, if not a valid string.
|
||||
*/
|
||||
private function toDateTime($string)
|
||||
{
|
||||
if ($dateTime = date_create($string)) {
|
||||
return $dateTime;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an exception to a serializable array.
|
||||
*
|
||||
* @param \Exception|null $exception
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function exceptionToArray(\Exception $exception = null)
|
||||
{
|
||||
if (null === $exception) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return [
|
||||
'message' => $exception->getMessage(),
|
||||
'type' => get_class($exception),
|
||||
'previous' => $this->exceptionToArray($exception->getPrevious()),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
# {{packagePath}}
|
||||
# {{bundleName}}
|
||||
{{#appDescription}}
|
||||
{{{appDescription}}}
|
||||
{{/appDescription}}
|
||||
|
||||
This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
This [Symfony](https://symfony.com/) bundle is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
|
||||
- API version: {{appVersion}}
|
||||
{{#artifactVersion}}
|
||||
@ -22,7 +22,6 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
|
||||
PHP 5.4.0 and later
|
||||
|
||||
## Installation & Usage
|
||||
### Composer
|
||||
|
||||
To install the bindings via [Composer](http://getcomposer.org/), add the following to `composer.json`:
|
||||
|
||||
@ -42,13 +41,6 @@ To install the bindings via [Composer](http://getcomposer.org/), add the followi
|
||||
|
||||
Then run `composer install`
|
||||
|
||||
### Manual Installation
|
||||
|
||||
Download the files and include `autoload.php`:
|
||||
|
||||
```php
|
||||
require_once('/path/to/{{packagePath}}/autoload.php');
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
@ -59,39 +51,93 @@ composer install
|
||||
./vendor/bin/phpunit
|
||||
```
|
||||
|
||||
|
||||
## Getting Started
|
||||
|
||||
Please follow the [installation procedure](#installation--usage) and then run the following:
|
||||
Step 1: Please follow the [installation procedure](#installation--usage) first.
|
||||
|
||||
Step 2: Enable the bundle in the kernel:
|
||||
|
||||
```php
|
||||
<?php
|
||||
require_once(__DIR__ . '/vendor/autoload.php');
|
||||
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
|
||||
// Configure HTTP basic authorization: {{{name}}}
|
||||
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
|
||||
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');{{/isBasic}}{{#isApiKey}}
|
||||
// Configure API key authorization: {{{name}}}
|
||||
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKey('{{{keyParamName}}}', 'YOUR_API_KEY');
|
||||
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
||||
// {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'Bearer');{{/isApiKey}}{{#isOAuth}}
|
||||
// Configure OAuth2 access token for authorization: {{{name}}}
|
||||
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');{{/isOAuth}}{{/authMethods}}
|
||||
{{/hasAuthMethods}}
|
||||
// app/AppKernel.php
|
||||
|
||||
$api_instance = new {{invokerPackage}}\Api\{{classname}}();
|
||||
{{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}}
|
||||
{{/allParams}}
|
||||
|
||||
try {
|
||||
{{#returnType}}$result = {{/returnType}}$api_instance->{{{operationId}}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
|
||||
print_r($result);{{/returnType}}
|
||||
} catch (Exception $e) {
|
||||
echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL;
|
||||
public function registerBundles()
|
||||
{
|
||||
$bundles = array(
|
||||
// ...
|
||||
new {{invokerPackage}}\{{bundleClassName}}(),
|
||||
// ...
|
||||
);
|
||||
}
|
||||
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
|
||||
?>
|
||||
```
|
||||
|
||||
Step 3: Register the routes:
|
||||
|
||||
```yaml
|
||||
# app/config/routing.yml
|
||||
{{bundleAlias}}:
|
||||
resource: "@{{bundleName}}Bundle/Resources/config/routing.yml"
|
||||
```
|
||||
|
||||
Step 4: Implement the API calls:
|
||||
|
||||
```php
|
||||
<?php{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}
|
||||
// src/Acme/MyBundle/Api/{{classname}}.php
|
||||
|
||||
namespace Acme\MyBundle\Api;
|
||||
|
||||
use {{apiPackage}}\{{classname}};
|
||||
|
||||
class {{baseName}}Api implements {{classname}} // An interface is autogenerated
|
||||
{
|
||||
{{#operation}}{{#-first}}{{#hasAuthMethods}}{{#authMethods}}{{#isApiKey}}
|
||||
/**
|
||||
* Configure API key authorization: {{{name}}}
|
||||
*/
|
||||
public function set{{name}}($apiKey)
|
||||
{
|
||||
// Retrieve logged in user from $apiKey ...
|
||||
}
|
||||
{{/isApiKey}}{{#isOAuth}}
|
||||
/**
|
||||
* Configure OAuth2 access token for authorization: {{{name}}}
|
||||
*/
|
||||
public function set{{name}}($oauthToken)
|
||||
{
|
||||
// Retrieve logged in user from $oauthToken ...
|
||||
}
|
||||
{{/isOAuth}}{{/authMethods}}
|
||||
/**
|
||||
* Implementation of {{classname}}#{{operationId}}
|
||||
*/
|
||||
public function {{operationId}}({{#allParams}}{{#vendorExtensions.x-parameterType}}{{vendorExtensions.x-parameterType}} {{/vendorExtensions.x-parameterType}}${{paramName}}{{^required}} = {{#defaultValue}}'{{{.}}}'{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
|
||||
{
|
||||
// Implement the operation ...
|
||||
}
|
||||
{{/hasAuthMethods}}
|
||||
{{/-first}}{{/operation}}
|
||||
// Other operation methods ...
|
||||
}
|
||||
```
|
||||
|
||||
Step 5: Tag your API implementation:
|
||||
|
||||
```yaml
|
||||
# src/Acme/MyBundle/Resources/services.yml
|
||||
services:
|
||||
# ...
|
||||
acme.my_bundle.api.{{pathPrefix}}:
|
||||
class: Acme\MyBundle\Api\{{baseName}}Api
|
||||
tags:
|
||||
- { name: "{{bundleAlias}}.api", api: "{{pathPrefix}}" }
|
||||
# ...
|
||||
```
|
||||
{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
|
||||
Now you can start using the bundle!
|
||||
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *{{basePath}}*
|
||||
|
@ -31,6 +31,17 @@ namespace {{apiPackage}};
|
||||
*/
|
||||
interface {{classname}}
|
||||
{
|
||||
{{#authMethods}}
|
||||
|
||||
/**
|
||||
* Sets authentication method {{name}}
|
||||
*
|
||||
* @param string $value Value of the {{name}} authentication method.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set{{name}}($value);
|
||||
{{/authMethods}}
|
||||
{{#operation}}
|
||||
|
||||
/**
|
||||
|
@ -55,17 +55,38 @@ class {{controllerName}} extends Controller
|
||||
*/
|
||||
public function {{operationId}}Action(Request $request)
|
||||
{
|
||||
{{#authMethods}}
|
||||
// Authentication '{{name}}' required
|
||||
{{#isApiKey}}
|
||||
{{#isKeyInHeader}}
|
||||
// Set key with prefix in header
|
||||
$security{{name}} = $request->headers->get('{{keyParamName}}');
|
||||
{{/isKeyInHeader}}
|
||||
{{#isKeyInQuery}}
|
||||
// Set key with prefix in query string
|
||||
$security{{name}} = $request->query->get('{{keyParamName}}');
|
||||
{{/isKeyInQuery}}
|
||||
{{/isApiKey}}
|
||||
{{#isBasic}}
|
||||
// HTTP basic authentication required
|
||||
$security{{name}} = $request->headers->get('authorization');
|
||||
{{/isBasic}}
|
||||
{{#isOAuth}}
|
||||
// Oauth required
|
||||
$security{{name}} = $request->headers->get('authorization');
|
||||
{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
{{#queryParams}}
|
||||
// Handle query params
|
||||
${{paramName}} = $request->query->get('{{paramName}}');
|
||||
${{paramName}} = $this->fromQuery($request->query->get('{{paramName}}'), '{{dataType}}');
|
||||
{{/queryParams}}
|
||||
{{#headerParams}}
|
||||
// Handle header params
|
||||
${{paramName}} = $request->headers->get('{{paramName}}');
|
||||
${{paramName}} = $this->fromHeader($request->headers->get('{{paramName}}'), '{{dataType}}');
|
||||
{{/headerParams}}
|
||||
{{#pathParams}}
|
||||
// Handle path params
|
||||
${{paramName}} = $request->attributes->get('{{paramName}}');
|
||||
${{paramName}} = $this->fromPath($request->attributes->get('{{paramName}}'), '{{dataType}}');
|
||||
{{/pathParams}}
|
||||
{{#formParams}}
|
||||
{{#isFile}}
|
||||
@ -74,7 +95,7 @@ class {{controllerName}} extends Controller
|
||||
{{/isFile}}
|
||||
{{^isFile}}
|
||||
// Handle form params
|
||||
${{paramName}} = $request->request->get('{{paramName}}');
|
||||
${{paramName}} = $this->fromForm($request->request->get('{{paramName}}'), '{{dataType}}');
|
||||
{{/isFile}}
|
||||
{{/formParams}}
|
||||
{{#bodyParams}}
|
||||
@ -131,9 +152,15 @@ class {{controllerName}} extends Controller
|
||||
|
||||
// Call the API interface
|
||||
try {
|
||||
$handler = $this->getApiHandler();
|
||||
|
||||
{{#authMethods}}
|
||||
// Set authentication method '{{name}}'
|
||||
$handler->set{{name}}($security{{name}});
|
||||
{{/authMethods}}
|
||||
{{#returnType}}
|
||||
// Expecting a return value (exception otherwise)
|
||||
$result = $this->getApiHandler()->{{operationId}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||
$result = $handler->{{operationId}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||
|
||||
{{#responses}}
|
||||
{{^vendorExtensions.x-symfonyExceptionSimple}}
|
||||
@ -148,7 +175,7 @@ class {{controllerName}} extends Controller
|
||||
{{/returnType}}
|
||||
{{^returnType}}
|
||||
// No return type expected; return empty response
|
||||
$this->getApiHandler()->{{operationId}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||
$handler->{{operationId}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||
return new Response('', 204);
|
||||
{{/returnType}}
|
||||
{{#responses}}
|
||||
|
@ -1,4 +1,4 @@
|
||||
# {{invokerPackage}}\{{classname}}{{#description}}
|
||||
# {{apiPackage}}\{{classname}}{{#description}}
|
||||
{{description}}{{/description}}
|
||||
|
||||
All URIs are relative to *{{basePath}}*
|
||||
@ -9,41 +9,66 @@ Method | HTTP request | Description
|
||||
{{/operation}}{{/operations}}
|
||||
|
||||
{{#operations}}
|
||||
## Service Declaration
|
||||
```yaml
|
||||
# src/Acme/MyBundle/Resources/services.yml
|
||||
services:
|
||||
# ...
|
||||
acme.my_bundle.api.{{pathPrefix}}:
|
||||
class: Acme\MyBundle\Api\{{baseName}}Api
|
||||
tags:
|
||||
- { name: "{{bundleAlias}}.api", api: "{{pathPrefix}}" }
|
||||
# ...
|
||||
```
|
||||
|
||||
{{#operation}}
|
||||
# **{{{operationId}}}**
|
||||
## **{{{operationId}}}**
|
||||
> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
|
||||
|
||||
{{{summary}}}{{#notes}}
|
||||
|
||||
{{{notes}}}{{/notes}}
|
||||
|
||||
### Example
|
||||
### Example Implementation
|
||||
```php
|
||||
<?php
|
||||
require_once(__DIR__ . '/vendor/autoload.php');
|
||||
{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
|
||||
// Configure HTTP basic authorization: {{{name}}}
|
||||
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
|
||||
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');{{/isBasic}}{{#isApiKey}}
|
||||
// Configure API key authorization: {{{name}}}
|
||||
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKey('{{{keyParamName}}}', 'YOUR_API_KEY');
|
||||
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
||||
// {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'Bearer');{{/isApiKey}}{{#isOAuth}}
|
||||
// Configure OAuth2 access token for authorization: {{{name}}}
|
||||
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');{{/isOAuth}}{{/authMethods}}
|
||||
{{/hasAuthMethods}}
|
||||
// src/Acme/MyBundle/Api/{{classname}}.php
|
||||
|
||||
$api_instance = new {{invokerPackage}}\Api\{{classname}}();
|
||||
{{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}}
|
||||
{{/allParams}}
|
||||
namespace Acme\MyBundle\Api;
|
||||
|
||||
try {
|
||||
{{#returnType}}$result = {{/returnType}}$api_instance->{{{operationId}}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
|
||||
print_r($result);{{/returnType}}
|
||||
} catch (Exception $e) {
|
||||
echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL;
|
||||
use {{apiPackage}}\{{classname}};
|
||||
|
||||
class {{baseName}}Api implements {{classname}}
|
||||
{
|
||||
{{#authMethods}}{{#isApiKey}}
|
||||
/**
|
||||
* Configure API key authorization: {{{name}}}
|
||||
*/
|
||||
public function set{{name}}($apiKey)
|
||||
{
|
||||
// Retrieve logged in user from $apiKey ...
|
||||
}
|
||||
{{/isApiKey}}{{#isOAuth}}
|
||||
/**
|
||||
* Configure OAuth2 access token for authorization: {{{name}}}
|
||||
*/
|
||||
public function set{{name}}($oauthToken)
|
||||
{
|
||||
// Retrieve logged in user from $oauthToken ...
|
||||
}
|
||||
{{/isOAuth}}{{/authMethods}}
|
||||
// ...
|
||||
|
||||
/**
|
||||
* Implementation of {{classname}}#{{operationId}}
|
||||
*/
|
||||
public function {{operationId}}({{#allParams}}{{#vendorExtensions.x-parameterType}}{{vendorExtensions.x-parameterType}} {{/vendorExtensions.x-parameterType}}${{paramName}}{{^required}} = {{#defaultValue}}'{{{.}}}'{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
|
||||
{
|
||||
// Implement the operation ...
|
||||
}
|
||||
|
||||
// ...
|
||||
}
|
||||
?>
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
@ -13,11 +13,14 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
|
||||
* @var array[]
|
||||
*/
|
||||
protected static $_attributes = [{{#vars}}
|
||||
'{{name}}' => ['{{baseName}}', '{{{datatype}}}', {{#dataFormat}}'{{{dataFormat}}}'{{/dataFormat}}{{^dataFormat}}null{{/dataFormat}}, '{{setter}}', '{{getter}}'],{{/vars}}
|
||||
'{{name}}' => ['{{baseName}}', '{{{vendorExtensions.x-fullType}}}', {{#dataFormat}}'{{{dataFormat}}}'{{/dataFormat}}{{^dataFormat}}null{{/dataFormat}}, '{{setter}}', '{{getter}}'],{{/vars}}
|
||||
];
|
||||
{{#vars}}{{#isEnum}}{{#allowableValues}}{{#enumVars}}
|
||||
const {{enumName}}_{{{name}}} = {{{value}}};
|
||||
{{/enumVars}}{{/allowableValues}}{{/isEnum}}{{/vars}}
|
||||
{{#vars}}{{#isEnum}}
|
||||
|
||||
/**
|
||||
* Allowed values of {{name}}
|
||||
*/{{#allowableValues}}{{#enumVars}}
|
||||
const {{enumName}}_{{{name}}} = {{{value}}};{{/enumVars}}{{/allowableValues}}{{/isEnum}}{{/vars}}
|
||||
|
||||
{{#vars}}{{#isEnum}}
|
||||
/**
|
||||
@ -33,7 +36,10 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
|
||||
}
|
||||
{{/isEnum}}{{/vars}}
|
||||
{{#vars}}
|
||||
/**
|
||||
/**{{#description}}
|
||||
* {{description}}
|
||||
*
|
||||
{{/description}}
|
||||
* @var {{{datatype}}}{{^required}}|null{{/required}}
|
||||
*/
|
||||
protected ${{name}};
|
||||
@ -237,6 +243,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
|
||||
|
||||
/**
|
||||
* Gets {{name}}.
|
||||
*
|
||||
* @return {{{datatype}}}{{^required}}|null{{/required}}
|
||||
*/
|
||||
public function {{getter}}()
|
||||
@ -246,7 +253,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
|
||||
|
||||
/**
|
||||
* Sets {{name}}.
|
||||
*
|
||||
* @param {{{datatype}}}{{^required}}|null{{/required}} ${{name}}{{#description}} {{{description}}}{{/description}}
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function {{setter}}({{#vendorExtensions.x-typeAnnotation}}{{vendorExtensions.x-typeAnnotation}} {{/vendorExtensions.x-typeAnnotation}}${{name}}{{^required}} = null{{/required}})
|
||||
|
@ -259,7 +259,7 @@ class ObjectSerializer
|
||||
// determine file name
|
||||
if (array_key_exists('Content-Disposition', $httpHeaders) &&
|
||||
preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)) {
|
||||
$filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . sanitizeFilename($match[1]);
|
||||
$filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . self::sanitizeFilename($match[1]);
|
||||
} else {
|
||||
$filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), '');
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
{{^isNotContainer}}{{{datatype}}}& {{getter}}();
|
||||
{{/isNotContainer}}{{#isNotContainer}}{{{datatype}}} {{getter}}() const;
|
||||
void {{setter}}({{{datatype}}} value);
|
||||
{{/isNotContainer}}{{^required}}bool {{baseName}}IsSet() const;
|
||||
{{/isNotContainer}}{{^required}}bool {{nameInCamelCase}}IsSet() const;
|
||||
void unset{{name}}();
|
||||
{{/required}}
|
||||
{{/vars}}
|
||||
|
@ -125,7 +125,7 @@ void {{classname}}::{{setter}}({{{datatype}}} value)
|
||||
{{^required}}m_{{name}}IsSet = true;{{/required}}
|
||||
}
|
||||
{{/isNotContainer}}
|
||||
{{^required}}bool {{classname}}::{{baseName}}IsSet() const
|
||||
{{^required}}bool {{classname}}::{{nameInCamelCase}}IsSet() const
|
||||
{
|
||||
return m_{{name}}IsSet;
|
||||
}
|
||||
|
@ -40,11 +40,11 @@ public:
|
||||
/// <remarks>
|
||||
/// {{notes}}
|
||||
/// </remarks>
|
||||
class {{declspec}} {{classname}}{{operationIdCamelCase}}Resource: public restbed::Resource
|
||||
class {{declspec}} {{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource: public restbed::Resource
|
||||
{
|
||||
public:
|
||||
{{classname}}{{operationIdCamelCase}}Resource();
|
||||
virtual ~{{classname}}{{operationIdCamelCase}}Resource();
|
||||
{{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource();
|
||||
virtual ~{{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource();
|
||||
void {{httpMethod}}_method_handler(const std::shared_ptr<restbed::Session> session);
|
||||
{{#vendorExtensions.x-codegen-otherMethods}}
|
||||
void {{httpMethod}}_method_handler(const std::shared_ptr<restbed::Session> session);
|
||||
|
@ -16,8 +16,8 @@ using namespace {{modelNamespace}};
|
||||
|
||||
{{classname}}::{{classname}}() {
|
||||
{{#operation}}
|
||||
std::shared_ptr<{{classname}}{{operationIdCamelCase}}Resource> sp{{classname}}{{operationIdCamelCase}}Resource = std::make_shared<{{classname}}{{operationIdCamelCase}}Resource>();
|
||||
this->publish(sp{{classname}}{{operationIdCamelCase}}Resource);
|
||||
std::shared_ptr<{{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource> sp{{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource = std::make_shared<{{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource>();
|
||||
this->publish(sp{{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource);
|
||||
|
||||
{{/operation}}
|
||||
}
|
||||
@ -37,24 +37,24 @@ void {{classname}}::stopService() {
|
||||
}
|
||||
|
||||
{{#operation}}
|
||||
{{classname}}{{operationIdCamelCase}}Resource::{{classname}}{{operationIdCamelCase}}Resource()
|
||||
{{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource::{{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource()
|
||||
{
|
||||
this->set_path("{{path}}");
|
||||
this->set_method_handler("{{httpMethod}}",
|
||||
std::bind(&{{classname}}{{operationIdCamelCase}}Resource::{{httpMethod}}_method_handler, this,
|
||||
std::bind(&{{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource::{{httpMethod}}_method_handler, this,
|
||||
std::placeholders::_1));
|
||||
{{#vendorExtensions.x-codegen-otherMethods}}
|
||||
this->set_method_handler("{{httpMethod}}",
|
||||
std::bind(&{{classname}}{{operationIdCamelCase}}Resource::{{httpMethod}}_method_handler, this,
|
||||
std::bind(&{{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource::{{httpMethod}}_method_handler, this,
|
||||
std::placeholders::_1));
|
||||
{{/vendorExtensions.x-codegen-otherMethods}}
|
||||
}
|
||||
|
||||
{{classname}}{{operationIdCamelCase}}Resource::~{{classname}}{{operationIdCamelCase}}Resource()
|
||||
{{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource::~{{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource()
|
||||
{
|
||||
}
|
||||
|
||||
void {{classname}}{{operationIdCamelCase}}Resource::{{httpMethod}}_method_handler(const std::shared_ptr<restbed::Session> session) {
|
||||
void {{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource::{{httpMethod}}_method_handler(const std::shared_ptr<restbed::Session> session) {
|
||||
|
||||
const auto request = session->get_request();
|
||||
{{#hasBodyParam}}
|
||||
@ -122,7 +122,7 @@ void {{classname}}{{operationIdCamelCase}}Resource::{{httpMethod}}_method_handle
|
||||
}
|
||||
|
||||
{{#vendorExtensions.x-codegen-otherMethods}}
|
||||
void {{classname}}{{operationIdCamelCase}}Resource::{{httpMethod}}_method_handler(const std::shared_ptr<restbed::Session> session) {
|
||||
void {{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource::{{httpMethod}}_method_handler(const std::shared_ptr<restbed::Session> session) {
|
||||
|
||||
const auto request = session->get_request();
|
||||
{{#hasBodyParam}}
|
||||
|
@ -9,6 +9,7 @@ import io.swagger.codegen.languages.JavaClientCodegen;
|
||||
import io.swagger.models.ArrayModel;
|
||||
import io.swagger.models.Model;
|
||||
import io.swagger.models.ModelImpl;
|
||||
import io.swagger.models.Xml;
|
||||
import io.swagger.models.parameters.QueryParameter;
|
||||
import io.swagger.models.properties.ArrayProperty;
|
||||
import io.swagger.models.properties.ByteArrayProperty;
|
||||
@ -583,4 +584,73 @@ public class JavaModelTest {
|
||||
Assert.assertEquals(property.name, name);
|
||||
}
|
||||
|
||||
|
||||
@Test(description = "test models with xml")
|
||||
public void modelWithXmlTest() {
|
||||
final Model model = new ModelImpl()
|
||||
.description("a sample model")
|
||||
.xml(new Xml()
|
||||
.prefix("my")
|
||||
.namespace("xmlNamespace")
|
||||
.name("customXmlName"))
|
||||
.property("id", new LongProperty())
|
||||
.property("name", new StringProperty()
|
||||
.example("Tony")
|
||||
.xml(new Xml()
|
||||
.attribute(true)
|
||||
.prefix("my")
|
||||
.name("myName")))
|
||||
.property("createdAt", new DateTimeProperty()
|
||||
.xml(new Xml()
|
||||
.prefix("my")
|
||||
.namespace("myNamespace")
|
||||
.name("myCreatedAt")))
|
||||
.required("id")
|
||||
.required("name");
|
||||
final DefaultCodegen codegen = new JavaClientCodegen();
|
||||
final CodegenModel cm = codegen.fromModel("sample", model);
|
||||
|
||||
Assert.assertEquals(cm.name, "sample");
|
||||
Assert.assertEquals(cm.classname, "Sample");
|
||||
Assert.assertEquals(cm.description, "a sample model");
|
||||
Assert.assertEquals(cm.xmlPrefix, "my");
|
||||
Assert.assertEquals(cm.xmlName, "customXmlName");
|
||||
Assert.assertEquals(cm.xmlNamespace, "xmlNamespace");
|
||||
Assert.assertEquals(cm.vars.size(), 3);
|
||||
|
||||
final List<CodegenProperty> vars = cm.vars;
|
||||
|
||||
final CodegenProperty property2 = vars.get(1);
|
||||
Assert.assertEquals(property2.baseName, "name");
|
||||
Assert.assertEquals(property2.getter, "getName");
|
||||
Assert.assertEquals(property2.setter, "setName");
|
||||
Assert.assertEquals(property2.datatype, "String");
|
||||
Assert.assertEquals(property2.name, "name");
|
||||
Assert.assertEquals(property2.defaultValue, "null");
|
||||
Assert.assertEquals(property2.baseType, "String");
|
||||
Assert.assertEquals(property2.example, "Tony");
|
||||
Assert.assertTrue(property2.hasMore);
|
||||
Assert.assertTrue(property2.required);
|
||||
Assert.assertTrue(property2.isNotContainer);
|
||||
Assert.assertTrue(property2.isXmlAttribute);
|
||||
Assert.assertEquals(property2.xmlName, "myName");
|
||||
Assert.assertNull(property2.xmlNamespace);
|
||||
|
||||
final CodegenProperty property3 = vars.get(2);
|
||||
Assert.assertEquals(property3.baseName, "createdAt");
|
||||
Assert.assertEquals(property3.getter, "getCreatedAt");
|
||||
Assert.assertEquals(property3.setter, "setCreatedAt");
|
||||
Assert.assertEquals(property3.datatype, "Date");
|
||||
Assert.assertEquals(property3.name, "createdAt");
|
||||
Assert.assertEquals(property3.defaultValue, "null");
|
||||
Assert.assertEquals(property3.baseType, "Date");
|
||||
Assert.assertFalse(property3.hasMore);
|
||||
Assert.assertFalse(property3.required);
|
||||
Assert.assertTrue(property3.isNotContainer);
|
||||
Assert.assertFalse(property3.isXmlAttribute);
|
||||
Assert.assertEquals(property3.xmlName, "myCreatedAt");
|
||||
Assert.assertEquals(property3.xmlNamespace, "myNamespace");
|
||||
Assert.assertEquals(property3.xmlPrefix, "my");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ public class JavaOptionsProvider implements OptionsProvider {
|
||||
public static final String LOCAL_PREFIX_VALUE = "tst";
|
||||
public static final String SERIALIZABLE_MODEL_VALUE = "false";
|
||||
public static final String FULL_JAVA_UTIL_VALUE = "true";
|
||||
public static final String WITH_XML_VALUE = "false";
|
||||
public static final String JAVA8_MODE_VALUE = "true";
|
||||
public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true";
|
||||
//public static final String SUPPORT_JAVA6 = "true";
|
||||
@ -66,6 +67,7 @@ public class JavaOptionsProvider implements OptionsProvider {
|
||||
.put(CodegenConstants.LOCAL_VARIABLE_PREFIX, LOCAL_PREFIX_VALUE)
|
||||
.put(CodegenConstants.SERIALIZABLE_MODEL, SERIALIZABLE_MODEL_VALUE)
|
||||
.put(JavaClientCodegen.FULL_JAVA_UTIL, FULL_JAVA_UTIL_VALUE)
|
||||
.put(JavaClientCodegen.WITH_XML, WITH_XML_VALUE)
|
||||
.put(JavaClientCodegen.JAVA8_MODE, JAVA8_MODE_VALUE)
|
||||
.put(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING, "true")
|
||||
.put(JavaClientCodegen.DATE_LIBRARY, "joda")
|
||||
|
@ -38,6 +38,7 @@ public class JaxRSServerOptionsProvider implements OptionsProvider {
|
||||
public static final String USE_BEANVALIDATION = "true";
|
||||
public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false";
|
||||
public static final String JAVA8_MODE_VALUE = "false";
|
||||
public static final String WITH_XML_VALUE = "false";
|
||||
|
||||
|
||||
@Override
|
||||
@ -83,6 +84,7 @@ public class JaxRSServerOptionsProvider implements OptionsProvider {
|
||||
.put(CodegenConstants.LIBRARY, JAXRS_DEFAULT_LIBRARY_VALUE)
|
||||
.put(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING, "true")
|
||||
.put(JavaClientCodegen.JAVA8_MODE, JAVA8_MODE_VALUE)
|
||||
.put(JavaClientCodegen.WITH_XML, WITH_XML_VALUE)
|
||||
//.put(JavaClientCodegen.DATE_LIBRARY, "joda")
|
||||
.put("hideGenerationTimestamp", "true")
|
||||
.put(JavaCXFServerCodegen.USE_BEANVALIDATION, USE_BEANVALIDATION)
|
||||
|
@ -0,0 +1,59 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.languages.SymfonyServerCodegen;
|
||||
import io.swagger.codegen.languages.SymfonyServerCodegen;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class SymfonyServerOptionsProvider implements OptionsProvider {
|
||||
public static final String BUNDLE_NAME_VALUE = "AcmeSwagger";
|
||||
public static final String MODEL_PACKAGE_VALUE = "package";
|
||||
public static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true";
|
||||
public static final String VARIABLE_NAMING_CONVENTION_VALUE = "snake_case";
|
||||
public static final String INVOKER_PACKAGE_VALUE = "Acme\\Bundle\\SwaggerBundle";
|
||||
public static final String PACKAGE_PATH_VALUE = "SwaggerClient-php";
|
||||
public static final String SRC_BASE_PATH_VALUE = "libPhp";
|
||||
public static final String COMPOSER_VENDOR_NAME_VALUE = "swaggerPhp";
|
||||
public static final String COMPOSER_PROJECT_NAME_VALUE = "swagger-client-php";
|
||||
public static final String GIT_USER_ID_VALUE = "gitSwaggerPhp";
|
||||
public static final String GIT_REPO_ID_VALUE = "git-swagger-client-php";
|
||||
public static final String ARTIFACT_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false";
|
||||
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "php-symfony";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(SymfonyServerCodegen.BUNDLE_NAME, BUNDLE_NAME_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE)
|
||||
.put(SymfonyServerCodegen.VARIABLE_NAMING_CONVENTION, VARIABLE_NAMING_CONVENTION_VALUE)
|
||||
.put(CodegenConstants.INVOKER_PACKAGE, INVOKER_PACKAGE_VALUE)
|
||||
.put(SymfonyServerCodegen.PACKAGE_PATH, PACKAGE_PATH_VALUE)
|
||||
.put(SymfonyServerCodegen.SRC_BASE_PATH, SRC_BASE_PATH_VALUE)
|
||||
.put(SymfonyServerCodegen.COMPOSER_VENDOR_NAME, COMPOSER_VENDOR_NAME_VALUE)
|
||||
.put(CodegenConstants.GIT_USER_ID, GIT_USER_ID_VALUE)
|
||||
.put(SymfonyServerCodegen.COMPOSER_PROJECT_NAME, COMPOSER_PROJECT_NAME_VALUE)
|
||||
.put(CodegenConstants.GIT_REPO_ID, GIT_REPO_ID_VALUE)
|
||||
.put(CodegenConstants.ARTIFACT_VERSION, ARTIFACT_VERSION_VALUE)
|
||||
.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true")
|
||||
.put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package io.swagger.codegen.phpsymfony;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.AbstractPhpCodegen;
|
||||
import io.swagger.codegen.languages.SymfonyServerCodegen;
|
||||
import io.swagger.codegen.options.SymfonyServerOptionsProvider;
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class PhpSymfonyServerOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private SymfonyServerCodegen symfonyCodegen;
|
||||
|
||||
public PhpSymfonyServerOptionsTest() {
|
||||
super(new SymfonyServerOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return symfonyCodegen;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(symfonyCodegen) {{
|
||||
symfonyCodegen.setBundleName(SymfonyServerOptionsProvider.BUNDLE_NAME_VALUE);
|
||||
times = 1;
|
||||
symfonyCodegen.setModelPackage(SymfonyServerOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
symfonyCodegen.setApiPackage(SymfonyServerOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
symfonyCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(SymfonyServerOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
symfonyCodegen.setParameterNamingConvention(SymfonyServerOptionsProvider.VARIABLE_NAMING_CONVENTION_VALUE);
|
||||
times = 1;
|
||||
symfonyCodegen.setInvokerPackage(SymfonyServerOptionsProvider.INVOKER_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
symfonyCodegen.setPackagePath(SymfonyServerOptionsProvider.PACKAGE_PATH_VALUE);
|
||||
times = 1;
|
||||
symfonyCodegen.setSrcBasePath(SymfonyServerOptionsProvider.SRC_BASE_PATH_VALUE);
|
||||
times = 1;
|
||||
symfonyCodegen.setComposerVendorName(SymfonyServerOptionsProvider.COMPOSER_VENDOR_NAME_VALUE);
|
||||
times = 1;
|
||||
symfonyCodegen.setGitUserId(SymfonyServerOptionsProvider.GIT_USER_ID_VALUE);
|
||||
times = 1;
|
||||
symfonyCodegen.setComposerProjectName(SymfonyServerOptionsProvider.COMPOSER_PROJECT_NAME_VALUE);
|
||||
times = 1;
|
||||
symfonyCodegen.setGitRepoId(SymfonyServerOptionsProvider.GIT_REPO_ID_VALUE);
|
||||
times = 1;
|
||||
symfonyCodegen.setArtifactVersion(SymfonyServerOptionsProvider.ARTIFACT_VERSION_VALUE);
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
@ -816,6 +816,7 @@
|
||||
<module>samples/client/petstore/java/retrofit2rx</module>
|
||||
<module>samples/client/petstore/jaxrs-cxf-client</module>
|
||||
<module>samples/client/petstore/java/resttemplate</module>
|
||||
<module>samples/client/petstore/java/resttemplate-withXml</module>
|
||||
<module>samples/client/petstore/ruby</module>
|
||||
<!-- comment out bash as it's failing after switching to CircleCI
|
||||
<module>samples/client/petstore/bash</module> -->
|
||||
|
@ -735,7 +735,7 @@ public class ApiClient {
|
||||
clientConfig.register(json);
|
||||
clientConfig.register(JacksonFeature.class);
|
||||
if (debugging) {
|
||||
clientConfig.register(LoggingFilter.class);
|
||||
clientConfig.register(new LoggingFilter(java.util.logging.Logger.getLogger(LoggingFilter.class.getName()), true));
|
||||
}
|
||||
return ClientBuilder.newClient(clientConfig);
|
||||
}
|
||||
|
@ -735,7 +735,7 @@ public class ApiClient {
|
||||
clientConfig.register(json);
|
||||
clientConfig.register(JacksonFeature.class);
|
||||
if (debugging) {
|
||||
clientConfig.register(LoggingFilter.class);
|
||||
clientConfig.register(new LoggingFilter(java.util.logging.Logger.getLogger(LoggingFilter.class.getName()), true));
|
||||
}
|
||||
return ClientBuilder.newClient(clientConfig);
|
||||
}
|
||||
|
@ -735,7 +735,7 @@ public class ApiClient {
|
||||
clientConfig.register(json);
|
||||
clientConfig.register(JacksonFeature.class);
|
||||
if (debugging) {
|
||||
clientConfig.register(LoggingFilter.class);
|
||||
clientConfig.register(new LoggingFilter(java.util.logging.Logger.getLogger(LoggingFilter.class.getName()), true));
|
||||
}
|
||||
return ClientBuilder.newClient(clientConfig);
|
||||
}
|
||||
|
21
samples/client/petstore/java/resttemplate-withXml/.gitignore
vendored
Normal file
21
samples/client/petstore/java/resttemplate-withXml/.gitignore
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
*.class
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
|
||||
# exclude jar for gradle wrapper
|
||||
!gradle/wrapper/*.jar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
# build files
|
||||
**/target
|
||||
target
|
||||
.gradle
|
||||
build
|
@ -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
|
@ -0,0 +1 @@
|
||||
2.2.3-SNAPSHOT
|
@ -0,0 +1,17 @@
|
||||
#
|
||||
# Generated by: https://github.com/swagger-api/swagger-codegen.git
|
||||
#
|
||||
language: java
|
||||
jdk:
|
||||
- oraclejdk8
|
||||
- oraclejdk7
|
||||
before_install:
|
||||
# ensure gradlew has proper permission
|
||||
- chmod a+x ./gradlew
|
||||
script:
|
||||
# test using maven
|
||||
- mvn test
|
||||
# uncomment below to test using gradle
|
||||
# - gradle test
|
||||
# uncomment below to test using sbt
|
||||
# - sbt test
|
188
samples/client/petstore/java/resttemplate-withXml/README.md
Normal file
188
samples/client/petstore/java/resttemplate-withXml/README.md
Normal file
@ -0,0 +1,188 @@
|
||||
# swagger-petstore-resttemplate
|
||||
|
||||
## Requirements
|
||||
|
||||
Building the API client library requires [Maven](https://maven.apache.org/) to be installed.
|
||||
|
||||
## Installation
|
||||
|
||||
To install the API client library to your local Maven repository, simply execute:
|
||||
|
||||
```shell
|
||||
mvn install
|
||||
```
|
||||
|
||||
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
|
||||
|
||||
```shell
|
||||
mvn deploy
|
||||
```
|
||||
|
||||
Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information.
|
||||
|
||||
### Maven users
|
||||
|
||||
Add this dependency to your project's POM:
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-petstore-resttemplate</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
### Gradle users
|
||||
|
||||
Add this dependency to your project's build file:
|
||||
|
||||
```groovy
|
||||
compile "io.swagger:swagger-petstore-resttemplate:1.0.0"
|
||||
```
|
||||
|
||||
### Others
|
||||
|
||||
At first generate the JAR by executing:
|
||||
|
||||
mvn package
|
||||
|
||||
Then manually install the following JARs:
|
||||
|
||||
* target/swagger-petstore-resttemplate-1.0.0.jar
|
||||
* target/lib/*.jar
|
||||
|
||||
## Getting Started
|
||||
|
||||
Please follow the [installation](#installation) instruction and execute the following Java code:
|
||||
|
||||
```java
|
||||
|
||||
import io.swagger.client.*;
|
||||
import io.swagger.client.auth.*;
|
||||
import io.swagger.client.model.*;
|
||||
import io.swagger.client.api.FakeApi;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
public class FakeApiExample {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
FakeApi apiInstance = new FakeApi();
|
||||
Boolean body = true; // Boolean | Input boolean as post body
|
||||
try {
|
||||
Boolean result = apiInstance.fakeOuterBooleanSerialize(body);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean |
|
||||
*FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite |
|
||||
*FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number |
|
||||
*FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string |
|
||||
*FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model
|
||||
*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
*FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters
|
||||
*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
||||
*PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
*PetApi* | [**findPetsByTags**](docs/PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
*PetApi* | [**getPetById**](docs/PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
|
||||
*PetApi* | [**updatePet**](docs/PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
*PetApi* | [**uploadFile**](docs/PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteOrder) | **DELETE** /store/order/{order_id} | Delete purchase order by ID
|
||||
*StoreApi* | [**getInventory**](docs/StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
*StoreApi* | [**getOrderById**](docs/StoreApi.md#getOrderById) | **GET** /store/order/{order_id} | Find purchase order by ID
|
||||
*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||
*UserApi* | [**createUser**](docs/UserApi.md#createUser) | **POST** /user | Create user
|
||||
*UserApi* | [**createUsersWithArrayInput**](docs/UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
*UserApi* | [**createUsersWithListInput**](docs/UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
*UserApi* | [**deleteUser**](docs/UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user
|
||||
*UserApi* | [**getUserByName**](docs/UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name
|
||||
*UserApi* | [**loginUser**](docs/UserApi.md#loginUser) | **GET** /user/login | Logs user into the system
|
||||
*UserApi* | [**logoutUser**](docs/UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session
|
||||
*UserApi* | [**updateUser**](docs/UserApi.md#updateUser) | **PUT** /user/{username} | Updated user
|
||||
|
||||
|
||||
## Documentation for Models
|
||||
|
||||
- [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
|
||||
- [Animal](docs/Animal.md)
|
||||
- [AnimalFarm](docs/AnimalFarm.md)
|
||||
- [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
|
||||
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
||||
- [ArrayTest](docs/ArrayTest.md)
|
||||
- [Capitalization](docs/Capitalization.md)
|
||||
- [Category](docs/Category.md)
|
||||
- [ClassModel](docs/ClassModel.md)
|
||||
- [Client](docs/Client.md)
|
||||
- [EnumArrays](docs/EnumArrays.md)
|
||||
- [EnumClass](docs/EnumClass.md)
|
||||
- [EnumTest](docs/EnumTest.md)
|
||||
- [FormatTest](docs/FormatTest.md)
|
||||
- [HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
|
||||
- [MapTest](docs/MapTest.md)
|
||||
- [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
|
||||
- [Model200Response](docs/Model200Response.md)
|
||||
- [ModelApiResponse](docs/ModelApiResponse.md)
|
||||
- [ModelReturn](docs/ModelReturn.md)
|
||||
- [Name](docs/Name.md)
|
||||
- [NumberOnly](docs/NumberOnly.md)
|
||||
- [Order](docs/Order.md)
|
||||
- [OuterComposite](docs/OuterComposite.md)
|
||||
- [OuterEnum](docs/OuterEnum.md)
|
||||
- [Pet](docs/Pet.md)
|
||||
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
||||
- [SpecialModelName](docs/SpecialModelName.md)
|
||||
- [Tag](docs/Tag.md)
|
||||
- [User](docs/User.md)
|
||||
- [Cat](docs/Cat.md)
|
||||
- [Dog](docs/Dog.md)
|
||||
|
||||
|
||||
## Documentation for Authorization
|
||||
|
||||
Authentication schemes defined for the API:
|
||||
### api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
### http_basic_test
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
### petstore_auth
|
||||
|
||||
- **Type**: OAuth
|
||||
- **Flow**: implicit
|
||||
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
|
||||
- **Scopes**:
|
||||
- write:pets: modify pets in your account
|
||||
- read:pets: read your pets
|
||||
|
||||
|
||||
## Recommendation
|
||||
|
||||
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
|
||||
|
||||
## Author
|
||||
|
||||
apiteam@swagger.io
|
||||
|
115
samples/client/petstore/java/resttemplate-withXml/build.gradle
Normal file
115
samples/client/petstore/java/resttemplate-withXml/build.gradle
Normal file
@ -0,0 +1,115 @@
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'eclipse'
|
||||
|
||||
group = 'io.swagger'
|
||||
version = '1.0.0'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.5.+'
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
|
||||
|
||||
if(hasProperty('target') && target == 'android') {
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'com.github.dcendents.android-maven'
|
||||
|
||||
android {
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion '23.0.2'
|
||||
defaultConfig {
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 22
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_7
|
||||
targetCompatibility JavaVersion.VERSION_1_7
|
||||
}
|
||||
|
||||
// Rename the aar correctly
|
||||
libraryVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
def outputFile = output.outputFile
|
||||
if (outputFile != null && outputFile.name.endsWith('.aar')) {
|
||||
def fileName = "${project.name}-${variant.baseName}-${version}.aar"
|
||||
output.outputFile = new File(outputFile.parent, fileName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
provided 'javax.annotation:jsr250-api:1.0'
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
android.libraryVariants.all { variant ->
|
||||
def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
|
||||
task.description = "Create jar artifact for ${variant.name}"
|
||||
task.dependsOn variant.javaCompile
|
||||
task.from variant.javaCompile.destinationDir
|
||||
task.destinationDir = project.file("${project.buildDir}/outputs/jar")
|
||||
task.archiveName = "${project.name}-${variant.baseName}-${version}.jar"
|
||||
artifacts.add('archives', task);
|
||||
}
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
classifier = 'sources'
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'maven'
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_1_7
|
||||
targetCompatibility = JavaVersion.VERSION_1_7
|
||||
|
||||
install {
|
||||
repositories.mavenInstaller {
|
||||
pom.artifactId = 'swagger-petstore-resttemplate'
|
||||
}
|
||||
}
|
||||
|
||||
task execute(type:JavaExec) {
|
||||
main = System.getProperty('mainClass')
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
swagger_annotations_version = "1.5.15"
|
||||
jackson_version = "2.8.9"
|
||||
spring_web_version = "4.3.9.RELEASE"
|
||||
jodatime_version = "2.9.9"
|
||||
junit_version = "4.12"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "io.swagger:swagger-annotations:$swagger_annotations_version"
|
||||
compile "org.springframework:spring-web:$spring_web_version"
|
||||
compile "com.fasterxml.jackson.core:jackson-core:$jackson_version"
|
||||
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
||||
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
|
||||
compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
|
||||
compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:$jackson_version"
|
||||
compile "joda-time:joda-time:$jodatime_version"
|
||||
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jackson_version"
|
||||
testCompile "junit:junit:$junit_version"
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
|
||||
# AdditionalPropertiesClass
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**mapProperty** | **Map<String, String>** | | [optional]
|
||||
**mapOfMapProperty** | [**Map<String, Map<String, String>>**](Map.md) | | [optional]
|
||||
|
||||
|
||||
|
@ -0,0 +1,11 @@
|
||||
|
||||
# Animal
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**className** | **String** | |
|
||||
**color** | **String** | | [optional]
|
||||
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
|
||||
# AnimalFarm
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
|
||||
# ArrayOfArrayOfNumberOnly
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**arrayArrayNumber** | [**List<List<BigDecimal>>**](List.md) | | [optional]
|
||||
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
|
||||
# ArrayOfNumberOnly
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**arrayNumber** | [**List<BigDecimal>**](BigDecimal.md) | | [optional]
|
||||
|
||||
|
||||
|
@ -0,0 +1,12 @@
|
||||
|
||||
# ArrayTest
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**arrayOfString** | **List<String>** | | [optional]
|
||||
**arrayArrayOfInteger** | [**List<List<Long>>**](List.md) | | [optional]
|
||||
**arrayArrayOfModel** | [**List<List<ReadOnlyFirst>>**](List.md) | | [optional]
|
||||
|
||||
|
||||
|
@ -0,0 +1,15 @@
|
||||
|
||||
# Capitalization
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**smallCamel** | **String** | | [optional]
|
||||
**capitalCamel** | **String** | | [optional]
|
||||
**smallSnake** | **String** | | [optional]
|
||||
**capitalSnake** | **String** | | [optional]
|
||||
**scAETHFlowPoints** | **String** | | [optional]
|
||||
**ATT_NAME** | **String** | Name of the pet | [optional]
|
||||
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
|
||||
# Cat
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**declawed** | **Boolean** | | [optional]
|
||||
|
||||
|
||||
|
@ -0,0 +1,11 @@
|
||||
|
||||
# Category
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **Long** | | [optional]
|
||||
**name** | **String** | | [optional]
|
||||
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
|
||||
# ClassModel
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**propertyClass** | **String** | | [optional]
|
||||
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
|
||||
# Client
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**client** | **String** | | [optional]
|
||||
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
|
||||
# Dog
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**breed** | **String** | | [optional]
|
||||
|
||||
|
||||
|
@ -0,0 +1,27 @@
|
||||
|
||||
# EnumArrays
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) | | [optional]
|
||||
**arrayEnum** | [**List<ArrayEnumEnum>**](#List<ArrayEnumEnum>) | | [optional]
|
||||
|
||||
|
||||
<a name="JustSymbolEnum"></a>
|
||||
## Enum: JustSymbolEnum
|
||||
Name | Value
|
||||
---- | -----
|
||||
GREATER_THAN_OR_EQUAL_TO | ">="
|
||||
DOLLAR | "$"
|
||||
|
||||
|
||||
<a name="List<ArrayEnumEnum>"></a>
|
||||
## Enum: List<ArrayEnumEnum>
|
||||
Name | Value
|
||||
---- | -----
|
||||
FISH | "fish"
|
||||
CRAB | "crab"
|
||||
|
||||
|
||||
|
@ -0,0 +1,14 @@
|
||||
|
||||
# EnumClass
|
||||
|
||||
## Enum
|
||||
|
||||
|
||||
* `_ABC` (value: `"_abc"`)
|
||||
|
||||
* `_EFG` (value: `"-efg"`)
|
||||
|
||||
* `_XYZ_` (value: `"(xyz)"`)
|
||||
|
||||
|
||||
|
@ -0,0 +1,38 @@
|
||||
|
||||
# EnumTest
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional]
|
||||
**enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional]
|
||||
**enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional]
|
||||
**outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional]
|
||||
|
||||
|
||||
<a name="EnumStringEnum"></a>
|
||||
## Enum: EnumStringEnum
|
||||
Name | Value
|
||||
---- | -----
|
||||
UPPER | "UPPER"
|
||||
LOWER | "lower"
|
||||
EMPTY | ""
|
||||
|
||||
|
||||
<a name="EnumIntegerEnum"></a>
|
||||
## Enum: EnumIntegerEnum
|
||||
Name | Value
|
||||
---- | -----
|
||||
NUMBER_1 | 1
|
||||
NUMBER_MINUS_1 | -1
|
||||
|
||||
|
||||
<a name="EnumNumberEnum"></a>
|
||||
## Enum: EnumNumberEnum
|
||||
Name | Value
|
||||
---- | -----
|
||||
NUMBER_1_DOT_1 | 1.1
|
||||
NUMBER_MINUS_1_DOT_2 | -1.2
|
||||
|
||||
|
||||
|
@ -0,0 +1,377 @@
|
||||
# FakeApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean |
|
||||
[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite |
|
||||
[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number |
|
||||
[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string |
|
||||
[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model
|
||||
[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
[**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters
|
||||
|
||||
|
||||
<a name="fakeOuterBooleanSerialize"></a>
|
||||
# **fakeOuterBooleanSerialize**
|
||||
> Boolean fakeOuterBooleanSerialize(body)
|
||||
|
||||
|
||||
|
||||
Test serialization of outer boolean types
|
||||
|
||||
### Example
|
||||
```java
|
||||
// Import classes:
|
||||
//import io.swagger.client.ApiException;
|
||||
//import io.swagger.client.api.FakeApi;
|
||||
|
||||
|
||||
FakeApi apiInstance = new FakeApi();
|
||||
Boolean body = true; // Boolean | Input boolean as post body
|
||||
try {
|
||||
Boolean result = apiInstance.fakeOuterBooleanSerialize(body);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Boolean**](Boolean.md)| Input boolean as post body | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
**Boolean**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="fakeOuterCompositeSerialize"></a>
|
||||
# **fakeOuterCompositeSerialize**
|
||||
> OuterComposite fakeOuterCompositeSerialize(body)
|
||||
|
||||
|
||||
|
||||
Test serialization of object with outer number type
|
||||
|
||||
### Example
|
||||
```java
|
||||
// Import classes:
|
||||
//import io.swagger.client.ApiException;
|
||||
//import io.swagger.client.api.FakeApi;
|
||||
|
||||
|
||||
FakeApi apiInstance = new FakeApi();
|
||||
OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body
|
||||
try {
|
||||
OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
[**OuterComposite**](OuterComposite.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="fakeOuterNumberSerialize"></a>
|
||||
# **fakeOuterNumberSerialize**
|
||||
> BigDecimal fakeOuterNumberSerialize(body)
|
||||
|
||||
|
||||
|
||||
Test serialization of outer number types
|
||||
|
||||
### Example
|
||||
```java
|
||||
// Import classes:
|
||||
//import io.swagger.client.ApiException;
|
||||
//import io.swagger.client.api.FakeApi;
|
||||
|
||||
|
||||
FakeApi apiInstance = new FakeApi();
|
||||
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
|
||||
try {
|
||||
BigDecimal result = apiInstance.fakeOuterNumberSerialize(body);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**BigDecimal**](BigDecimal.md)| Input number as post body | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
[**BigDecimal**](BigDecimal.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="fakeOuterStringSerialize"></a>
|
||||
# **fakeOuterStringSerialize**
|
||||
> String fakeOuterStringSerialize(body)
|
||||
|
||||
|
||||
|
||||
Test serialization of outer string types
|
||||
|
||||
### Example
|
||||
```java
|
||||
// Import classes:
|
||||
//import io.swagger.client.ApiException;
|
||||
//import io.swagger.client.api.FakeApi;
|
||||
|
||||
|
||||
FakeApi apiInstance = new FakeApi();
|
||||
String body = "body_example"; // String | Input string as post body
|
||||
try {
|
||||
String result = apiInstance.fakeOuterStringSerialize(body);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**String**](String.md)| Input string as post body | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
**String**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="testClientModel"></a>
|
||||
# **testClientModel**
|
||||
> Client testClientModel(body)
|
||||
|
||||
To test \"client\" model
|
||||
|
||||
To test \"client\" model
|
||||
|
||||
### Example
|
||||
```java
|
||||
// Import classes:
|
||||
//import io.swagger.client.ApiException;
|
||||
//import io.swagger.client.api.FakeApi;
|
||||
|
||||
|
||||
FakeApi apiInstance = new FakeApi();
|
||||
Client body = new Client(); // Client | client model
|
||||
try {
|
||||
Client result = apiInstance.testClientModel(body);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling FakeApi#testClientModel");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Client**](Client.md)| client model |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Client**](Client.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: application/json
|
||||
|
||||
<a name="testEndpointParameters"></a>
|
||||
# **testEndpointParameters**
|
||||
> testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback)
|
||||
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
|
||||
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
|
||||
### Example
|
||||
```java
|
||||
// Import classes:
|
||||
//import io.swagger.client.ApiClient;
|
||||
//import io.swagger.client.ApiException;
|
||||
//import io.swagger.client.Configuration;
|
||||
//import io.swagger.client.auth.*;
|
||||
//import io.swagger.client.api.FakeApi;
|
||||
|
||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||
|
||||
// Configure HTTP basic authorization: http_basic_test
|
||||
HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test");
|
||||
http_basic_test.setUsername("YOUR USERNAME");
|
||||
http_basic_test.setPassword("YOUR PASSWORD");
|
||||
|
||||
FakeApi apiInstance = new FakeApi();
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = _byte_example; // byte[] | None
|
||||
Integer integer = 56; // Integer | None
|
||||
Integer int32 = 56; // Integer | None
|
||||
Long int64 = 789L; // Long | None
|
||||
Float _float = 3.4F; // Float | None
|
||||
String string = "string_example"; // String | None
|
||||
byte[] binary = B; // byte[] | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
DateTime dateTime = new DateTime(); // DateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
String paramCallback = "paramCallback_example"; // String | None
|
||||
try {
|
||||
apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling FakeApi#testEndpointParameters");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**number** | **BigDecimal**| None |
|
||||
**_double** | **Double**| None |
|
||||
**patternWithoutDelimiter** | **String**| None |
|
||||
**_byte** | **byte[]**| None |
|
||||
**integer** | **Integer**| None | [optional]
|
||||
**int32** | **Integer**| None | [optional]
|
||||
**int64** | **Long**| None | [optional]
|
||||
**_float** | **Float**| None | [optional]
|
||||
**string** | **String**| None | [optional]
|
||||
**binary** | **byte[]**| None | [optional]
|
||||
**date** | **LocalDate**| None | [optional]
|
||||
**dateTime** | **DateTime**| None | [optional]
|
||||
**password** | **String**| None | [optional]
|
||||
**paramCallback** | **String**| None | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[http_basic_test](../README.md#http_basic_test)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/xml; charset=utf-8, application/json; charset=utf-8
|
||||
- **Accept**: application/xml; charset=utf-8, application/json; charset=utf-8
|
||||
|
||||
<a name="testEnumParameters"></a>
|
||||
# **testEnumParameters**
|
||||
> testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble)
|
||||
|
||||
To test enum parameters
|
||||
|
||||
To test enum parameters
|
||||
|
||||
### Example
|
||||
```java
|
||||
// Import classes:
|
||||
//import io.swagger.client.ApiException;
|
||||
//import io.swagger.client.api.FakeApi;
|
||||
|
||||
|
||||
FakeApi apiInstance = new FakeApi();
|
||||
List<String> enumFormStringArray = Arrays.asList("enumFormStringArray_example"); // List<String> | Form parameter enum test (string array)
|
||||
String enumFormString = "-efg"; // String | Form parameter enum test (string)
|
||||
List<String> enumHeaderStringArray = Arrays.asList("enumHeaderStringArray_example"); // List<String> | Header parameter enum test (string array)
|
||||
String enumHeaderString = "-efg"; // String | Header parameter enum test (string)
|
||||
List<String> enumQueryStringArray = Arrays.asList("enumQueryStringArray_example"); // List<String> | Query parameter enum test (string array)
|
||||
String enumQueryString = "-efg"; // String | Query parameter enum test (string)
|
||||
Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double)
|
||||
Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double)
|
||||
try {
|
||||
apiInstance.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling FakeApi#testEnumParameters");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $]
|
||||
**enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)]
|
||||
**enumHeaderStringArray** | [**List<String>**](String.md)| Header parameter enum test (string array) | [optional] [enum: >, $]
|
||||
**enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)]
|
||||
**enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $]
|
||||
**enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)]
|
||||
**enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2]
|
||||
**enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2]
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: */*
|
||||
- **Accept**: */*
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user