Skip to content

Commit 27426f7

Browse files
jimschubertjmini
authored andcommitted
Cli generator name option, replaces 'language' options in CLI and Maven Plugin (#57)
1 parent b73ab02 commit 27426f7

File tree

423 files changed

+710
-493
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

423 files changed

+710
-493
lines changed

Diff for: README.md

+16-14
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ To install, run `brew install openapi-generator`
126126

127127
Here is an example usage to generate a Ruby client:
128128
```sh
129-
openapi-generator generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l ruby -o /tmp/test/
129+
openapi-generator generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g ruby -o /tmp/test/
130130
```
131131

132132
### [1.5 - Docker](#table-of-contents)
@@ -148,7 +148,7 @@ Example:
148148
```sh
149149
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \
150150
-i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml \
151-
-l go \
151+
-g go \
152152
-o /local/out/go
153153
```
154154

@@ -206,10 +206,10 @@ Once built, `run-in-docker.sh` will act as an executable for openapi-generator-c
206206

207207
```sh
208208
./run-in-docker.sh help # Executes 'help' command for openapi-generator-cli
209-
./run-in-docker.sh langs # Executes 'langs' command for openapi-generator-cli
209+
./run-in-docker.sh list # Executes 'list' command for openapi-generator-cli
210210
./run-in-docker.sh /gen/bin/go-petstore.sh # Builds the Go client
211211
./run-in-docker.sh generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml \
212-
-l go -o /gen/out/go-petstore -DpackageName=petstore # generates go client, outputs locally to ./out/go-petstore
212+
-g go -o /gen/out/go-petstore -DpackageName=petstore # generates go client, outputs locally to ./out/go-petstore
213213
```
214214

215215
#### Run Docker in Vagrant
@@ -232,16 +232,16 @@ cd openapi-generator
232232
mvn clean package
233233
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
234234
-i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml \
235-
-l php \
235+
-g php \
236236
-o /var/tmp/php_api_client
237237
```
238-
(if you're on Windows, replace the last command with `java -jar modules\openapi-generator-cli\target\openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l php -o c:\temp\php_api_client`)
238+
(if you're on Windows, replace the last command with `java -jar modules\openapi-generator-cli\target\openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g php -o c:\temp\php_api_client`)
239239

240240
You can also download the JAR (latest release) directly from [maven.org](http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.0.0/openapi-generator-cli-3.0.0.jar)
241241

242242
To get a list of **general** options available, please run `java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar help generate`
243243

244-
To get a list of PHP specified options (which can be passed to the generator with a config file via the `-c` option), please run `java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar config-help -l php`
244+
To get a list of PHP specified options (which can be passed to the generator with a config file via the `-c` option), please run `java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar config-help -g php`
245245

246246
## [3 - Usage](#table-of-contents)
247247

@@ -259,15 +259,16 @@ This will run the generator with this command:
259259
```sh
260260
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
261261
-i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml \
262-
-l java \
262+
-g java \
263263
-o samples/client/petstore/java
264264
```
265265

266266
with a number of options. You can get the options with the `help generate` command (below only shows partial results):
267267

268268
```
269269
NAME
270-
openapi-generator-cli generate - Generate code with chosen lang
270+
openapi-generator-cli generate - Generate code with the specified
271+
generator.
271272
272273
SYNOPSIS
273274
openapi-generator-cli generate
@@ -276,15 +277,16 @@ SYNOPSIS
276277
[--api-package <api package>] [--artifact-id <artifact id>]
277278
[--artifact-version <artifact version>]
278279
[(-c <configuration file> | --config <configuration file>)]
279-
[-D <system properties>...] [--git-repo-id <git repo id>]
280-
[--git-user-id <git user id>] [--group-id <group id>]
281-
[--http-user-agent <http user agent>]
280+
[-D <system properties>...]
281+
[(-g <generator name> | --generator-name <generator name>)]
282+
[--git-repo-id <git repo id>] [--git-user-id <git user id>]
283+
[--group-id <group id>] [--http-user-agent <http user agent>]
282284
(-i <spec file> | --input-spec <spec file>)
283285
[--ignore-file-override <ignore file override location>]
284286
[--import-mappings <import mappings>...]
285287
[--instantiation-types <instantiation types>...]
286288
[--invoker-package <invoker package>]
287-
(-l <language> | --lang <language>)
289+
[(-l <language> | --lang <language>)]
288290
[--language-specific-primitives <language specific primitives>...]
289291
[--library <library>] [--model-name-prefix <model name prefix>]
290292
[--model-name-suffix <model name suffix>]
@@ -298,7 +300,7 @@ SYNOPSIS
298300
299301
OPTIONS
300302
-a <authorization>, --auth <authorization>
301-
adds authorization headers when fetching the swagger definitions
303+
adds authorization headers when fetching the OpenAPI definitions
302304
remotely. Pass in a URL-encoded string of name:header with a comma
303305
separating multiple values
304306

Diff for: bin/ada-petstore.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fi
2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
3030
model="modules/openapi-generator/src/test/resources/2_0/petstore.yaml"
31-
ags="generate --template-dir modules/openapi-generator/src/main/resources/Ada -l ada $@"
31+
ags="generate --template-dir modules/openapi-generator/src/main/resources/Ada -g ada $@"
3232
ags="$ags -i $model -t modules/openapi-generator/src/main/resources/Ada -o samples/client/petstore/ada"
3333
ags="$ags -DprojectName=Petstore --model-package Samples.Petstore"
3434

Diff for: bin/akka-scala-petstore.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
ags="generate --artifact-id "scala-akka-petstore-client" -t modules/openapi-generator/src/main/resources/akka-scala -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l scala-akka -o samples/client/petstore/akka-scala $@"
30+
ags="generate --artifact-id "scala-akka-petstore-client" -t modules/openapi-generator/src/main/resources/akka-scala -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g scala-akka -o samples/client/petstore/akka-scala $@"
3131

3232
java $JAVA_OPTS -jar $executable $ags

Diff for: bin/android-petstore-httpclient.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
ags="generate -t modules/openapi-generator/src/main/resources/android -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l android -Dlibrary=httpclient -o samples/client/petstore/android/httpclient $@"
30+
ags="generate -t modules/openapi-generator/src/main/resources/android -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g android -Dlibrary=httpclient -o samples/client/petstore/android/httpclient $@"
3131

3232
java $JAVA_OPTS -jar $executable $ags

Diff for: bin/android-petstore-volley.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l android -c bin/android-petstore-volley.json -o samples/client/petstore/android/volley $@"
30+
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g android -c bin/android-petstore-volley.json -o samples/client/petstore/android/volley $@"
3131

3232
java $JAVA_OPTS -jar $executable $ags

Diff for: bin/apache2-petstore-config.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
ags="generate -l apache2 -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -o samples/config/petstore/apache2 $@"
30+
ags="generate -g apache2 -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -o samples/config/petstore/apache2 $@"
3131

3232
java $JAVA_OPTS -jar $executable $ags

Diff for: bin/apex-petstore.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
ags="generate -t modules/openapi-generator/src/main/resources/apex -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l apex -o samples/client/petstore/apex $@"
30+
ags="generate -t modules/openapi-generator/src/main/resources/apex -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g apex -o samples/client/petstore/apex $@"
3131

3232
java $JAVA_OPTS -jar $executable $ags

Diff for: bin/aspnetcore-petstore-server.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
ags="generate -l aspnetcore -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -o samples/server/petstore/aspnetcore --additional-properties packageGuid={3C799344-F285-4669-8FD5-7ED9B795D5C5} $@"
30+
ags="generate -g aspnetcore -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -o samples/server/petstore/aspnetcore --additional-properties packageGuid={3C799344-F285-4669-8FD5-7ED9B795D5C5} $@"
3131

3232
java $JAVA_OPTS -jar $executable $ags

Diff for: bin/bash-petstore.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
args="generate -t modules/openapi-generator/src/main/resources/bash -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l bash -o samples/client/petstore/bash -c modules/openapi-generator/src/test/resources/2_0/bash-config.json --additional-properties hideGenerationTimestamp=true $@"
30+
args="generate -t modules/openapi-generator/src/main/resources/bash -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g bash -o samples/client/petstore/bash -c modules/openapi-generator/src/test/resources/2_0/bash-config.json --additional-properties hideGenerationTimestamp=true $@"
3131

3232
java $JAVA_OPTS -jar $executable $args

Diff for: bin/clojure-petstore.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.json -l clojure -o samples/client/petstore/clojure $@"
30+
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.json -g clojure -o samples/client/petstore/clojure $@"
3131

3232
java $JAVA_OPTS -jar $executable $ags

Diff for: bin/cpprest-petstore.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
ags="generate -t modules/openapi-generator/src/main/resources/cpprest -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l cpp-restsdk -o samples/client/petstore/cpprest $@"
30+
ags="generate -t modules/openapi-generator/src/main/resources/cpprest -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-restsdk -o samples/client/petstore/cpprest $@"
3131

3232
java $JAVA_OPTS -jar $executable $ags

Diff for: bin/csharp-dotnet2-petstore.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l csharp-dotnet2 -o samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient --additional-properties hideGenerationTimestamp=true $@"
30+
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g csharp-dotnet2 -o samples/client/petstore/csharp-dotnet2/OpenAPIClientTest/Lib/OpenAPIClient --additional-properties hideGenerationTimestamp=true $@"
3131

3232
java $JAVA_OPTS -jar $executable $ags

Diff for: bin/csharp-petstore-net-35.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/OpenAPIClientNet35 --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C} -c ./bin/csharp-petstore-net-35.json $@"
30+
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g csharp -o samples/client/petstore/csharp/OpenAPIClientNet35 --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C} -c ./bin/csharp-petstore-net-35.json $@"
3131

3232
java $JAVA_OPTS -jar $executable $ags

Diff for: bin/csharp-petstore-net-40.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/OpenAPIClientNet40 --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C} -c ./bin/csharp-petstore-net-40.json $@"
30+
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g csharp -o samples/client/petstore/csharp/OpenAPIClientNet40 --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C} -c ./bin/csharp-petstore-net-40.json $@"
3131

3232
java $JAVA_OPTS -jar $executable $ags

Diff for: bin/csharp-petstore-net-standard.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/OpenAPIClientNetStandard --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C} -c ./bin/csharp-petstore-net-standard.json $@"
30+
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g csharp -o samples/client/petstore/csharp/OpenAPIClientNetStandard --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C} -c ./bin/csharp-petstore-net-standard.json $@"
3131

3232
java $JAVA_OPTS -jar $executable $ags

Diff for: bin/csharp-petstore-netcore-project.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/OpenAPIClientNetCoreProject --additional-properties packageGuid={67035b31-f8e5-41a4-9673-954035084f7d},netCoreProjectFile=true -c ./bin/csharp-petstore-net-standard.json $@"
30+
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g csharp -o samples/client/petstore/csharp/OpenAPIClientNetCoreProject --additional-properties packageGuid={67035b31-f8e5-41a4-9673-954035084f7d},netCoreProjectFile=true -c ./bin/csharp-petstore-net-standard.json $@"
3131

3232
java $JAVA_OPTS -jar $executable $ags

Diff for: bin/csharp-petstore.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/OpenAPIClient --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C} $@"
30+
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g csharp -o samples/client/petstore/csharp/OpenAPIClient --additional-properties packageGuid={321C8C3F-0156-40C1-AE42-D59761FB9B6C} $@"
3131

3232
# restore csproj file
3333
echo "restore csproject file: CI/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj"

Diff for: bin/csharp-property-changed-petstore.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged --additional-properties generatePropertyChanged=true --additional-properties packageGuid={5CD900DE-8266-412F-A758-28E1F9C623D5} $@"
30+
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g csharp -o samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged --additional-properties generatePropertyChanged=true --additional-properties packageGuid={5CD900DE-8266-412F-A758-28E1F9C623D5} $@"
3131

3232
java $JAVA_OPTS -jar $executable $ags

Diff for: bin/cwiki-petstore.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l cwiki -o samples/documentation/cwiki $@"
30+
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cwiki -o samples/documentation/cwiki $@"
3131

3232
java $JAVA_OPTS -jar $executable $ags

0 commit comments

Comments
 (0)