Skip to content

feat(protocol): generate Go SDK from Codex JSON Schema#1

Closed
birdmanmandbir wants to merge 1 commit intomainfrom
feat/generate-go-sdk
Closed

feat(protocol): generate Go SDK from Codex JSON Schema#1
birdmanmandbir wants to merge 1 commit intomainfrom
feat/generate-go-sdk

Conversation

@birdmanmandbir
Copy link
Contributor

Summary

  • Add custom Python codegen (cmd/codegen/main.py) that reads the Codex app-server-protocol JSON Schema (339 types across top-level + v2 namespace) and generates typed Go bindings
  • Generate protocol/types_gen.go (240 structs, 44 enums, type aliases), protocol/unions_gen.go (discriminated unions with typed params getters), protocol/methods_gen.go (42 client request + 42 server notification + 7 server request method constants)
  • Add Makefile, go:generate directive, CI workflow, and tests

Type Coverage

Category Count
Structs (objects) 240
Enums 44
Discriminated unions 4 (ClientRequest, ServerNotification, ServerRequest, ClientNotification)
Method constants 92
Total generated lines ~4,500

Test plan

  • go vet ./... passes
  • go test ./protocol/ — 7 tests covering marshal/unmarshal round-trips, union params getters, enum values, method constants, nullable field omission
  • make ci passes (generate + vet + test + build)
  • make check-generate verifies generated files match schema

Add custom Python codegen (cmd/codegen/main.py) that reads the Codex
app-server-protocol JSON Schema (339 types) and generates typed Go
bindings:

- protocol/types_gen.go: 240 structs, 44 enums, type aliases
- protocol/unions_gen.go: discriminated unions (ClientRequest,
  ServerNotification, ServerRequest) with typed params getters
- protocol/methods_gen.go: 42 client request + 42 server notification
  + 7 server request method constants

Includes Makefile, go:generate directive, CI workflow, and tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant