papsign / Ktor-OpenAPI-Generator

Ktor OpenAPI/Swagger 3 Generator
Apache License 2.0
243 stars 42 forks source link

Hi, would you please add how to use this in ktor project ? #1

Closed ganeshmahajan1985 closed 5 years ago

ganeshmahajan1985 commented 5 years ago

Hi this is nice, I am new to ktor. would you please add how to use this in ktor project ? like what to include in gradle.build file etc. step by step ?

Wicpar commented 5 years ago

Hi, You can use it as submodule:

install the submodule:

git submodule add https://github.com/papsign/Ktor-OpenAPI-Generator.git openapigen

declare the folder in settings.gradle

...
include 'openapigen'

declare the dependency in the main build.gradle

dependencies {
    compile project(":openapigen")
    ...
}
ganeshmahajan1985 commented 5 years ago

Hi @Wicpar , I tried this but on building the project it is giving error Unresolved references:bind On like numbber 17 at OpenAPIGen.kt file import javax.xml.bind.JAXBElement

ganeshmahajan1985 commented 5 years ago

Hi @Wicpar ,

There are two changes i have made in build.gradle file and it is working for me now.

  1. Updated kotlin dependency using "apply plugin: 'kotlin'"
  2. jvmTarget explicitly to 1.8
    tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
    kotlinOptions {
        jvmTarget = "1.8"
    }
    }

It is woking as expected now. Thanks

Wicpar commented 5 years ago

Hi @Wicpar , I tried this but on building the project it is giving error Unresolved references:bind On like numbber 17 at OpenAPIGen.kt file import javax.xml.bind.JAXBElement

the import was unused, i deleted it, can you see if you still have to explicitly set the jvm version?