Skip to content

Generating client with Kotlin and Retrofit2 fails #6368

@andre-artus

Description

@andre-artus
Description

I tried to generate a Retrofit2 client in Kotlin, which results in:
Exception in thread "main" java.lang.RuntimeException: unknown library: retrofit2
at io.swagger.codegen.DefaultCodegen.setLibrary(DefaultCodegen.java:3329)
at io.swagger.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:421)
at io.swagger.codegen.cmd.Generate.run(Generate.java:283)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)

Swagger-codegen version

2.3.0-SNAPSHOT

Swagger declaration file content or url

I don't think it's specific to input as I also tried it on [included] petstore.yaml.

Command line used for generation

generate --library retrofit2 --artifact-id "[aid]" -i [path to swagger.json] -l kotlin -o [path to output directory]

Steps to reproduce

run it with swagger-codegen-cli.

I ran the same swagger.json without --library retrofit2, that worked (but obviously not correct library). Then I ran it changing -l kotlin to -l java, that produced Retrofit2 compatible code, but obviously for Java.
So it is the combination that fails.

Related issues/PRs
Suggest a fix/enhancement

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions