2021-03-11 13:28:00 -06:00
|
|
|
.DEFAULT_GOAL := all
|
|
|
|
|
2021-04-20 12:12:32 -05:00
|
|
|
GENERATED_GO_MATCHERS = ./go/*.go
|
|
|
|
|
2021-03-11 13:28:00 -06:00
|
|
|
swagger-codegen-api:
|
2021-04-20 12:12:32 -05:00
|
|
|
docker run --rm -v $$(pwd):/local --user $$(id -u):$$(id -g) swaggerapi/swagger-codegen-cli generate \
|
|
|
|
-i /local/tooling/post.json \
|
2021-03-11 13:28:00 -06:00
|
|
|
-l go-server \
|
|
|
|
-Dapis \
|
2021-04-20 12:12:32 -05:00
|
|
|
-o /local \
|
2021-03-11 13:28:00 -06:00
|
|
|
--additional-properties packageName=api \
|
2021-04-20 12:12:32 -05:00
|
|
|
-t /local/tooling/swagger-codegen/templates \
|
2021-03-11 13:28:00 -06:00
|
|
|
# --import-mappings eval.RelativeTimeRange="github.com/grafana/grafana/pkg/services/ngalert/eval" \
|
|
|
|
# --type-mappings RelativeTimeRange=eval.RelativeTimeRange
|
|
|
|
|
|
|
|
copy-files:
|
2021-04-20 12:12:32 -05:00
|
|
|
ls -1 go | xargs -n 1 -I {} mv go/{} generated_base_{}
|
2021-03-11 13:28:00 -06:00
|
|
|
|
|
|
|
fix:
|
2021-04-20 12:12:32 -05:00
|
|
|
sed -i -e 's/apimodels\.\[\]PostableAlert/apimodels.PostableAlerts/' $(GENERATED_GO_MATCHERS)
|
|
|
|
sed -i -e 's/apimodels\.\[\]UpdateDashboardAclCommand/apimodels.Permissions/' $(GENERATED_GO_MATCHERS)
|
2021-09-10 04:46:02 -05:00
|
|
|
sed -i -e 's/apimodels\.\[\]PostableApiReceiver/apimodels.TestReceiversConfigParams/' $(GENERATED_GO_MATCHERS)
|
2021-04-20 12:12:32 -05:00
|
|
|
goimports -w -v $(GENERATED_GO_MATCHERS)
|
2021-03-11 13:28:00 -06:00
|
|
|
|
|
|
|
clean:
|
2021-04-20 12:12:32 -05:00
|
|
|
rm -rf ./go
|
2021-03-11 13:28:00 -06:00
|
|
|
|
2021-04-09 04:55:41 -05:00
|
|
|
all: swagger-codegen-api fix copy-files clean
|