sumup-go consists of a code generator tool under ./internal/cmd/codegen and the SDK itself which lives in the root. Those two are co-maintained here as the codegen tool is highly opinionated and tightly coupled to the SDK itself. Furthermore, their coexistence in this repository makes it easier to iterate on new features and changes. The loop is:
- Update codegen tool with desired changes.
- Generate code using
make generate. - Inspect changes / ensure that the SDK compiles (e.g. using
make test)
Not all code in the SDK is generated. Files that are, are marked with "// Code generated by go-sdk-gen. DO NOT EDIT." on the first line.
In the SDK, we avoid dependencies unless absolutely necessary. The SDK should be as agnostic as possible to the choice of technology of the end-users.
In the codegen tool relies on github.com/pb33f/libopenapi for most of the heavy lifting. The tool is a bit a messy but the main logic is:
- Load the OpenAPI specs
- Reorganize them into intermediate representation that uses serializable
builder.Writable - Generate the SDK using combination of go templates and serializable blocks of code that are generated as a raw strings.
sumup-go uses Conventional Commits which are used to generate changelog. All PR titles must follow the conventional commits standard. Ideally, use Conventional Commits for commits themselves too.