-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
65 lines (51 loc) · 2.36 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#
# Copyright 2021-2023 The phy-api-go authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#====================
AUTHOR ?= The sacloud/phy-api-go authors
COPYRIGHT_YEAR ?= 2021-2023
BIN ?= dist/phy-api-go-fake-server
GO_ENTRY_FILE ?= cmd/phy-api-go-fake-server/*.go
BUILD_LDFLAGS ?=
include includes/go/common.mk
include includes/go/single.mk
#====================
default: gen $(DEFAULT_GOALS)
.PHONY: tools
tools: dev-tools
npm install -g @apidevtools/swagger-cli
go install github.com/deepmap/oapi-codegen/cmd/[email protected]
.PHONY: clean-all
clean-all:
find . -type f -name "*_gen.go" -delete
rm apis/v1/spec/original-swagger.yaml
rm apis/v1/spec/swagger.json
.PHONY: gen
gen: _gen fmt goimports set-license
.PHONY: _gen
_gen: apis/v1/spec/original-swagger.yaml apis/v1/spec/swagger.json apis/v1/zz_types_gen.go apis/v1/zz_client_gen.go apis/v1/zz_server_gen.go
go generate ./...
apis/v1/spec/original-swagger.yaml: apis/v1/spec/original-swagger.json
swagger-cli bundle apis/v1/spec/original-swagger.json -o apis/v1/spec/original-swagger.yaml --type yaml
apis/v1/spec/swagger.json: apis/v1/spec/swagger.yaml
swagger-cli bundle apis/v1/spec/swagger.yaml -o apis/v1/spec/swagger.json --type json
apis/v1/zz_types_gen.go: apis/v1/spec/swagger.yaml apis/v1/spec/codegen/types.yaml
oapi-codegen --old-config-style -config apis/v1/spec/codegen/types.yaml apis/v1/spec/swagger.yaml
apis/v1/zz_client_gen.go: apis/v1/spec/swagger.yaml apis/v1/spec/codegen/client.yaml
oapi-codegen --old-config-style -config apis/v1/spec/codegen/client.yaml apis/v1/spec/swagger.yaml
apis/v1/zz_server_gen.go: apis/v1/spec/swagger.yaml apis/v1/spec/codegen/gin.yaml
oapi-codegen --old-config-style -config apis/v1/spec/codegen/gin.yaml apis/v1/spec/swagger.yaml
lint-def:
docker run --rm -v $$PWD:$$PWD -w $$PWD stoplight/spectral:latest lint -F warn apis/v1/spec/swagger.yaml