Use swag for generate API specification:
swag init --generalInfo ./pkg/api/server.go \
&& mv ./docs/swagger.json ./openapi.json \
&& rm -r ./docs
Specification file ./openapi.json will be generated.
Autogenerated OpenAPI specification can be explored with SwaggerUI. The easiest way is running Swagger locally with opening specification by URL:
docker run -p 8080:8080 \
-e URL=http://docker.for.mac.localhost:8088/openapi.json \
swaggerapi/swagger-ui
or using specification from the local file:
docker run -p 8080:8080 \
-e URL=http://localhost:8088/ \
-e SWAGGER_JSON=/src/openapi.json \
-v `pwd`:/src \
swaggerapi/swagger-ui
SwaggerUI will available on http://localhost:8080/
docker-compose up
Start cloud locally with UI on http://localhost:8080/:
docker-compose -f dev-docker-compose.yml up
and
go run -v main.go
Note: change in-docker localhost in dev-nginx-proxy.conf, current host docker.for.mac.localhost works only on macOS.
Content type
Image
Digest
sha256:6d47b0690…
Size
84.9 MB
Last updated
about 2 years ago
docker pull kuberlab/flex-data-api