Giter VIP home page Giter VIP logo

ktor-docs-plugin's People

Contributors

tabilzad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ktor-docs-plugin's Issues

Route path extraction

Route definitions could be extracted at runtime with the native api

fun Application.getAllRoutes(): List<Route> {
    val root = plugin(Routing)
    val allRoutes = allRoutes(root)
    return allRoutes.filter { it.selector is HttpMethodRouteSelector }
}

fun allRoutes(root: Route): List<Route> {
    return listOf(root) + root.children.flatMap { allRoutes(it) }
}

Reference: https://youtrack.jetbrains.com/issue/KTOR-581

gradle task order compatibility issue

I have a single @KtorDocs annotation on my app like this

@KtorDocs
fun Application.topLevelRoutes() {
    routing {
        base()
        articles()
    }
}

i serve the swagger UI as described in the ktor docs like this

        swaggerUI(path = "openapi", swaggerFile = "openapi.yaml") {
            version = "5.17.2"
        }

the first time i use run or runshadow the server fails to launch because the openapi file has yet to be generated

Exception in thread "main" java.io.FileNotFoundException: Swagger file not found: /home/ixtli/Public/project/kt/stavvy-sample-webserver/openapi.yaml
	at io.ktor.server.plugins.swagger.SwaggerKt.swaggerUI(Swagger.kt:44)
	at io.ktor.server.plugins.swagger.SwaggerKt.swaggerUI(Swagger.kt:36)
...

subsequent runs work fine, once the openapi yaml is present in the build dir

my gradle configuration relevant to this issue is

swagger {
    documentation {
        docsTitle = "Stavvy Example Ktor Server"
        docsDescription = "Server Description Here!"
        docsVersion = "1.0"
        generateRequestSchemas = true
        hideTransientFields = true
        hidePrivateAndInternalFields = true
    }

    pluginOptions {
        enabled = true
        saveInBuild = true
        format = "yaml"
    }
}

sourceSets {
    kotlin {
        main {
            resources {
                srcDir(layout.buildDirectory.dir("openapi"))
            }
        }
    }
}

it seems obvious to me that the task graph is wrong. perhaps the generation is a dependency of kotlin compilation where instead the AP should be run as an assembly dependency?

Showing error in build.gradle.kts

Where will I add given code in build.gradle.kts? it shows an error. Please add documentation for build.gradle.kts

swagger {
title = "Ktor Server"
description = "Ktor Server Description"
version = "1.0"
requestFeature = true
}

Plugin [id: 'io.github.tabilzad.ktor-docs-plugin-gradle'] was not found in any of the following sources:

Just cloned the repo to try out the use-plugin example, but without changing anything, the build.gradle gives me this error:

FAILURE: Build failed with an exception.

* Where:
Build file '/home/tobias/Downloads/ktor-docs-plugin-master/use-plugin/build.gradle' line: 3

* What went wrong:
Plugin [id: 'io.github.tabilzad.ktor-docs-plugin-gradle'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (plugin dependency must include a version number for this source)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

CONFIGURE FAILED in 482ms

As already said, this is the cloned repo and it gave me this error while intellij was busy loading the gradle script.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.