-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Base class shouldn't necessarily be abstract #66
Comments
I dunno how much time I'll have within the next few weeks to work on this, but I agree that it might make sense to support either This fact has been the main motivation to use the |
Thanks @johanneshiry . Maybe it could be supported only for Java, at least initially. But no rush at all, I'll also try to find some time for this. |
Upon revisiting this, it appears that abstract classes in the generated code may be completely unnecessary. Given the core purpose of the tool —lib/app configuration access— tscfg could just merge the inheritance chain to directly generate the resulting Scala So, the overall new handling would be:
No need for any changes in the input schema configuration file.
|
So, for the example above: #@define
BaseModelConfig {
uuids: [string]
scaling: double
}
#@define extends BaseModelConfig
LoadModelConfig {
modelBehaviour: string
reference: string
} the following case classes would be generated: case class BaseModelConfig(
uuids: List[String],
scaling: Double,
)
case class LoadModelConfig(
uuids: List[String],
scaling: Double,
modelBehaviour: String,
reference: String,
)
... |
To elaborate a bit about the planned change above about not generating any direct type for For client code, no source changes required at all, that is:
A "breaking" change would occur if existing client code happens to use any of the abstract classes previously generated, but, again, that use should not be considered part of the public API as mentioned previously. |
Related to #64, the base class shouldn't necessarily be abstract, but this is currently required per the issue 64b test, which refers to this spec:
The text was updated successfully, but these errors were encountered: