Ben Keil
04/10/2023, 1:56 AMworkflow(
name = "test",
permissions = listOf(
Permission.actions.read,
Permission.checks.read,
Permission.contents.write,
)
on = listOf(),
) {
job(id = "job", runsOn = UbuntuLatest) { run(command = "ls") }
}
other ideas:
everybody understands a map, a lot of repetition
permissions = mapOf(
Permission.Actions to Mode.WRITE,
Permission.Checks to Mode.WRITE,
Permission.Contents to Mode.WRITE,
),
no repetition, maybe unusual
permissions = {
actions(write)
checks(write)
checks(none)
actions(read)
},
current style of API, but no autocompletion in IDE.
permissions = listOf(
Actions(write),
Checks(read),
Contents(none),
),
Piotr Krzemiński
04/10/2023, 6:59 AMmapOf
(also mirrors how YAML looks), provides proper discoverability for available permission and mode values. If one wants, it's possible to reduce repetition by importing individual enum valuesBen Keil
04/10/2023, 7:20 AMPiotr Krzemiński
04/12/2023, 12:47 PMVampire
04/12/2023, 12:52 PMPermission.
which could be mitigated by imports.
Whether it looks like Yaml or not I don't think is too important. Yes, it might make it easier to onboard new users coming from Yaml. But, you know, noone likes Yaml, so don't create something that looks like Yaml or noone will like it. 😄
But besides that, if I have to choose from the 4 options, I'd probably also pick the map one.Piotr Krzemiński
04/12/2023, 12:55 PMVampire
04/12/2023, 12:58 PMBen Keil
04/17/2023, 10:57 AM