sig-events
sig-events copied to clipboard
SDK: Remove code duplication
Today the SDK contains a lot of boilerplate code to send an event. This can be seen when writing the unit test (see https://github.com/cdfoundation/sig-events/pull/92/files for an example). We could probably reduce the amount of code one needs to write to generate an event.
Some ideas on doing this could be:
- Generate the code from a specification
- Write the code smarter
Is this issue still valid, @m-linner-ericsson , @afrittoli ? If so, it should be re-created in the cdevents/sdk-go repo
When developing the new SDK I tried to avoid where possible code duplication. It is the nature of go to be explicit though, it is harder in go than in python to reduce the amount of code as there is no such thing as polymorphism in go. I've used a simple shell script to generate the base file for most events, but the limitation is that the generated files need then to be manually updated, so it is not possible to regenerate existing files. It is rather straight forward to add new events to the SDK though, and I plan to document the process eventually. I would close this one and open an issue in the SDK about documenting how to add new events and new fields to existing events.
@m-linner-ericsson , are you satisfied with that proposal, and thus could we close this issue?