Skip to content

tools and working notes on using swagger tools to document validate and generate goLang code from spec

Notifications You must be signed in to change notification settings

Yuhang-Zhao-Bose/go-swagger-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Go Swagger Tools

Swagger Editor

Swagger Editor

To run it in local environment:

docker pull swaggerapi/swagger-editor

docker run -d -p 80:8080 swaggerapi/swagger-editor

open a browser, and point to 127.0.0.1 to start using editor

Change 80 to something else if there is port conflict.

Notes

Do not use built-in code generation tool to generate goLang code from the spec. The code generator comes with the editor is based on swagger-codegen project, which is deprecated. Use the tool specified in the next section.

Go-Swagger

go-swagger To run it in local environment:

docker pull quay.io/goswagger/swagger

Add the following line to ~/.bash_profile, then source ~/.bash_profile

alias swagger="docker run --rm -it -e GOPATH=$GOPATH:/go -v $GOPATH:$GOPATH -w $(pwd) quay.io/goswagger/swagger" swagger version

To generate server code from swagger spec:

Use editor to compose an api spec in Yaml, then save as json, e.g., test1.json.

cd to where json file is saved

swagger generate server -f ./test1.json

Openapi-Generater

TODO: https://github.com/OpenAPITools/openapi-generator

About

tools and working notes on using swagger tools to document validate and generate goLang code from spec

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published