Thanks to visit codestin.com
Credit goes to github.com

Skip to content

@RequestType from List to Non List will produce wrong code #869

@tlevavasseur-decathlon

Description

@tlevavasseur-decathlon

Ktorfit version

2.5.2

What happened and how can we reproduce this issue?

If you try to convert a List into a non Iterable type then the generated code is invalid

@Query("data") @RequestType(String::class) data: List<Something>,

will produce

val data: String = _helper.convertParameterType(data,data::class,String::class)
...
data?.filterNotNull()?.forEach { parameter("data", "$it") }

which doesn't compile because data is no more a List.

What did you expect to happen?

the requestType should be used when determining if the type is Iterable, and in this case it's not anymore, the generated code should be :

data?.let{ parameter("data", "$it") }

Is there anything else we need to know about?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions