-
Notifications
You must be signed in to change notification settings - Fork 196
Expand file tree
/
Copy pathMakefile
More file actions
53 lines (47 loc) · 2 KB
/
Copy pathMakefile
File metadata and controls
53 lines (47 loc) · 2 KB
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
.PHONY: update-openapi check-openapi-updated generate-all-clients generate-public-operations help
# The timestamp ensures all requests are unique and the latest spec is fetched.
OPENAPI_URL := https://drla6sbl8l00t.cloudfront.net/openapi.yaml?timestamp=$(shell date +%s)
OPENAPI_LOCAL := openapi.yaml
OPENAPI_TEMP := openapi.yaml.new
help:
@echo "Available commands:"
@echo " make update-openapi - Download the latest OpenAPI spec from the CDN"
@echo " make check-openapi - Check if a newer OpenAPI spec is available"
@echo " make generate-all-clients - Generate clients for all languages"
@echo " make generate-public-operations - Regenerate the per-language public (unauthenticated) endpoint lookup tables"
generate-all-clients:
@echo "Generating TypeScript client..."
@cd typescript && npm run orval
@echo "Generating Python client..."
@cd python && make python-client
@echo "Generating Rust client..."
@cd rust && make generate && make format
@echo "Generating Go client..."
@cd go && make client
@echo "Generating Java client..."
@cd java && make client
@echo "All clients generated successfully!"
generate-public-operations:
@echo "Generating public (unauthenticated) operation lookup tables..."
@python3 scripts/generate_public_operations.py
update-openapi:
@echo "Downloading latest OpenAPI spec from $(OPENAPI_URL)..."
@curl -s -o $(OPENAPI_TEMP) $(OPENAPI_URL)
@if [ ! -f $(OPENAPI_LOCAL) ] || ! cmp -s $(OPENAPI_TEMP) $(OPENAPI_LOCAL); then \
mv $(OPENAPI_TEMP) $(OPENAPI_LOCAL); \
echo "OpenAPI spec updated successfully."; \
else \
rm $(OPENAPI_TEMP); \
echo "OpenAPI spec is already up to date."; \
fi
check-openapi:
@echo "Checking for OpenAPI updates..."
@curl -s -o $(OPENAPI_TEMP) $(OPENAPI_URL)
@if [ ! -f $(OPENAPI_LOCAL) ] || ! cmp -s $(OPENAPI_TEMP) $(OPENAPI_LOCAL); then \
echo "A newer OpenAPI spec is available. Run 'make update-openapi' to update."; \
rm $(OPENAPI_TEMP); \
else \
echo "OpenAPI spec is up to date."; \
rm $(OPENAPI_TEMP); \
exit 0; \
fi