-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data driven entity generation by YAML definitions #25
Comments
We should use ProtoBuf instead. It is a better alternative and it is suited for this exact use case, it would be a really better alternative. |
Closed by 0b0b79e |
Ok, so this issue need to be reopened. There is no decent ProtoBuf compiler for Kotlin in which adds good compatibility for kotlinx.serialization and possibility to wrap classes (e.g. compatibility to UUIDs by passing an option). This issue will be closed again when we found a compiler for Kotlin, for a while we will reimplement ProtoBuf definitions in Kotlin manually. |
It seems the official |
Entity generation by YAML definitions
Table of contents:
Summary
We should create two code generators (one written in Kotlin and another written in Rust) which would generate entities based on fields defined in a YAML file.
Motivations and the proposed solution
As mentioned in #21, "we need to create an entity data class in Kotlin with the same contents as Rust for the rest web client, this means that we would have duplicated code". This feature would fix this problem and add more flexibility to entity changes. We could also integrate this into the command-line interface for better management of this solution.
Rust
Implementing this feature in Rust is really simple though, since we can simple use function-like procedural macrosΒΉ that read the YAML files, parse them and generate code.
Kotlin
I still haven't thought of a better way to implement this, but I know we can use Gradle tasks and square/kotlinpoetΒ² for code generation.
Examples
player.yml
Reference
Final considerations
Suggestions are appreciated for new sections in this issue, or if you have a better idea about how to structure it, feel free to let us know about it by commenting down below. Thank you for the attention.
The text was updated successfully, but these errors were encountered: