What Swagger Tool to use?

317 views
Skip to first unread message

nicole.pf...@hs-furtwangen.de

unread,
Mar 20, 2016, 11:15:49 AM3/20/16
to Swagger

I want to use swagger to make a swagger-description and create client and server Code out of it.The aim I have is to expand the swagger description with my own specifications, so I have to expand the Swagger Code Generator. There are alot of Tools and Im not sure which one I should use. As far as I read I have to expand the Tool Swagger-Codegen, but this Tool is in many other Tools integrated( for example SwaggerCore with the Play! framework) so Im not sure which exactly one I should use. The Programming Langugage I want to use is Java or Javascript. Can you give me an advice which Tools/Frameworks are recommendable for this case?

wing328

unread,
Mar 21, 2016, 6:35:50 AM3/21/16
to Swagger
To "expand the swagger description with my own specifications", are you using vendor extensions (https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#vendorExtensions) ?

William

nicole.pf...@hs-furtwangen.de於 2016年3月20日星期日 UTC+8下午11時15分49秒寫道:

da...@unitive.works

unread,
Mar 23, 2016, 9:20:42 PM3/23/16
to Swagger
My project is written in JavaScript with the Express framework. We use an Express add-on from swagger-tools instead of code generation. Swagger-tools parses the HTTP request and compares to swagger.json. It extracts parameters and validates input. Then it dispatches to my handler function based on the url. The handler function is passed the parameters, the handler's response is then validated with swagger.json and sent to the client.

As a programmer, all I do is keep swagger.json correct and follow certain naming conventions for my handlers. So far it's working well for us. I'm not sure what the options are with Java.

cheers,
-Damon

wing328

unread,
Mar 31, 2016, 2:44:06 AM3/31/16
to Swagger
For Java, you can customize with different options:

swagger-codegen|master java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar config-help -l java


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 java.util (Default: false)


useRxJava

    Whether to use the RxJava adapter with the retrofit2 library. (Default: false)


library

    library template (sub-template) to use (Default: <default>)

        <default> - HTTP client: Jersey client 1.18. JSON processing: Jackson 2.4.2

        feign - HTTP client: Netflix Feign 8.1.1

        jersey2 - HTTP client: Jersey client 2.6

        okhttp-gson - HTTP client: OkHttp 2.4.0. JSON processing: Gson 2.3.1

        retrofit - HTTP client: OkHttp 2.4.0. JSON processing: Gson 2.3.1 (Retrofit 1.9.0)

        retrofit2 - HTTP client: OkHttp 2.5.0. JSON processing: Gson 2.4 (Retrofit 2.0.0-beta4). Enable the RxJava adapter using '-DuseRxJava=true'.


dateLibrary

    Option. Date library to use

        joda - Joda

        java8 - Java 8 native



To customize the template, a good starting point is https://github.com/swagger-api/swagger-codegen/tree/master/modules/swagger-codegen/src/main/resources/Java


da...@unitive.works於 2016年3月24日星期四 UTC+8上午9時20分42秒寫道:
Reply all
Reply to author
Forward
0 new messages