A Go-based SDK generator for Coze OpenAPI.
- Supported language:
python - In progress:
go - Generation model: Swagger/OpenAPI as source of truth + config-based metadata
The legacy SDK shape and the OpenAPI document are not fully 1:1.
config/generator.yaml is used to provide generation metadata, for example:
- API package grouping
- SDK method aliases for the same endpoint
- field alias/type overrides
- legacy-compatible behavior not directly expressible in Swagger
- Run Python generator:
./scripts/genpy.shGenerate directly into a real coze-py repository:
./scripts/genpy.sh --output-sdk /path/to/coze-pyRun with CI-parity checks (build, lint/type-check, tests):
./scripts/genpy.sh --output-sdk /path/to/coze-py --ci-checkPython workflow does not require a baseline diff step; use --ci-check as the validation gate.
Run Go generator:
./scripts/gengo.sh- Compare generated Go SDK with baseline SDK:
./scripts/diffgo.shgo run ./cmd/coze-sdk-gen \
--config config/generator.yaml \
--swagger ./coze-openapi.yamlOutput example:
language=python generated_files=57 generated_ops=86 output=<configured-output-dir>
Optional overrides:
--language--output-sdk
- format:
./scripts/fmt.sh - lint:
./scripts/lint.sh - test (coverage gate):
./scripts/test.sh - build:
./scripts/build.sh
Run full checks:
make checkUse a single entrypoint:
./scripts/genpy.sh --output-sdk /path/to/coze-py --ci-checkor:
COZE_PY_DIR=/path/to/coze-py make check-coze-pyscripts/genpy.sh runs:
- generation
ruff check --fixruff format- optional
coze-pyCI-parity checks (build,ruff check,ruff format --check,mypy,pytest)