Skip to content

Commit f641ab6

Browse files
committed
chore: add enum list generation
1 parent d87ff4b commit f641ab6

File tree

8 files changed

+646
-73
lines changed

8 files changed

+646
-73
lines changed

scripts/apitypings/README.md

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,3 @@
22

33
This main.go generates typescript types from the codersdk types in Go.
44

5-
# Features
6-
7-
- Supports Go types
8-
- [x] Basics (string/int/etc)
9-
- [x] Maps
10-
- [x] Slices
11-
- [x] Enums
12-
- [x] Pointers
13-
- [ ] External Types (uses `any` atm)
14-
- Some custom external types are hardcoded in (eg: time.Time)
15-
16-
## Type overrides
17-
18-
```golang
19-
type Foo struct {
20-
// Force the typescript type to be a number
21-
CreatedAt time.Duration `json:"created_at" typescript:"number"`
22-
}
23-
```
24-
25-
## Ignore Types
26-
27-
Do not generate ignored types.
28-
29-
```golang
30-
// @typescript-ignore InternalType
31-
type InternalType struct {
32-
// ...
33-
}
34-
```
35-
36-
# Future Ideas
37-
38-
- Use a yaml config for overriding certain types

scripts/apitypings/go.mod

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
module github.com/coder/coder/scripts/apitypings
2+
3+
go 1.23.0
4+
5+
toolchain go1.23.3
6+
7+
require (
8+
github.com/coder/gots v0.0.0-20241126221454-18fbabbd18c5
9+
github.com/stretchr/testify v1.10.0
10+
)
11+
12+
require (
13+
cdr.dev/slog v1.6.2-0.20241112041820-0ec81e6e67bb // indirect
14+
github.com/DataDog/appsec-internal-go v1.8.0 // indirect
15+
github.com/DataDog/datadog-agent/pkg/obfuscate v0.48.0 // indirect
16+
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.57.0 // indirect
17+
github.com/DataDog/datadog-go/v5 v5.3.0 // indirect
18+
github.com/DataDog/go-libddwaf/v3 v3.4.0 // indirect
19+
github.com/DataDog/go-tuf v1.1.0-0.5.2 // indirect
20+
github.com/DataDog/gostackparse v0.7.0 // indirect
21+
github.com/DataDog/sketches-go v1.4.5 // indirect
22+
github.com/Microsoft/go-winio v0.6.2 // indirect
23+
github.com/agext/levenshtein v1.2.3 // indirect
24+
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
25+
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
26+
github.com/beorn7/perks v1.0.1 // indirect
27+
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
28+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
29+
github.com/coder/coder/v2 v2.17.2 // indirect
30+
github.com/coder/pretty v0.0.0-20230908205945-e89ba86370e0 // indirect
31+
github.com/coder/serpent v0.10.0 // indirect
32+
github.com/coder/terraform-provider-coder v1.0.2 // indirect
33+
github.com/coreos/go-oidc/v3 v3.11.0 // indirect
34+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
35+
github.com/dlclark/regexp2 v1.11.4 // indirect
36+
github.com/dop251/goja v0.0.0-20241024094426-79f3a7efcdbd // indirect
37+
github.com/dustin/go-humanize v1.0.1 // indirect
38+
github.com/eapache/queue/v2 v2.0.0-20230407133247-75960ed334e4 // indirect
39+
github.com/ebitengine/purego v0.6.0-alpha.5 // indirect
40+
github.com/fatih/color v1.18.0 // indirect
41+
github.com/fatih/structtag v1.2.0 // indirect
42+
github.com/go-chi/chi/v5 v5.1.0 // indirect
43+
github.com/go-jose/go-jose/v4 v4.0.2 // indirect
44+
github.com/go-logr/logr v1.4.2 // indirect
45+
github.com/go-logr/stdr v1.2.2 // indirect
46+
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
47+
github.com/golang/protobuf v1.5.4 // indirect
48+
github.com/google/go-cmp v0.6.0 // indirect
49+
github.com/google/pprof v0.0.0-20230817174616-7a8ec2ada47b // indirect
50+
github.com/google/uuid v1.6.0 // indirect
51+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
52+
github.com/hashicorp/errwrap v1.1.0 // indirect
53+
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
54+
github.com/hashicorp/go-hclog v1.6.3 // indirect
55+
github.com/hashicorp/go-multierror v1.1.1 // indirect
56+
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 // indirect
57+
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
58+
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
59+
github.com/hashicorp/go-uuid v1.0.3 // indirect
60+
github.com/hashicorp/go-version v1.7.0 // indirect
61+
github.com/hashicorp/hcl/v2 v2.23.0 // indirect
62+
github.com/hashicorp/logutils v1.0.0 // indirect
63+
github.com/hashicorp/terraform-plugin-go v0.23.0 // indirect
64+
github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect
65+
github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0 // indirect
66+
github.com/hashicorp/yamux v0.1.1 // indirect
67+
github.com/klauspost/compress v1.17.9 // indirect
68+
github.com/kr/pretty v0.3.1 // indirect
69+
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
70+
github.com/mattn/go-colorable v0.1.13 // indirect
71+
github.com/mattn/go-isatty v0.0.20 // indirect
72+
github.com/mitchellh/copystructure v1.2.0 // indirect
73+
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
74+
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
75+
github.com/mitchellh/mapstructure v1.5.1-0.20231216201459-8508981c8b6c // indirect
76+
github.com/mitchellh/reflectwalk v1.0.2 // indirect
77+
github.com/moby/moby v27.3.1+incompatible // indirect
78+
github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907a // indirect
79+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
80+
github.com/outcaste-io/ristretto v0.2.3 // indirect
81+
github.com/philhofer/fwd v1.1.3-0.20240612014219-fbbf4953d986 // indirect
82+
github.com/pion/transport/v2 v2.2.10 // indirect
83+
github.com/pion/udp v0.1.4 // indirect
84+
github.com/pkg/errors v0.9.1 // indirect
85+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
86+
github.com/prometheus/client_golang v1.20.5 // indirect
87+
github.com/prometheus/client_model v0.6.1 // indirect
88+
github.com/prometheus/common v0.60.0 // indirect
89+
github.com/prometheus/procfs v0.15.1 // indirect
90+
github.com/richardartoul/molecule v1.0.1-0.20240531184615-7ca0df43c0b3 // indirect
91+
github.com/rivo/uniseg v0.4.7 // indirect
92+
github.com/robfig/cron/v3 v3.0.1 // indirect
93+
github.com/rogpeppe/go-internal v1.12.0 // indirect
94+
github.com/ryanuber/go-glob v1.0.0 // indirect
95+
github.com/secure-systems-lab/go-securesystemslib v0.7.0 // indirect
96+
github.com/spaolacci/murmur3 v1.1.0 // indirect
97+
github.com/spf13/pflag v1.0.5 // indirect
98+
github.com/tinylib/msgp v1.2.1 // indirect
99+
github.com/valyala/fasthttp v1.56.0 // indirect
100+
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
101+
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
102+
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
103+
github.com/zclconf/go-cty v1.15.0 // indirect
104+
github.com/zeebo/errs v1.3.0 // indirect
105+
go.nhat.io/otelsql v0.14.0 // indirect
106+
go.opentelemetry.io/otel v1.30.0 // indirect
107+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.29.0 // indirect
108+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 // indirect
109+
go.opentelemetry.io/otel/metric v1.30.0 // indirect
110+
go.opentelemetry.io/otel/sdk v1.30.0 // indirect
111+
go.opentelemetry.io/otel/trace v1.30.0 // indirect
112+
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
113+
go.uber.org/atomic v1.11.0 // indirect
114+
golang.org/x/crypto v0.29.0 // indirect
115+
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect
116+
golang.org/x/mod v0.22.0 // indirect
117+
golang.org/x/net v0.31.0 // indirect
118+
golang.org/x/oauth2 v0.24.0 // indirect
119+
golang.org/x/sync v0.9.0 // indirect
120+
golang.org/x/sys v0.27.0 // indirect
121+
golang.org/x/term v0.26.0 // indirect
122+
golang.org/x/text v0.20.0 // indirect
123+
golang.org/x/time v0.8.0 // indirect
124+
golang.org/x/tools v0.27.0 // indirect
125+
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
126+
google.golang.org/appengine v1.6.8 // indirect
127+
google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect
128+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241113202542-65e8d215514f // indirect
129+
google.golang.org/grpc v1.68.0 // indirect
130+
google.golang.org/protobuf v1.35.2 // indirect
131+
gopkg.in/DataDog/dd-trace-go.v1 v1.69.0 // indirect
132+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
133+
gopkg.in/yaml.v3 v3.0.1 // indirect
134+
nhooyr.io/websocket v1.8.7 // indirect
135+
storj.io/drpc v0.0.33 // indirect
136+
)
137+
138+
replace github.com/coder/coder/v2 => ../../

0 commit comments

Comments
 (0)