Skip to content

Commit c255467

Browse files
committed
INF-1307 drop generated typed clients; clears all GRC warnings
The CLI is fully spec-driven - cmd/twoctl/cli/operations.go walks the embedded OpenAPI spec at startup and registers a cobra command per operation. Nothing outside zz_generated.go ever imported the typed clients, so they were 22k lines of dead code that only existed to feed goreportcard misspellings (oustanding, occured in upstream specs), gocyclo violations (CountryCodeEnum.Valid at complexity 145, generated union Marshal/Unmarshal, etc.), and golint nits we could not fix without forking oapi-codegen. Removed: - internal/clients/<api>/zz_generated.go (~22k lines) - oapi-codegen tool dependency - oapi-codegen.yaml configs Kept: - openapi/<api>-api.yaml (vendored upstream) - internal/preprocess (3.1 -> 3.0 rewriter) - cmd/twoctl/cli/specs/*.processed.yaml (embedded for runtime) scripts/codegen.sh now only runs the preprocess step and copies the processed specs into the embed dir. Local lint sweep across the whole repo (gofmt -s, go vet, ineffassign, misspell, gocyclo over 15, golint) produces zero output.
1 parent 4e1f0dd commit c255467

16 files changed

Lines changed: 20 additions & 22784 deletions

File tree

docs/regeneration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The `regenerate.yml` workflow uses `GITHUB_TOKEN` for PR creation. No extra secr
3434
./scripts/codegen.sh
3535
```
3636

37-
That preprocesses the OpenAPI 3.1 specs into 3.0-compatible shape (see [`internal/preprocess`](../internal/preprocess/main.go)), generates the typed Go clients into `internal/clients/<api>/zz_generated.go`, and copies the processed specs into `cmd/twoctl/cli/specs/` so the CLI can embed them.
37+
That preprocesses the OpenAPI 3.1 specs into 3.0-compatible shape (see [`internal/preprocess`](../internal/preprocess/main.go)) and copies the processed specs into `cmd/twoctl/cli/specs/` for embedding. The CLI parses the embedded spec at startup and walks every operation; no typed Go client code is generated, which keeps the dependency surface small and the Go Report Card clean.
3838

3939
## Releases
4040

go.mod

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ module github.com/two-inc/twoctl
22

33
go 1.26.3
44

5-
tool github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen
6-
75
require (
8-
github.com/oapi-codegen/runtime v1.4.1
6+
github.com/getkin/kin-openapi v0.139.0
7+
github.com/minio/selfupdate v0.6.0
98
github.com/spf13/cobra v1.10.2
109
github.com/zalando/go-keyring v0.2.8
1110
golang.org/x/term v0.43.0
@@ -14,35 +13,27 @@ require (
1413

1514
require (
1615
aead.dev/minisign v0.2.0 // indirect
17-
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
1816
github.com/danieljoos/wincred v1.2.3 // indirect
19-
github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 // indirect
20-
github.com/fsnotify/fsnotify v1.9.0 // indirect
21-
github.com/getkin/kin-openapi v0.139.0 // indirect
17+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
2218
github.com/go-openapi/jsonpointer v0.22.4 // indirect
2319
github.com/go-openapi/swag/jsonname v0.25.4 // indirect
2420
github.com/godbus/dbus/v5 v5.2.2 // indirect
25-
github.com/google/uuid v1.6.0 // indirect
2621
github.com/inconshreveable/mousetrap v1.1.0 // indirect
2722
github.com/josharian/intern v1.0.0 // indirect
23+
github.com/kr/pretty v0.3.1 // indirect
2824
github.com/mailru/easyjson v0.9.1 // indirect
29-
github.com/minio/selfupdate v0.6.0 // indirect
3025
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
31-
github.com/oapi-codegen/oapi-codegen/v2 v2.7.0 // indirect
3226
github.com/oasdiff/yaml v0.1.0 // indirect
3327
github.com/oasdiff/yaml3 v0.0.13 // indirect
3428
github.com/perimeterx/marshmallow v1.1.5 // indirect
29+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
30+
github.com/rogpeppe/go-internal v1.13.1 // indirect
3531
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect
36-
github.com/speakeasy-api/jsonpath v0.6.3 // indirect
37-
github.com/speakeasy-api/openapi v1.19.2 // indirect
3832
github.com/spf13/pflag v1.0.10 // indirect
39-
github.com/vmware-labs/yaml-jsonpath v0.3.2 // indirect
33+
github.com/ugorji/go/codec v1.2.12 // indirect
4034
github.com/woodsbury/decimal128 v1.4.0 // indirect
41-
go.yaml.in/yaml/v3 v3.0.4 // indirect
4235
golang.org/x/crypto v0.46.0 // indirect
43-
golang.org/x/mod v0.33.0 // indirect
44-
golang.org/x/sync v0.19.0 // indirect
4536
golang.org/x/sys v0.44.0 // indirect
4637
golang.org/x/text v0.34.0 // indirect
47-
golang.org/x/tools v0.42.0 // indirect
38+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
4839
)

go.sum

Lines changed: 4 additions & 135 deletions
Large diffs are not rendered by default.

internal/clients/billing-account/oapi-codegen.yaml

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)