-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
92 lines (78 loc) · 3.14 KB
/
Makefile
File metadata and controls
92 lines (78 loc) · 3.14 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# merge the current branch to main and push
merge_main:
# get the name of the current branch
$(eval BRANCH := $(shell git branch --show-current))
# merge the current branch to main
git checkout main
git merge $(BRANCH)
git push
check_uncommitted:
@if git diff-index --quiet HEAD --; then \
echo '\033[32mNo uncommitted changes found.\033[0m'; \
else \
echo '\033[31mUncommitted changes detected. Aborting.\033[0m'; \
exit 1; \
fi
# Run the formatters manually
format: check_uncommitted
# run the formatters
# nicklockwood/SwiftFormat
swiftformat --config .swiftformat --swiftversion 5.7 .
# apple/swift-format
swift-format . -i -p --ignore-unparsable-files -r --configuration .swift-format
# commit
git add .
git commit -m "Format code"
# spm clean cache
clean_spm_cache:
swift package purge-cache
download-openapi:
# Download the openapi.yaml file from remote repo as original.yaml file
curl -o original.yaml https://app.stainless.com/api/spec/documented/openai/openapi.documented.yml
# Create a copy of original.yaml as openapi.yaml
cp original.yaml openapi.yaml
# Replace 9223372036854776000 with 922337203685477600
sed -i '' 's/9223372036854776000/922337203685477600/g' ./openapi.yaml
cleanup-anyof-nulls:
# Run the cleanup script to remove null types from anyOf arrays
cd scripts && node cleanup-anyof-nulls.js ../openapi.yaml ../openapi.yaml
const-to-enum:
# Run the cleanup script to remove null types from anyOf arrays
cd scripts && node const-to-enum.js ../openapi.yaml ../openapi.yaml
format-byte-to-content-encoding:
# Format byte to contentEncoding where applicable
cd scripts && node format-byte-to-content-encoding.js ../openapi.yaml ../openapi.yaml
replace-anyof-with-oneof:
# Replace `anyOf:` with `oneOf:`
sed -i '' 's/anyOf:/oneOf:/g' ./openapi.yaml
fix-nullable-from-v310:
cd scripts && node fix-nullable-from-v310.js ../openapi.yaml ../openapi.yaml
removed-nonexistent-required-properties:
cd scripts && node removed-nonexistent-required-properties.js ../openapi.yaml ../openapi.yaml
overlay-openapi:
node scripts/generate_overlay_for_multipart_required.js ../openapi.yaml
openapi-format --no-sort ./openapi.yaml --overlayFile scripts/overlay.json -o ./openapi.yaml
openapi-format --no-sort ./openapi.yaml --overlayFile scripts/overlay_generated_for_multipart_required.yaml -o ./openapi.yaml
generate-openapi:
swift run swift-openapi-generator generate \
--output-directory Sources/OpenAIAsyncHTTPClient/GeneratedSources \
--config ./openapi-generator-config-client.yaml \
./openapi.yaml
swift run swift-openapi-generator generate \
--output-directory Sources/OpenAIUrlSessionClient/GeneratedSources \
--config ./openapi-generator-config-client.yaml \
./openapi.yaml
swift run swift-openapi-generator generate \
--output-directory Sources/SwiftOpenAITypes/GeneratedSources \
--config ./openapi-generator-config-types.yaml \
./openapi.yaml
prepare-openapi:
make download-openapi
make cleanup-anyof-nulls
make replace-anyof-with-oneof
make const-to-enum
make format-byte-to-content-encoding
make fix-nullable-from-v310
make removed-nonexistent-required-properties
make overlay-openapi
make generate-openapi