Sparse Class #1325
discount-elf
started this conversation in
General
Sparse Class
#1325
Replies: 2 comments 8 replies
-
|
This is exactly what Mixins are for! Using a class Something {
someString: String
someDefault: String = whatever
editedString: String
}
patch: Mixin<Something> = new {
editedString = "patchMe"
}
result = mySomething |> patch |
Beta Was this translation helpful? Give feedback.
8 replies
-
|
This seems to be the best I can do using a wrapper class to pass along the type association: new bucket.BucketPatch {
patch { // mixin of Patch<T>
label = "bucket-to-patch"
versioningConfiguration = new bucket.VersioningConfiguration {
status = "Enabled"
}
}
}Sadly if functions could be annotated seems like could just use an annotated mixin :( |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to be able to render a subset of a class relying on the validation for the defined fragment, but not utilizing any defaults for properties for unspecified properties of that class or invalidation due to properties that are not nullable.
Essentially this is to represent a sparse patch to change the state, but rely on the schema for the properties present in the patch
Example:
I haven't gone that deeply in playing with reflection, it seems like I can't really get around
value undefinedfor non nullable types.class.isDefined("propertyName")would be very useful. Otherwise it seems like my only option to represent a patch is viaDynamic. Any ideas?Beta Was this translation helpful? Give feedback.
All reactions