Skip to content

Commit 794e7e4

Browse files
author
Mikołaj Przybysz
committed
Merge pull request #3 from swagger-api/master
Update
2 parents e687ad5 + 4f9b43b commit 794e7e4

File tree

754 files changed

+16249
-3031
lines changed

Some content is hidden

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

754 files changed

+16249
-3031
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ samples/client/petstore/swift/SwaggerClientTests/Pods/Pods.xcodeproj/xcshareddat
8989

9090
# C#
9191
*.csproj.user
92+
samples/client/petstore/csharp/SwaggerClient/IO.Swagger.userprefs
9293
samples/client/petstore/csharp/SwaggerClientTest/.vs
9394
samples/client/petstore/csharp/SwaggerClientTest/obj
9495
samples/client/petstore/csharp/SwaggerClientTest/bin

README.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
6969

7070
Swagger Codegen Version | Release Date | OpenAPI Spec compatibility | Notes
7171
-------------------------- | ------------ | -------------------------- | -----
72-
2.1.7-SNAPSHOT | | 1.0, 1.1, 1.2, 2.0 | [master](https://github.com/swagger-api/swagger-codegen)
72+
2.2.0-SNAPSHOT | | 1.0, 1.1, 1.2, 2.0 | [master](https://github.com/swagger-api/swagger-codegen)
7373
2.1.6 (**current stable**) | 2016-04-06 | 1.0, 1.1, 1.2, 2.0 | [tag v2.1.6](https://github.com/swagger-api/swagger-codegen/tree/v2.1.6)
7474
2.0.17 | 2014-08-22 | 1.1, 1.2 | [tag v2.0.17](https://github.com/swagger-api/swagger-codegen/tree/v2.0.17)
7575
1.0.4 | 2012-04-12 | 1.0, 1.1 | [tag v1.0.4](https://github.com/swagger-api/swagger-codegen/tree/swagger-codegen_2.9.1-1.1)
@@ -408,6 +408,44 @@ java -Dapis -DmodelTests=false {opts}
408408

409409
When using selective generation, _only_ the templates needed for the specific generation will be used.
410410

411+
### Ignore file format
412+
413+
Swagger codegen supports a `.swagger-codegen-ignore` file, similar to `.gitignore` or `.dockerignore` you're probably already familiar with.
414+
415+
The ignore file allows for better control over overwriting existing files than the `--skip-overwrite` flag. With the ignore file, you can specify individual files or directories can be ignored. This can be useful, for example if you only want a subset of the generated code.
416+
417+
Examples:
418+
419+
```
420+
# Swagger Codegen Ignore
421+
# Lines beginning with a # are comments
422+
423+
# This should match build.sh located anywhere.
424+
build.sh
425+
426+
# Matches build.sh in the root
427+
/build.sh
428+
429+
# Exclude all recursively
430+
docs/**
431+
432+
# Explicitly allow files excluded by other rules
433+
!docs/UserApi.md
434+
435+
# Recursively exclude directories named Api
436+
# You can't negate files below this directory.
437+
src/**/Api/
438+
439+
# When this file is nested under /Api (excluded above),
440+
# this rule is ignored because parent directory is excluded by previous rule.
441+
!src/**/PetApiTests.cs
442+
443+
# Exclude a single, nested file explicitly
444+
src/IO.Swagger.Test/Model/AnimalFarmTests.cs
445+
```
446+
447+
The `.swagger-codegen-ignore` file must exist in the root of the output directory.
448+
411449
### Customizing the generator
412450

413451
There are different aspects of customizing the code generator beyond just creating or modifying templates. Each language has a supporting configuration file to handle different type mappings, etc:
@@ -814,6 +852,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you
814852
- [Cachet Financial](http://www.cachetfinancial.com/)
815853
- [CloudBoost](https://www.CloudBoost.io/)
816854
- [Cupix](http://www.cupix.com)
855+
- [DBBest Technologies](https://www.dbbest.com)
817856
- [DocuSign](https://www.docusign.com)
818857
- [Ergon](http://www.ergon.ch/)
819858
- [eureka](http://eure.jp/)
@@ -824,6 +863,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you
824863
- [Interactive Intelligence](http://developer.mypurecloud.com/)
825864
- [LANDR Audio](https://www.landr.com/)
826865
- [LiveAgent](https://www.ladesk.com/)
866+
- [Kabuku](http://www.kabuku.co.jp/en)
827867
- [Kuary](https://kuary.com/)
828868
- [nViso](http://www.nviso.ch/)
829869
- [Okiok](https://www.okiok.com)
@@ -836,6 +876,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you
836876
- [REstore](https://www.restore.eu)
837877
- [Revault Sàrl](http://revault.ch)
838878
- [Royal Bank of Canada (RBC)](http://www.rbc.com/canada.html)
879+
- [SCOOP Software GmbH](http://www.scoop-software.de)
839880
- [SmartRecruiters](https://www.smartrecruiters.com/)
840881
- [StyleRecipe](http://stylerecipe.co.jp)
841882
- [Svenska Spel AB](https://www.svenskaspel.se/)

bin/objc-petstore.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ fi
2626

2727
# if you've executed sbt assembly previously it will use that instead.
2828
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
29-
ags="$@ generate -t modules/swagger-codegen/src/main/resources/objc -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l objc -o samples/client/petstore/objc"
29+
ags="$@ generate -t modules/swagger-codegen/src/main/resources/objc -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l objc -o samples/client/petstore/objc --additional-properties coreData=true"
3030

3131
java -DappName=PetstoreClient $JAVA_OPTS -jar $executable $ags

bin/swift-petstore-promisekit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ fi
2626

2727
# if you've executed sbt assembly previously it will use that instead.
2828
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
29-
ags="$@ generate -t modules/swagger-codegen/src/main/resources/swift -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l swift -c ./bin/swift-petstore-promisekit.json -o samples/client/petstore/swift-promisekit"
29+
ags="$@ generate -t modules/swagger-codegen/src/main/resources/swift -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l swift -c ./bin/swift-petstore-promisekit.json -o samples/client/petstore/swift/promisekit"
3030

3131
java $JAVA_OPTS -jar $executable $ags

bin/swift-petstore.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ fi
2626

2727
# if you've executed sbt assembly previously it will use that instead.
2828
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
29-
ags="$@ generate -t modules/swagger-codegen/src/main/resources/swift -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l swift -c ./bin/swift-petstore.json -o samples/client/petstore/swift"
29+
ags="$@ generate -t modules/swagger-codegen/src/main/resources/swift -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l swift -c ./bin/swift-petstore.json -o samples/client/petstore/swift/default"
3030

3131
java $JAVA_OPTS -jar $executable $ags

modules/swagger-codegen-cli/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>io.swagger</groupId>
55
<artifactId>swagger-codegen-project</artifactId>
6-
<version>2.1.6</version>
6+
<version>2.2.0-SNAPSHOT</version>
77
<relativePath>../..</relativePath>
88
</parent>
99
<modelVersion>4.0.0</modelVersion>
@@ -100,4 +100,4 @@
100100
</dependency>
101101
</dependencies>
102102

103-
</project>
103+
</project>

modules/swagger-codegen-maven-plugin/README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,44 @@ mvn clean compile
4848
- `configOptions` - a map of language-specific parameters (see below)
4949
- `configHelp` - dumps the configuration help for the specified library (generates no sources)
5050

51+
### Custom Generator
52+
53+
Specifying a custom generator is a bit different. It doesn't support the classpath:/ syntax, but it does support the fully qualified name of the package. You can also specify your custom templates, which also get pulled in. Notice the dependency on a project, in the plugin scope. That would be your generator/template jar.
54+
55+
```xml
56+
<plugin>
57+
<groupId>io.swagger</groupId>
58+
<artifactId>swagger-codegen-maven-plugin</artifactId>
59+
<version>${swagger-codegen-maven-plugin-version}</version>
60+
<executions>
61+
<execution>
62+
<goals>
63+
<goal>generate</goal>
64+
</goals>
65+
<configuration>
66+
<inputSpec>src/main/resources/yaml/yamlfilename.yaml</inputSpec>
67+
<!-- language file, like e.g. JavaJaxRSCodegen shipped with swagger -->
68+
<language>com.my.package.for.GeneratorLanguage</language>
69+
<templateDirectory>myTemplateDir</templateDirectory>
70+
71+
<output>${project.build.directory}/generated-sources</output>
72+
<apiPackage>${default.package}.handler</apiPackage>
73+
<modelPackage>${default.package}.model</modelPackage>
74+
<invokerPackage>${default.package}.handler</invokerPackage>
75+
</configuration>
76+
</execution>
77+
</executions>
78+
79+
<dependencies>
80+
<dependency>
81+
<groupId>com.my.generator</groupId>
82+
<artifactId>customgenerator</artifactId>
83+
<version>1.0-SNAPSHOT</version>
84+
</dependency>
85+
</dependencies>
86+
</plugin>
87+
```
88+
5189
### Sample configuration
5290

53-
- Please see [an example configuration](examples) for using the plugin
91+
- Please see [an example configuration](examples) for using the plugin

modules/swagger-codegen-maven-plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.swagger</groupId>
88
<artifactId>swagger-codegen-project</artifactId>
9-
<version>2.1.6</version>
9+
<version>2.2.0-SNAPSHOT</version>
1010
<relativePath>../..</relativePath>
1111
</parent>
1212
<artifactId>swagger-codegen-maven-plugin</artifactId>

modules/swagger-codegen/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>io.swagger</groupId>
55
<artifactId>swagger-codegen-project</artifactId>
6-
<version>2.1.6</version>
6+
<version>2.2.0-SNAPSHOT</version>
77
<relativePath>../..</relativePath>
88
</parent>
99
<modelVersion>4.0.0</modelVersion>

modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,8 @@ public DefaultCodegen() {
792792
importMapping.put("LocalDate", "org.joda.time.*");
793793
importMapping.put("LocalTime", "org.joda.time.*");
794794

795+
supportingFiles.add(new GlobalSupportingFile("LICENSE", "LICENSE"));
796+
795797
cliOptions.add(CliOption.newBoolean(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG,
796798
CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG_DESC).defaultValue(Boolean.TRUE.toString()));
797799
cliOptions.add(CliOption.newBoolean(CodegenConstants.ENSURE_UNIQUE_PARAMS, CodegenConstants

0 commit comments

Comments
 (0)