-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgenerate.sh
More file actions
executable file
·32 lines (25 loc) · 1.07 KB
/
generate.sh
File metadata and controls
executable file
·32 lines (25 loc) · 1.07 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
#!/bin/sh
set -eux
OPENAPI_GENERATOR_VERSION=$(cat ./.openapi-generator/VERSION)
# clean
mv README.md README.md.bak
cat ./.openapi-generator/FILES | xargs -r rm -f
# build
docker run --rm -v "${PWD}:/local" -u $(id -u) openapitools/openapi-generator-cli:v$OPENAPI_GENERATOR_VERSION generate \
-i https://raw.githubusercontent.com/traPtitech/traQ/master/docs/v3-api.yaml \
-g go \
-c /local/config.yaml \
-o /local
mv README.md client.md
mv README.md.bak README.md
# improve time format from second to nanosec for traQgazer
# https://github.com/traP-jp/traQ-gazer/issues/138
# changed at https://github.com/traPtitech/go-traq/pull/8
sed -i.bak s/\(time.RFC3339\)/\(time.RFC3339Nano\)/g ./client.go
rm ./client.go.bak
# openapi-generator bug: https://github.com/OpenAPITools/openapi-generator/issues/20749
# Replace default value of time.Time from "0000-01-01T00:00Z" (string) to time.Time (zero value)
find . -name "*.go" -print0 | xargs -0 sed -i -E 's/var\s+defaultValue\s+time\.Time\s*=\s*"0000-01-01T00:00Z"/var defaultValue time.Time/g'
# setup go
go fmt ./...
go mod tidy