Skip to content

Commit 637ee77

Browse files
committed
added script, fixed templates
1 parent fb989fc commit 637ee77

26 files changed

+863
-788
lines changed

bin/akka-scala-petstore.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
3+
SCRIPT="$0"
4+
5+
while [ -h "$SCRIPT" ] ; do
6+
ls=`ls -ld "$SCRIPT"`
7+
link=`expr "$ls" : '.*-> \(.*\)$'`
8+
if expr "$link" : '/.*' > /dev/null; then
9+
SCRIPT="$link"
10+
else
11+
SCRIPT=`dirname "$SCRIPT"`/"$link"
12+
fi
13+
done
14+
15+
if [ ! -d "${APP_DIR}" ]; then
16+
APP_DIR=`dirname "$SCRIPT"`/..
17+
APP_DIR=`cd "${APP_DIR}"; pwd`
18+
fi
19+
20+
executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
21+
22+
if [ ! -f "$executable" ]
23+
then
24+
mvn clean package
25+
fi
26+
27+
# if you've executed sbt assembly previously it will use that instead.
28+
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
29+
ags="$@ generate -t modules/swagger-codegen/src/main/resources/akka-scala -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l akka-scala -o samples/client/petstore/akka-scala"
30+
31+
java $JAVA_OPTS -jar $executable $ags
Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
package {{package}}
22

33
{{#imports}}
4-
import {{import}}
4+
import {{import}}
55
{{/imports}}
66
import {{invokerPackage}}._
77
import {{invokerPackage}}.CollectionFormats._
88
import {{invokerPackage}}.ApiKeyLocations._
99

1010
{{#operations}}
11-
object {{classname}} {
11+
object {{classname}} {
1212
13-
{{#operation}}
14-
{{#javadocRenderer}}
15-
{{>javadoc}}
16-
{{/javadocRenderer}}
17-
def {{operationId}}({{>methodParameters}}): ApiRequest[{{>operationReturnType}}] =
18-
ApiRequest[{{>operationReturnType}}](ApiMethods.{{httpMethod.toUpperCase}}, "{{basePath}}", "{{path}}", {{#consumes.0}}"{{mediaType}}"{{/consumes.0}}{{^consumes}}"application/json"{{/consumes}})
19-
{{#authMethods}}{{#isApiKey}}.withApiKey(apiKey, "{{keyParamName}}", {{#isKeyInQuery}}QUERY{{/isKeyInQuery}}{{#isKeyInHeader}}HEADER{{/isKeyInHeader}})
20-
{{/isApiKey}}{{#isBasic}}.withCredentials(basicAuth)
21-
{{/isBasic}}{{/authMethods}}{{#bodyParam}}.withBody({{paramName}})
22-
{{/bodyParam}}{{#formParams}}.withFormParam({{>paramCreation}})
23-
{{/formParams}}{{#queryParams}}.withQueryParam({{>paramCreation}})
24-
{{/queryParams}}{{#pathParams}}.withPathParam({{>paramCreation}})
25-
{{/pathParams}}{{#headerParams}}.withHeaderParam({{>paramCreation}})
26-
{{/headerParams}}{{#responses}}{{^isWildcard}}{{#dataType}}.with{{>responseState}}Response[{{dataType}}]({{code}})
27-
{{/dataType}}{{^dataType}}.with{{>responseState}}Response[Unit]({{code}})
28-
{{/dataType}}{{/isWildcard}}{{/responses}}{{#responses}}{{#isWildcard}}{{#dataType}}.withDefault{{>responseState}}Response[{{dataType}}]
29-
{{/dataType}}{{^dataType}}.withDefault{{>responseState}}Response[Unit]
30-
{{/dataType}}{{/isWildcard}}{{/responses}}{{^responseHeaders.isEmpty}}
31-
object {{#fnCapitalize}}{{operationId}}{{/fnCapitalize}}Headers { {{#responseHeaders}}
32-
def {{name}}(r: ApiReturnWithHeaders) = r.get{{^isContainer}}{{baseType}}{{/isContainer}}{{#isContainer}}String{{/isContainer}}Header("{{baseName}}"){{/responseHeaders}}
33-
}
34-
{{/responseHeaders.isEmpty}}
35-
{{/operation}}
13+
{{#operation}}
14+
{{#javadocRenderer}}
15+
{{>javadoc}}
16+
{{/javadocRenderer}}
17+
def {{operationId}}({{>methodParameters}}): ApiRequest[{{>operationReturnType}}] =
18+
ApiRequest[{{>operationReturnType}}](ApiMethods.{{httpMethod.toUpperCase}}, "{{basePath}}", "{{path}}", {{#consumes.0}}"{{mediaType}}"{{/consumes.0}}{{^consumes}}"application/json"{{/consumes}})
19+
{{#authMethods}}{{#isApiKey}}.withApiKey(apiKey, "{{keyParamName}}", {{#isKeyInQuery}}QUERY{{/isKeyInQuery}}{{#isKeyInHeader}}HEADER{{/isKeyInHeader}})
20+
{{/isApiKey}}{{#isBasic}}.withCredentials(basicAuth)
21+
{{/isBasic}}{{/authMethods}}{{#bodyParam}}.withBody({{paramName}})
22+
{{/bodyParam}}{{#formParams}}.withFormParam({{>paramCreation}})
23+
{{/formParams}}{{#queryParams}}.withQueryParam({{>paramCreation}})
24+
{{/queryParams}}{{#pathParams}}.withPathParam({{>paramCreation}})
25+
{{/pathParams}}{{#headerParams}}.withHeaderParam({{>paramCreation}})
26+
{{/headerParams}}{{#responses}}{{^isWildcard}}{{#dataType}}.with{{>responseState}}Response[{{dataType}}]({{code}})
27+
{{/dataType}}{{^dataType}}.with{{>responseState}}Response[Unit]({{code}})
28+
{{/dataType}}{{/isWildcard}}{{/responses}}{{#responses}}{{#isWildcard}}{{#dataType}}.withDefault{{>responseState}}Response[{{dataType}}]
29+
{{/dataType}}{{^dataType}}.withDefault{{>responseState}}Response[Unit]
30+
{{/dataType}}{{/isWildcard}}{{/responses}}{{^responseHeaders.isEmpty}}
31+
object {{#fnCapitalize}}{{operationId}}{{/fnCapitalize}}Headers { {{#responseHeaders}}
32+
def {{name}}(r: ApiReturnWithHeaders) = r.get{{^isContainer}}{{baseType}}{{/isContainer}}{{#isContainer}}String{{/isContainer}}Header("{{baseName}}"){{/responseHeaders}}
33+
}
34+
{{/responseHeaders.isEmpty}}
35+
{{/operation}}
3636

37-
{{#unknownStatusCodes}}
38-
ApiInvoker.addCustomStatusCode({{value}}, isSuccess = false)
39-
{{/unknownStatusCodes}}
37+
{{#unknownStatusCodes}}
38+
ApiInvoker.addCustomStatusCode({{value}}, isSuccess = false)
39+
{{/unknownStatusCodes}}
4040

41-
}
41+
}
4242

4343
{{/operations}}

0 commit comments

Comments
 (0)