HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

swagger-codegen — Generate code and documentation for your REST api from a OpenAPI/swagger definition. More informatio

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandswagger-codegenandclicodedocumentationforgenerate

Problem

How to use the swagger-codegen command: Generate code and documentation for your REST api from a OpenAPI/swagger definition. More information: <https://github.com/swagger-api/swagger-codegen>.

Solution

swagger-codegen — Generate code and documentation for your REST api from a OpenAPI/swagger definition. More information: <https://github.com/swagger-api/swagger-codegen>.

Generate documentation and code from an OpenAPI/swagger file:
swagger-codegen generate {{[-i|--input-spec]}} {{swagger_file}} {{[-l|--lang]}} {{language}}


Generate Java code using the library retrofit2 and the option useRxJava2:
swagger-codegen generate {{[-i|--input-spec]}} {{http://petstore.swagger.io/v2/swagger.json}} {{[-l|--lang]}} {{java}} --library {{retrofit2}} -D{{useRxJava2}}={{true}}


List available languages:
swagger-codegen langs


Display help for a specific command:
swagger-codegen {{generate|config-help|meta|langs|version}} --help

Code Snippets

Generate documentation and code from an OpenAPI/swagger file

swagger-codegen generate {{[-i|--input-spec]}} {{swagger_file}} {{[-l|--lang]}} {{language}}

Generate Java code using the library retrofit2 and the option useRxJava2

swagger-codegen generate {{[-i|--input-spec]}} {{http://petstore.swagger.io/v2/swagger.json}} {{[-l|--lang]}} {{java}} --library {{retrofit2}} -D{{useRxJava2}}={{true}}

List available languages

swagger-codegen langs

Display help for a specific command

swagger-codegen {{generate|config-help|meta|langs|version}} --help

Context

tldr-pages: common/swagger-codegen

Revisions (0)

No revisions yet.