fun getRoutePath()

in dsl/spring/spring-lang-parser/src/main/kotlin/io/kotless/parser/spring/processor/route/SpringAnnotationUtils.kt [39:57]


    fun getRoutePath(binding: BindingContext, func: KtNamedFunction): URIPath {
        return executeOnAnnotation(binding, func, onMethodAnnotation = { annotation ->
            val existingPath = getRoutePath(func, binding)
            val currentPath = annotation.getURIPaths(binding, "value")
                ?: error(func, "`value` parameter is required for @GetMapping/@PostMapping/... style annotations")

            require(func, currentPath.size == 1) { "`value` parameter of @GetMapping/@PostMapping/... style annotations should have only one path" }

            URIPath(existingPath, currentPath.single())
        }, onAnyMethodAnnotation = { annotation ->
            val existingPath = getRoutePath(func, binding)
            val currentPath = annotation.getURIPaths(binding, "value")
                ?: error(func, "`value` parameter is required for @RequestMapping annotation")

            require(func, currentPath.size == 1) { "`value` parameter of @RequestMapping annotation should have only one path" }

            URIPath(existingPath, currentPath.single())
        })
    }