支持的语法
$ java -jar swagger-codegen-cli-2.1.6.jar langs
Available languages: [android, aspnet5, async-scala, csharp, dart, flash, python-flask, go, java, jaxrs, jaxrs-cxf, jaxrs-resteasy, inflector, javascript, javascript-closure-angular, jmeter, nodejs-server, objc, perl, php, python, qt5cpp, ruby, scala, scalatra, silex-PHP, sinatra, slim, spring-mvc, dynamic-html, html, swagger, swagger-yaml, swift, tizen, typescript-angular, typescript-node, akka-scala, CsharpDotNet2, clojure, haskell-servant]
$ java -jar swagger-codegen-cli-2.2.3.jar langs
Available languages: [akka-scala, android, apache2, apex, aspnet5, aspnetcore, async-scala, bash, csharp, clojure, cwiki, cpprest, CsharpDotNet2, dart, elixir, eiffel, erlang-server, finch, flash, python-flask, go, go-server, groovy, haskell, jmeter, jaxrs-cxf-client, jaxrs-cxf, java, inflector, jaxrs-cxf-cdi, jaxrs-spec, jaxrs, msf4j, java-play-framework, jaxrs-resteasy-eap, jaxrs-resteasy, javascript, javascript-closure-angular, java-vertx, kotlin, lumen, nancyfx, nodejs-server, objc, perl, php, php-symfony, powershell, pistache-server, python, qt5cpp, rails5, restbed, ruby, scala, scalatra, silex-PHP, sinatra, slim, spring, dynamic-html, html2, html, swagger, swagger-yaml, swift4, swift3, swift, tizen, typescript-angular2, typescript-angular, typescript-fetch, typescript-jquery, typescript-node, undertow, ze-ph]
swagger-codegen 2.2.3相较2.1.5而言,多了35种语言支持。此外我最关心的sping-mvc也换成Spring,增加了对Spring Boot和Spring Cloud的支持。
swagger-codegen 2.1.5 | swagger-codegen 2.2.3 |
---|---|
akka-scala | akka-scala |
android | android |
apache2 | |
apex | |
aspnet5 | aspnet5 |
aspnetcore | |
async-scala | async-scala |
csharp | bash |
csharp | |
clojure | clojure |
cwiki | |
cpprest | |
CsharpDotNet2 | CsharpDotNet2 |
dart | dart |
elixir | |
eiffel | |
erlang-server | |
finch | |
flash | flash |
python-flask | python-flask |
go | go |
go-server | |
groovy | |
haskell-servant | haskell |
jmeter | jmeter |
jaxrs-cxf-client | |
jaxrs-cxf | jaxrs-cxf |
java | java |
inflector | inflector |
jaxrs-cxf-cdi | |
jaxrs-spec | |
jaxrs | jaxrs |
msf4j | |
java-play-framework | |
jaxrs-resteasy-eap | |
jaxrs-resteasy | jaxrs-resteasy |
javascript | javascript |
javascript-closure-angular | javascript-closure-angular |
java-vertx | |
kotlin | |
lumen | |
nancyfx | |
nodejs-server | nodejs-server |
objc | objc |
perl | perl |
php | php |
php-symfony | |
powershell | |
pistache-server | |
python | python |
qt5cpp | qt5cpp |
rails5 | |
restbed | |
ruby | ruby |
scala | scala |
scalatra | scalatra |
silex-PHP | silex-PHP |
sinatra | sinatra |
slim | slim |
spring-mvc | spring |
dynamic-html | dynamic-html |
html2 | |
html | html |
swagger | swagger |
swagger-yaml | swagger-yaml |
swift4 | |
swift3 | |
swift | swift |
tizen | tizen |
typescript-angular2 | |
typescript-angular | typescript-angular |
typescript-fetch | |
typescript-jquery | |
typescript-node | typescript-node |
undertow | |
ze-ph |
Spring配置
$ java -jar swagger-codegen-cli-2.1.5.jar config-help -l spring-mvc
CONFIG OPTIONS
sortParamsByRequiredFlag
Sort method arguments to place required parameters before optional parameters. (Default: true)
ensureUniqueParams
Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true)
modelPackage
package for generated models
apiPackage
package for generated api classes
invokerPackage
root package for generated code
groupId
groupId in generated pom.xml
artifactId
artifactId in generated pom.xml
artifactVersion
artifact version in generated pom.xml
sourceFolder
source folder for generated code
localVariablePrefix
prefix for generated code members and local variables
serializableModel
boolean - toggle "implements Serializable" for generated models (Default: false)
bigDecimalAsString
Treat BigDecimal values as Strings to avoid precision loss. (Default: false)
fullJavaUtil
whether to use fully qualified name for classes under
library
library template (sub-template) to use (Default: )
- Default Spring MVC server stub.
j8-async - Use async servlet feature and Java 8's default interface. Generating interface with service declaration is useful when using Maven plugin. Just provide a implementation with @Controller to instantiate service.
configPackage
configuration package for generated code
$ java -jar swagger-codegen-cli-2.2.3.jar config-help -l spring
CONFIG OPTIONS
sortParamsByRequiredFlag
Sort method arguments to place required parameters before optional parameters. (Default: true)
ensureUniqueParams
Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true)
allowUnicodeIdentifiers
boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false)
modelPackage
package for generated models
apiPackage
package for generated api classes
invokerPackage
root package for generated code
groupId
groupId in generated pom.xml
artifactId
artifactId in generated pom.xml
artifactVersion
artifact version in generated pom.xml
artifactUrl
artifact URL in generated pom.xml
artifactDescription
artifact description in generated pom.xml
scmConnection
SCM connection in generated pom.xml
scmDeveloperConnection
SCM developer connection in generated pom.xml
scmUrl
SCM URL in generated pom.xml
developerName
developer name in generated pom.xml
developerEmail
developer email in generated pom.xml
developerOrganization
developer organization in generated pom.xml
developerOrganizationUrl
developer organization URL in generated pom.xml
licenseName
The name of the license
licenseUrl
The URL of the license
sourceFolder
source folder for generated code
localVariablePrefix
prefix for generated code members and local variables
serializableModel
boolean - toggle "implements Serializable" for generated models (Default: false)
bigDecimalAsString
Treat BigDecimal values as Strings to avoid precision loss. (Default: false)
fullJavaUtil
whether to use fully qualified name for classes under
hideGenerationTimestamp
hides the timestamp when files were generated
withXml
whether to include support for application/xml content type. This option only works for
dateLibrary
Option. Date library to use
joda - Joda
legacy - Legacy java.util.Date
java8 - Java 8 native - note: this also sets "java8" to true
java8
Option. Use Java8 classes instead of third party equivalents
true - Use Java 8 classes such as Base64
false - Various third party libraries as needed
title
server title name or client service name
configPackage
configuration package for generated code
basePackage
base package for generated code
interfaceOnly
Whether to generate only API interface stubs without the server files. (Default: false)
delegatePattern
Whether to generate the server files using the delegate pattern (Default: false)
singleContentTypes
Whether to select only one produces/consumes content-type by operation. (Default: false)
java8
use
async
use async Callable controllers (Default: false)
responseWrapper
wrap the responses in given type (Future,Callable,CompletableFuture,ListenableFuture,DeferredResult,HystrixCommand,RxObservable,RxSingle or fully qualified type)
useTags
use tags for creating interface and controller classnames (Default: false)
useBeanValidation
Use BeanValidation API annotations (Default: false)
implicitHeaders
Use of @ApiImplicitParams for headers. (Default: false)
useOptional
Use Optional container for optional parameters (Default: false)
library
library template (sub-template) to use (Default: spring-boot)
spring-boot - Spring-boot Server application using the SpringFox integration.
spring-mvc - Spring-MVC Server application using the SpringFox integration.
spring-cloud - Spring-Cloud-Feign client with Spring-Boot auto-configured settings.
对于Spring程序,swagger-codegen 2.2.3相较2.1.5而言增加了28项配置。
swagger-codegen 2.1.5 | swagger-codegen 2.2.3 |
---|---|
sortParamsByRequiredFlag | sortParamsByRequiredFlag |
ensureUniqueParams | ensureUniqueParams |
allowUnicodeIdentifiers | |
modelPackage | modelPackage |
apiPackage | apiPackage |
invokerPackage | invokerPackage |
groupId | groupId |
artifactId | artifactId |
artifactVersion | artifactVersion |
artifactUrl | |
artifactDescription | |
scmConnection | |
scmDeveloperConnection | |
scmUrl | |
developerName | |
developerEmail | |
developerOrganization | |
developerOrganizationUrl | |
licenseName | |
licenseUrl | |
sourceFolder | sourceFolder |
localVariablePrefix | localVariablePrefix |
serializableModel | serializableModel |
bigDecimalAsString | bigDecimalAsString |
fullJavaUtil | fullJavaUtil |
hideGenerationTimestamp | |
withXml | |
dateLibrary | |
java8 | |
title | |
configPackage | configPackage |
basePackage | |
interfaceOnly | |
delegatePattern | |
singleContentTypes | |
java8 | |
async | |
responseWrapper | |
useTags | |
useBeanValidation | |
implicitHeaders | |
useOptional | |
library | library |