forked from loafle/openapi-generator-original
change volley to the default http library for android (existing errors);
This commit is contained in:
parent
093fc4680b
commit
c5136e4dda
31
bin/android-petstore-httpclient.sh
Executable file
31
bin/android-petstore-httpclient.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 -t modules/swagger-codegen/src/main/resources/android -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l android -o samples/client/petstore/android/httpclient"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
@ -26,6 +26,6 @@ fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/android -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l android -o samples/client/petstore/android/default"
|
||||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l android -c bin/android-petstore-volley.json -o samples/client/petstore/android/volley"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
java $JAVA_OPTS -jar $executable $ags
|
@ -89,8 +89,8 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
|
||||
cliOptions.add(CliOption.newBoolean(USE_ANDROID_MAVEN_GRADLE_PLUGIN, "A flag to toggle android-maven gradle plugin.")
|
||||
.defaultValue(Boolean.TRUE.toString()));
|
||||
|
||||
supportedLibraries.put("<default>", "HTTP client: Apache HttpClient 4.3.6. JSON processing: Gson 2.3.1");
|
||||
supportedLibraries.put("volley", "HTTP client: Volley 1.0.19");
|
||||
supportedLibraries.put("httpclient", "HTTP client: Apache HttpClient 4.3.6. JSON processing: Gson 2.3.1");
|
||||
CliOption library = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use");
|
||||
library.setEnum(supportedLibraries);
|
||||
cliOptions.add(library);
|
||||
@ -384,21 +384,28 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
|
||||
if (StringUtils.isEmpty(getLibrary())) {
|
||||
modelDocTemplateFiles.put( "model_doc.mustache", ".md" );
|
||||
apiDocTemplateFiles.put( "api_doc.mustache", ".md" );
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
//supportingFiles.add(new SupportingFile("api_doc.mustache", apiDocPath, "api.md"));
|
||||
//supportingFiles.add(new SupportingFile("model_doc.mustache", modelDocPath, "model.md"));
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
addSupportingFilesForDefault();
|
||||
} else if ("volley".equals(getLibrary())) {
|
||||
addSupportingFilesForVolley();
|
||||
}else if( "volley".equals( getLibrary() ) ){
|
||||
modelDocTemplateFiles.put( "model_doc.mustache", ".md" );
|
||||
apiDocTemplateFiles.put( "api_doc.mustache", ".md" );
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
//supportingFiles.add(new SupportingFile("api_doc.mustache", apiDocPath, "api.md"));
|
||||
//supportingFiles.add(new SupportingFile("model_doc.mustache", modelDocPath, "model.md"));
|
||||
addSupportingFilesForVolley();
|
||||
}else if ("http-client".equals(getLibrary())) {
|
||||
modelDocTemplateFiles.put( "model_doc.mustache", ".md" );
|
||||
apiDocTemplateFiles.put( "api_doc.mustache", ".md" );
|
||||
//supportingFiles.add(new SupportingFile("api_doc.mustache", apiDocPath, "api.md"));
|
||||
//supportingFiles.add(new SupportingFile("model_doc.mustache", modelDocPath, "model.md"));
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
addSupportingFilesForHttpClient();
|
||||
}
|
||||
}
|
||||
|
||||
private void addSupportingFilesForDefault() {
|
||||
private void addSupportingFilesForHttpClient() {
|
||||
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
|
||||
supportingFiles.add(new SupportingFile("settings.gradle.mustache", "", "settings.gradle"));
|
||||
supportingFiles.add(new SupportingFile("build.mustache", "", "build.gradle"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user