Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
1a1d0ae
add beanvalidation to jersey1 and jersey2 #4091
jfiala Jan 3, 2017
dde24eb
update jaxrs jersey1 templates and sample output #4091
jfiala Jan 6, 2017
5b532fd
update language jaxrs (Jersey2) and samples
jfiala Jan 6, 2017
24f4861
add test for options #4091
jfiala Jan 6, 2017
6b17b92
add check for isInteger (integer/decimal)
jfiala Jan 6, 2017
724f03f
update generated sample for spring boot #4091
jfiala Jan 6, 2017
62f0c13
add beanvalidation annotations to spring #4091
jfiala Jan 6, 2017
7c003e5
add tests for spring #4091
jfiala Jan 6, 2017
409e1a5
Fix Gson parsing of Joda DateTime without millis (#4473)
kevinoid Jan 7, 2017
1e8c718
[swift3] allow POST with both body and query parameters (#4490)
tomekc Jan 7, 2017
92bfb0f
cleanup spring-cloud (client lib) #4091
jfiala Jan 7, 2017
94e27d4
update client sample spring-cloud #4091
jfiala Jan 7, 2017
69b1e50
updated version
fehguy Jan 8, 2017
ccf6f02
Merge pull request #4521 from swagger-api/issue-4478
fehguy Jan 8, 2017
81b5b78
Enable support for vendor extensions in CodegenResponse. (#4517)
sreeshas Jan 8, 2017
26ead9b
Issue 4416 (Assist escapeReservedWord with custom mappings) (#4480)
AlexanderN Jan 9, 2017
380bed1
Issue 4244 - Add x-discriminator-value (#4252)
Jan 9, 2017
4d4af71
[CI] Add scripts to detect carriage return and tab (#4526)
wing328 Jan 9, 2017
de5ea8a
[JAX-RS/jersey2] Fix for incorrect JSON field name capitalization (#4…
y-higuchi Jan 10, 2017
c1f854f
Overriden objectmapper wasn't used in deserialisation (Scala) issue #…
lachatak Jan 10, 2017
c998cf6
replace tabs
jfiala Jan 10, 2017
a6b0518
replace tabs
jfiala Jan 10, 2017
d7eeb06
update 2016 to 2017
wing328 Jan 11, 2017
2e4de0c
Remove unnecessary call to setHost() in the constructor (#4525)
toomuchpete Jan 12, 2017
0fb154e
[Bash] Bash client script generator (#4541)
bkryza Jan 12, 2017
9bb58d2
add git tip
wing328 Jan 12, 2017
af43190
When reading mustache template files assume UTF-8 encoding, fixes #45…
eblis Jan 12, 2017
39b76ec
add space before C# in readme
wing328 Jan 12, 2017
d40f7a4
Add triple-mustache to all instances of vendorExtensions.extraAnnotat…
ThatJoeMoore Jan 13, 2017
2e7e258
Issue 4531 (#4539)
RichiWIP Jan 13, 2017
95987fc
Added support for datetime query parameters in cpprest (#4556)
genechang Jan 13, 2017
d7e6a3d
Add a useTags flag to allow tags to be used to generate interface / c…
eamon316 Jan 15, 2017
663b471
[nancyfx/csharp] Customize interface prefix (#4557)
jimschubert Jan 15, 2017
f0cddd2
Swift3 Clener template of client methods (#4552)
tomekc Jan 15, 2017
4001503
PHP server generator ze-ph (Zend Expressive + Path Handler) (#4559)
Articus Jan 15, 2017
2d8715f
Minor update to ze-ph batch script
wing328 Jan 15, 2017
23c5376
[csharp] Fix interfacePrefix sensitivity + default (#4561)
jimschubert Jan 15, 2017
d97b1da
[csharp] Support internal access of generated code (#4560)
jimschubert Jan 15, 2017
0ea506e
Add http://htc-cs.com
wing328 Jan 16, 2017
410f6d7
add Articus as php expressive creator
wing328 Jan 16, 2017
3b3ded0
fix bash test package name (#4566)
wing328 Jan 16, 2017
033a588
add zend expressive
wing328 Jan 16, 2017
691d89a
add link to zend-expressive
wing328 Jan 16, 2017
713e6bb
[html2] Add python and perl examples (#4575)
bshamblen Jan 17, 2017
545ee0c
Moved bash version detection to top and improved logic (#4578)
bkryza Jan 17, 2017
55443da
Extends obj using Object.assign (#4562)
damienpontifex Jan 17, 2017
4c7d133
[csharp] Client nuspec (#4576)
jimschubert Jan 17, 2017
a846a57
add tips about windows class path
wing328 Jan 17, 2017
0a559f0
Add support for modifier within the Jaxb XMLElement annotation (#4433)
danmikita Jan 17, 2017
da01b2e
Add title field to CodegenProperty (#4590)
sreeshas Jan 18, 2017
da6b57f
[aspnetcore] use default in model constructors, supports enums (#4573)
jimschubert Jan 18, 2017
5db75d8
add Webever GmbH
wing328 Jan 18, 2017
c7ecb3c
update https://www.webever.de
wing328 Jan 18, 2017
ee7f9fc
[Jaxrs] Add beanvalidation annotations and fix outer Enums (#4492)
jfiala Jan 19, 2017
1ae60b1
Merge branch 'jaxrs_jersey_beanval2' of https://github.com/jfiala/swa…
wing328 Jan 19, 2017
ccecc2a
new file for jaxrs jersey1
wing328 Jan 19, 2017
a8afaa8
remove /r from templates
wing328 Jan 19, 2017
157fcbc
fix invalid spec, update petstore samples (jaxrs, ruby)
wing328 Jan 19, 2017
3b6ae19
Merge branch 'jfiala-jaxrs_jersey_beanval2'
wing328 Jan 19, 2017
6f4e82d
[Jaxrs-Resteasy] Add beanvalidation annotations (#4506)
jfiala Jan 19, 2017
36c3fa0
Allows for generation of spring controller code using the delegate pa…
JLLeitschuh Jan 19, 2017
ccb3385
Set embedded templates directory when generating Javascript code (#4585)
me717 Jan 19, 2017
e82f3c5
Added support for cURL proxy configuration to PHP client
Jan 19, 2017
d4c96c9
Merge with Upstream
Jan 19, 2017
9a8ede4
update php sample
wing328 Jan 19, 2017
59c189e
Merge branch 'maik-kulbe-feature/php-proxy-support'
wing328 Jan 19, 2017
029728d
[maven-plugin] allow for ignore file override (#4597)
wing328 Jan 19, 2017
a74e751
add beanvalidation annotations to spring #4091
jfiala Jan 6, 2017
65384d5
add tests for spring #4091
jfiala Jan 6, 2017
5934bff
cleanup spring-cloud (client lib) #4091
jfiala Jan 7, 2017
6c58b78
update client sample spring-cloud #4091
jfiala Jan 7, 2017
11c6592
replace tabs
jfiala Jan 10, 2017
277f0c4
Merge branch 'spring_beanval' of https://github.com/jfiala/swagger-co…
jfiala Jan 19, 2017
6d54673
update spring-cloud sample
jfiala Jan 19, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ before_install:
- docker pull swaggerapi/petstore
- docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
- docker ps -a
# Add bats test framework and cURL for Bash script integration tests
- sudo add-apt-repository ppa:duggan/bats --yes
- sudo apt-get update -qq
- sudo apt-get install -qq bats
- sudo apt-get install -qq curl

# show host table to confirm petstore.swagger.io is mapped to localhost
- cat /etc/hosts

Expand All @@ -34,7 +40,15 @@ install:
- export PATH="${TRAVIS_BUILD_DIR}/Godeps/_workspace/bin:$PATH"

script:
# fail fast
- set -e
# fail if templates/generators contain carriage return '\r'
- /bin/bash ./bin/utils/detect_carriage_return.sh
# fail if generators contain tab '\t'
- /bin/bash ./bin/utils/detect_tab_in_java_class.sh
# run integration tests defined in maven pom.xml
- mvn verify -Psamples
# docker test
- if [ $DOCKER_HUB_USERNAME ]; then docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD && docker build -t $DOCKER_IMAGE_NAME ./modules/swagger-generator && if [ ! -z "$TRAVIS_TAG" ]; then docker tag $DOCKER_IMAGE_NAME:latest $DOCKER_IMAGE_NAME:$TRAVIS_TAG; fi && docker push $DOCKER_IMAGE_NAME; fi

env:
Expand Down
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ For a list of variables available in the template, please refer to this [page](h
### Style guide
Code change should conform to the programming style guide of the respective languages:
- Android: https://source.android.com/source/code-style.html
- Bash: https://github.com/bahamas10/bash-style-guide
- C#: https://msdn.microsoft.com/en-us/library/vstudio/ff926074.aspx
- C++: https://google.github.io/styleguide/cppguide.html
- Clojure: https://github.com/bbatsov/clojure-style-guide
Expand Down Expand Up @@ -75,3 +76,5 @@ To start the CI tests, you can run `mvn verify -Psamples` (assuming you've all t
- Document the fix in the code to make the code more readable
- Make sure test cases passed after the change (one way is to leverage https://travis-ci.org/ to run the CI tests)
- File a PR with meaningful title, description and commit messages. A good example is [PR-3306](https://github.com/swagger-api/swagger-codegen/pull/3306)
- Recommended git settings
- `git config --global core.autocrlf input` to tell Git convert CRLF to LF on commit but not the other way around
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
## Overview
This is the swagger codegen project, which allows generation of API client libraries (SDK generation), server stubs and documentation automatically given an [OpenAPI Spec](https://github.com/OAI/OpenAPI-Specification). Currently, the following languages/frameworks are supported:

- **API clients**: **ActionScript**, **C#** (.net 2.0, 4.0 or later), **C++** (cpprest, Qt5, Tizen), **Clojure**, **Dart**, **Go**, **Groovy**, **Haskell**, **Java** (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign), **Node.js** (ES5, ES6, AngularJS with Google Closure Compiler annotations) **Objective-C**, **Perl**, **PHP**, **Python**, **Ruby**, **Scala**, **Swift** (2.x, 3.x), **Typescript** (Angular1.x, Angular2.x, Fetch, Node)
- **Server stubs**: **C#** (ASP.NET Core, NancyFx), **Erlang**, **Go**, **Haskell**, **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, RestEasy), **PHP** (Lumen, Slim, Silex), **Python** (Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Scala** (Scalatra)
- **API clients**: **ActionScript**, **Bash**, **C#** (.net 2.0, 4.0 or later), **C++** (cpprest, Qt5, Tizen), **Clojure**, **Dart**, **Go**, **Groovy**, **Haskell**, **Java** (Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign), **Node.js** (ES5, ES6, AngularJS with Google Closure Compiler annotations) **Objective-C**, **Perl**, **PHP**, **Python**, **Ruby**, **Scala**, **Swift** (2.x, 3.x), **Typescript** (Angular1.x, Angular2.x, Fetch, Node)
- **Server stubs**: **C#** (ASP.NET Core, NancyFx), **Erlang**, **Go**, **Haskell**, **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, RestEasy), **PHP** (Lumen, Slim, Silex, [Zend Expressive](https://github.com/zendframework/zend-expressive)), **Python** (Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Scala** (Scalatra)
- **API documentation generators**: **HTML**, **Confluence Wiki**
- **Others**: **JMeter**

Expand Down Expand Up @@ -289,6 +289,10 @@ OPTIONS
the format of swaggerType=generatedType,swaggerType=generatedType.
For example: array=List,map=Map,string=String

--reserved-words-mappings <import mappings>
specifies how a reserved name should be escaped to. Otherwise, the
default _<name> is used. For example id=identifier

-v, --verbose
verbose mode

Expand Down Expand Up @@ -331,6 +335,10 @@ You would then compile your library in the `output/myLibrary` folder with `mvn p
```
java -cp output/myLibrary/target/myClientCodegen-swagger-codegen-1.0.0.jar:modules/swagger-codegen-cli/target/swagger-codegen-cli.jar io.swagger.codegen.SwaggerCodegen
```
For Windows users, you will need to use `;` instead of `:` in the classpath, e.g.
```
java -cp output/myLibrary/target/myClientCodegen-swagger-codegen-1.0.0.jar;modules/swagger-codegen-cli/target/swagger-codegen-cli.jar io.swagger.codegen.SwaggerCodegen
```

Note the `myClientCodegen` is an option now, and you can use the usual arguments for generating your library:

Expand Down Expand Up @@ -459,6 +467,7 @@ AndroidClientCodegen.java
AspNet5ServerCodegen.java
AspNetCoreServerCodegen.java
AsyncScalaClientCodegen.java
BashClientCodegen.java
CSharpClientCodegen.java
ClojureClientCodegen.java
CsharpDotNet2ClientCodegen.java
Expand Down Expand Up @@ -784,6 +793,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you
- [goTransverse](http://www.gotransverse.com/api)
- [GraphHopper](https://graphhopper.com/)
- [Gravitate Solutions](http://gravitatesolutions.com/)
- [High Technologies Center](http://htc-cs.com)
- [IMS Health](http://www.imshealth.com/en/solution-areas/technology-and-applications)
- [Intent HQ](http://www.intenthq.com)
- [Interactive Intelligence](http://developer.mypurecloud.com/)
Expand Down Expand Up @@ -832,6 +842,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you
- [VMware](https://vmware.com/)
- [W.UP](http://wup.hu/?siteLang=en)
- [Wealthfront](https://www.wealthfront.com/)
- [Webever GmbH](https://www.webever.de/)
- [WEXO A/S](https://www.wexo.dk/)
- [Zalando](https://tech.zalando.com)
- [ZEEF.com](https://zeef.com/)
Expand Down Expand Up @@ -887,6 +898,7 @@ Swagger Codegen core team members are contributors who have been making signific
Here is a list of template creators:
* API Clients:
* Akka-Scala: @cchafer
* Bash: @bkryza
* C++ REST: @Danielku15
* C# (.NET 2.0): @who
* Clojure: @xhh
Expand Down Expand Up @@ -922,6 +934,7 @@ Here is a list of template creators:
* JAX-RS CXF (CDI): @nickcmaynard
* PHP Lumen: @abcsum
* PHP Slim: @jfastnacht
* PHP Zend Expressive (with Path Handler): @Articus
* Ruby on Rails 5: @zlx
* Documentation
* HTML Doc 2: @jhitchcock
Expand Down Expand Up @@ -972,7 +985,7 @@ When code is generated from this project, it shall be considered **AS IS** and o
License
-------

Copyright 2016 SmartBear Software
Copyright 2017 SmartBear Software

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
31 changes: 31 additions & 0 deletions bin/bash-petstore.sh
Original file line number Diff line number Diff line change
@@ -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"
args="$@ generate -t modules/swagger-codegen/src/main/resources/bash -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l bash -o samples/client/petstore/bash -c modules/swagger-codegen/src/test/resources/2_0/bash-config.json"

java $JAVA_OPTS -jar $executable $args
2 changes: 1 addition & 1 deletion bin/nancyfx-petstore-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/nancyfx -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l nancyfx -o samples/server/petstore/nancyfx"
ags="generate $@ -t modules/swagger-codegen/src/main/resources/nancyfx -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l nancyfx -o samples/server/petstore/nancyfx"

java $JAVA_OPTS -jar $executable $ags
2 changes: 2 additions & 0 deletions bin/spring-all-pestore.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/sh

./bin/spring-cloud-feign-petstore.sh
./bin/spring-delegate.sh
./bin/spring-delegate-j8.sh
./bin/spring-stubs.sh
./bin/spring-mvc-petstore-j8-async-server.sh
./bin/springboot-petstore-server.sh
Expand Down
34 changes: 34 additions & 0 deletions bin/spring-delegate-j8.sh
Original file line number Diff line number Diff line change
@@ -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 -t modules/swagger-codegen/src/main/resources/JavaSpring -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l spring -o samples/server/petstore/springboot-delegate-j8 -DdelegatePattern=true,hideGenerationTimestamp=true,java8=true"

echo "Removing files and folders under samples/server/petstore/springboot-delegate-j8/src/main"
rm -rf samples/server/petstore/springboot/src/main
find samples/server/petstore/springboot -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
java $JAVA_OPTS -jar $executable $ags
34 changes: 34 additions & 0 deletions bin/spring-delegate.sh
Original file line number Diff line number Diff line change
@@ -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 -t modules/swagger-codegen/src/main/resources/JavaSpring -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l spring -o samples/server/petstore/springboot-delegate -DdelegatePattern=true,hideGenerationTimestamp=true"

echo "Removing files and folders under samples/server/petstore/springboot-delegate/src/main"
rm -rf samples/server/petstore/springboot/src/main
find samples/server/petstore/springboot -maxdepth 1 -type f ! -name "README.md" -exec rm {} +
java $JAVA_OPTS -jar $executable $ags
18 changes: 18 additions & 0 deletions bin/utils/detect_carriage_return.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# grep for \r in the templates
grep -RUIl $'\r$' modules/swagger-codegen/src/main/resources/*

if [ $? -ne 1 ]; then
echo "Templates contain carriage return '/r'. Please remove it and try again."
exit 1;
fi


# grep for \r in the generators
grep -RUIl $'\r$' modules/swagger-codegen/src/main/java/io/swagger/codegen/*.java

if [ $? -ne 1 ]; then
echo "Generators contain carriage return '/r'. Please remove it and try again."
exit 1;
fi
10 changes: 10 additions & 0 deletions bin/utils/detect_tab_in_java_class.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# grep for \t in the generators
grep -RUIl $'\t$' modules/swagger-codegen/src/main/java/io/swagger/codegen/*.java

if [ $? -ne 1 ]; then
echo "Generators (Java class files) contain tab '/t'. Please remove it and try again."
exit 1;
fi

10 changes: 10 additions & 0 deletions bin/windows/ze-ph-petstore.bat
Original file line number Diff line number Diff line change
@@ -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-with-fake-endpoints-models-for-testing.yaml -l ze-ph -o samples\server\petstore\ze-ph

java %JAVA_OPTS% -jar %executable% %ags%
31 changes: 31 additions & 0 deletions bin/ze-ph-petstore-server.sh
Original file line number Diff line number Diff line change
@@ -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/ze-ph -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l ze-ph -o samples/server/petstore/ze-ph"

java $JAVA_OPTS -jar $executable $ags
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,14 @@ public class Generate implements Runnable {

@Option(name = {"--http-user-agent"}, title = "http user agent", description = CodegenConstants.HTTP_USER_AGENT_DESC)
private String httpUserAgent;

@Option(name = {"--reserved-words-mappings"}, title = "import mappings",
description = "specifies how a reserved name should be escaped to. Otherwise, the default _<name> is used. For example id=identifier")
private String reservedWordsMappings;

@Option(name = {"--ignore-file-override"}, title = "ignore file override location", description = CodegenConstants.IGNORE_FILE_OVERRIDE_DESC)
private String ignoreFileOverride;

@Override
public void run() {

Expand Down Expand Up @@ -211,13 +218,17 @@ public void run() {
configurator.setHttpUserAgent(httpUserAgent);
}

if (isNotEmpty(ignoreFileOverride)) {
configurator.setIgnoreFileOverride(ignoreFileOverride);
}

applySystemPropertiesKvp(systemProperties, configurator);
applyInstantiationTypesKvp(instantiationTypes, configurator);
applyImportMappingsKvp(importMappings, configurator);
applyTypeMappingsKvp(typeMappings, configurator);
applyAdditionalPropertiesKvp(additionalProperties, configurator);
applyLanguageSpecificPrimitivesCsv(languageSpecificPrimitives, configurator);

applyReservedWordsMappingsKvp(reservedWordsMappings, configurator);
final ClientOptInput clientOptInput = configurator.toClientOptInput();

new DefaultGenerator().opts(clientOptInput).generate();
Expand Down
4 changes: 3 additions & 1 deletion modules/swagger-codegen-maven-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ mvn clean compile
- `modelPackage` - the package to use for generated model objects/classes
- `apiPackage` - the package to use for generated api objects/classes
- `invokerPackage` - the package to use for the generated invoker objects
- `modelNamePrefix` and `modelNameSuffix` - Sets the pre- or suffix for model classes and enums.
- `modelNamePrefix` and `modelNameSuffix` - Sets the pre- or suffix for model classes and enums
- `useJaxbAnnotations` - enable Jaxb annotations inside the generated models
- `configOptions` - a map of language-specific parameters (see below)
- `configHelp` - dumps the configuration help for the specified library (generates no sources)
- `ignoreFileOverride` - specifies the full path to a `.swagger-codegen-ignore` used for pattern based overrides of generated outputs

### Custom Generator

Expand Down
Loading