I have a graphql schema file in which I define an enum:
enum Job {
OPEN,
PAUSED,
CLOSED
}
I then have a query resolver written in kotlin for my filters like so:
input.Job?.let { FindJobFilter(JobField.JOB, it) }
The it
in question is requires a List<String>
but I am supplying it a (Mutable)List<Job!>
.
I am trying to write a helper function so that I can convert the it
to the expected type of List<String>
but can't seem to figure it out .
CodePudding user response:
You simply need to map the list of Jobs to their names:
input.Job?.let { FindJobFilter(JobField.JOB, it.map { it?.name }) }