-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
38 lines (31 loc) · 1.18 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
PROTO_FILES = $(shell find ./proto/schema -name "*.proto" -type f)
.PHONY: build clean new fmt setup-mac setup-linux build-openapi
build:
$(MAKE) build-openapi
clean:
rm -rf openapi
mkdir openapi
build-openapi:
rm -rf openapi
mkdir openapi
protoc -I . --openapiv2_out openapi --openapiv2_opt logtostderr=true \
--openapiv2_opt disable_default_errors=true \
--openapiv2_opt allow_merge=true \
--openapiv2_opt output_format=yaml \
--openapiv2_opt merge_file_name="api_definition.yml" $(PROTO_FILES) \
--openapiv2_opt allow_delete_body=true \
--openapiv2_opt json_names_for_fields=false
new:
npx scaffdog generate service --output ./proto/schema
fmt:
find ./proto/ -name "*.proto" | xargs clang-format -i
setup-mac:
brew install protobuf
go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
go install github.com/golang/protobuf/protoc-gen-go
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2
setup-linux:
apt install -y protobuf-compiler
go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
go install github.com/golang/protobuf/protoc-gen-go
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2