openapi-generator/bin/java-petstore-google-api-client.sh
Charles Capps c2eb53ab1d [Java] Templates to support google-api-client library (#6838)
* Add support for the google-api-client

* When there's no return type, just return (no parsing the response)

* Update the deserialization to use a Jackson typeref.

* Delete the auth mustache files as we don't need them

* Stop generating unneeded auth files; get SBT/gradle working with the generated module

* Add builder-style methods to the google-api-client ApiClient for getting API instances

* Update the README to reflect the new client library option

* Generated overloaded methods to send query params as a Map<String, Object>

* Add files for Sample codes

* Add type in angle brackets to support Java 6

* Required query params must be added to the Map of params. Update sample code.

* Use explicit types instead of diamonds to support Java6 in one more place.

* Clean up javadoc warnings in generated code / remove pointless return statements

* Clean up extra newlines in generated code
2017-11-03 18:46:07 +08:00

35 lines
1.2 KiB
Bash
Executable File

#!/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/Java/libraries/google-api-client -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l java -c bin/java-petstore-google-api-client.json -o samples/client/petstore/java/google-api-client -DhideGenerationTimestamp=true"
echo "Removing files and folders under samples/client/petstore/java/google-api-client/src/main"
rm -rf samples/client/petstore/java/google-api-client/src/main
find samples/client/petstore/java/google-api-client -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
java $JAVA_OPTS -jar $executable $ags