Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: ReturnTypeData.innerTypeName doesn't work with a return type being a Map #399

Closed
kylelutze opened this issue Aug 24, 2023 · 3 comments
Labels
bug Something isn't working
Milestone

Comments

@kylelutze
Copy link

Ktorfit version

1.6.0

What happened and how can we reproduce this issue?

if the return object of an API is a Map, like Map<String, List<SomeOjbect>> the generated code becomes

    return ktorfitClient.suspendRequest<Map<String, List<SomeOjbect>>, String,
        List<SomeOjbect>>(_requestData)!!

This doesn't work since now there are 3 values instead of 2 as per the interface. This seems to be related to how ReturnTypeData.innerTypeName works.

What did you expect to happen?

A return type of a Map generates valid code

Is there anything else we need to know about?

No response

@kylelutze kylelutze added the bug Something isn't working label Aug 24, 2023
@Foso
Copy link
Owner

Foso commented Aug 27, 2023

Hi @kylelutze thank your for reporting this!

@DCNick3
Copy link

DCNick3 commented Sep 9, 2023

I have a similar issue with a type like Result<List<AttendanceSession>, BaamError>. Seems like the generics support in general is a bit iffy.

This can be worked around by using type aliases: you alias the generic type to a simple name and then use it in the API

@Foso Foso added this to the 2.0.0 milestone May 28, 2024
@Foso
Copy link
Owner

Foso commented May 28, 2024

This is fixed with Ktorfit 2.0.0

@Foso Foso closed this as completed May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants