-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
44 lines (37 loc) · 1.16 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
.PHONY: setup
setup:
go install github.com/cosmtrek/air@latest
go install github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen@latest
go install github.com/ogen-go/ogen/cmd/ogen@latest
go mod tidy
.PHONY: generate-oapi-codegen
generate-oapi-codegen:
mkdir -p oapi_codegen/generated/
oapi-codegen -generate types -package generated openapi.yml > oapi_codegen/generated/model_gen.go
oapi-codegen -generate server -package generated openapi.yml > oapi_codegen/generated/api_server_gen.go
oapi-codegen -generate client -package generated openapi.yml > oapi_codegen/generated/api_client_gen.go
.PHONY: generate-openapi-generator
generate-openapi-generator:
mkdir -p openapi_generator/generated/
docker run --rm \
-v ${PWD}:/app openapitools/openapi-generator-cli generate \
-i /app/openapi.yml \
-g go \
-o /app/openapi_generator/generated
.PHONY: generate-ogen
generate-ogen:
mkdir -p ogen/generated/
cd ogen
go generate ./...
.PHONY: generate
generate: generate-oapi-codegen generate-openapi-generator
.PHONY: run
run: setup
air
.PHONY: up
up: setup
docker compose up -d
.PHONY: reset
reset:
docker compose down -v
docker rmi golang_openapi_playground-app