Skip to content

Commit

Permalink
feat: switch to Apiary for real-time API documentation (pathwar#55)
Browse files Browse the repository at this point in the history
feat: switch to Apiary for real-time API documentation
  • Loading branch information
moul authored Apr 25, 2019
2 parents 2f698de + 4e75607 commit f59a9ad
Show file tree
Hide file tree
Showing 10 changed files with 1,412 additions and 2,008 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ vendor/
*#
.#*

*.swagger.json

/.generated
/.*.generated

Expand Down
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ PWCTL_OUT_FILES = \
./pwctl/out/pwctl-linux-amd64
GENERATED_FILES = \
$(GENERATED_PB_FILES) \
$(PWCTL_OUT_FILES)
$(PWCTL_OUT_FILES) \
swagger.yaml
PROTOC_OPTS = -I/protobuf:vendor:.
RUN_OPTS ?=

Expand Down Expand Up @@ -94,7 +95,7 @@ generate: .proto.generated
touch $@

.PHONY: _generate
_proto_generate: $(GENERATED_PB_FILES)
_proto_generate: $(GENERATED_PB_FILES) swagger.yaml

$(PWCTL_OUT_FILES): $(PWCTL_SOURCES)
mkdir -p ./pwctl/out
Expand All @@ -109,9 +110,16 @@ test: .proto.generated
$(PROTOC_OPTS) \
--grpc-gateway_out=logtostderr=true:"$(GOPATH)/src" \
--gogofaster_out=plugins=grpc:"$(GOPATH)/src" \
--swagger_out=logtostderr=true:. \
"$(dir $<)"/*.proto

swagger.yaml: $(PROTOS)
protoc \
$(PROTOC_OPTS) \
--swagger_out=logtostderr=true:. \
./server/*.proto
cat server/server.swagger.json | json2yaml > swagger.yaml
rm -f server/server.swagger.json

.PHONY: docker.build
docker.build:
docker build -t pathwar/pathwar:latest .
Expand Down
3 changes: 2 additions & 1 deletion build/docker/protoc/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ RUN apk --no-cache add make git go rsync libc-dev openssh docker
RUN go get -u \
github.com/gogo/protobuf/protoc-gen-gogofaster \
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway \
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger \
github.com/simplealpine/json2yaml

FROM golang:1.11-alpine
RUN apk --no-cache add git make protobuf gcc libc-dev && \
Expand Down
Loading

0 comments on commit f59a9ad

Please sign in to comment.