kcl
kcl copied to clipboard
Collect instances of schema
MySchema.instances()
is a really nice helper function, however seems to work in limited circumstances. Is there a way to pull instances across multiple files, or a glob of files (or all files in a single directory)?
Currently, MySchema.instances()
it is only valid for files in the main package to avoid unexpected non idempotent calls. For example, I instantiated a MySchema in pkg1, but the length of the list returned by calling the instances method in other packages is uncertain. Therefore, the current general usage is kcl main1.k main2.k
, that is, instantiate MySchema in main1.k and call the instances method in main2.k
When dealing with 100's of configs it's nice to use multiple files, and would be nice to have some way to aggregate them back together. Not an unsolvable problem without it, but a nice to have :)
Though I definitely see the need to be careful, as it could be used in unintended scenarios
Thank you! but we will still carefully consider this scenario and develop more suitable solutions and features. ❤️