is there any pattern in actions-typing or github-w...
# github-workflows-kt
n
is there any pattern in actions-typing or github-workflows-kt for modelling this kind of structured input? i would like to write builders that assemble this list of values with type safety ideally but … i see no way to neatly integrate that and scope it to just this action type..
p
no, it’s not supported. All you can do for now is to build your little side DSL and ask people to use it when building
tags
it would map to a list of pairs or a list of maps right?
n
but how can i turn
Copy code
tags = listOf(...)
into eg.
Copy code
tags = buildTags {}
without this polluting the namespace ? and if i were to contribute such helper functions… how can they be made discoverable ?
p
without this polluting the namespace ?
I don’t have a solution for it now, sorry
generally so far I decided to not complicate the typings too much because the interest in adopting whatever already exists is pretty low
so I’m on pause with developing this
feel free to create a feature request in the DSL lib to be able to somehow provide type-safe builders for some inputs. The fact that we don’t know how to implement it doesn’t mean that the idea is wrong 🙂
n
okay, i will spend some time prototyping solutions my goals are to allow alternatives to
tag = listOf<String>()
but… not break the contract of required arguments… that would not increase typesafety
p
we had a similar discussion with @Vampire related to passing something more type-safe to inputs, but in a context of what expressions can return. This problem seems to be a piece in a bigger puzzle. Denotable union types would be an elegant way of addressing both, for your problem we could have something like
List<String> <or> SomeTypeSafeMarkerInterface
, and the IDE could help discover functions that return the latter