-
Notifications
You must be signed in to change notification settings - Fork 335
Open
Description
Reproduced with Pkl 0.29.0.
Reproducer:
open class Foo {
foo: Int
}
class Bar extends Foo {
foo = "foo"
}
output {
value = new Bar {}
}
This is more of a clarification question: Should this be allowed? As a follow-up, what should one do if they don't want this to be allowed in their schema? My use-case is the following:
open class BaseThing {
// This will be exposed on the final JSON/YAML/etc. output so that code consuming this value can know what type it's dealing with.
fixed type: String
}
class DerivedThing extends BaseThing {
fixed type = 123 // Allowed right now
}
Right now derived classes can set type
to anything, which causes chaos.
Follow-up to the follow-up: In case of property overrides in subclasses, should aspects of the property like documentation and field type be preserved? Right now, if one specifies the type on the superclass and reflects the subclass, the type of the overridden field will be UnknownType
unless explicitly specified (which causes code generator sadness).
Metadata
Metadata
Assignees
Labels
No labels