-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathMakefile
29 lines (20 loc) · 955 Bytes
/
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
GO=GO111MODULE=on go
GOBUILD=$(GO) build
all: build
build:
$(GOBUILD) ./...
clean-generate: remove-generated generate
generate: specs/swagger-stripped-oauth.json
swagger generate client --skip-validation -f $^ -t falcon
.PHONY: build generate remove-generated
remove-generated:
grep -lr falcon -e 'Code generated by go-swagger; DO NOT EDIT.' | xargs rm --
specs/swagger-stripped-oauth.json: specs/swagger-patched.json
# We remove security info from swagger before generating golang API interface.
# This achieves cleaner interface. OAuth is then applied automatically through the middle-ware.
jq 'walk(if type == "object" and has("security") and (has("consumes") or has("produces")) then del(.security) else . end)' $< > $@
specs/swagger-patched.json: specs/swagger.json ./specs/transformation.jq
jq -f ./specs/transformation.jq $< > $@
specs/swagger.json:
@echo "Sorry swagger.json needs to be obtained manually at this moment"
@exit 1