https://kotlinlang.org logo
#ksp
Title
# ksp
v

v79

11/24/2023, 7:03 AM
Would I be able to use KSP to generate a text file (maybe json or yaml) that could list the constructor properties of an annotated class? And store that file in, say, src/main/resources? I.E given a class definition
@Schema data class MyClass(val name: String, val desc: String)
I'd like to produce an put file something like
MyClass:\n - "name:string"\n-"desc:string".
👌 5
g

glureau

11/24/2023, 8:10 AM
This KSP-based tool is generating basic markdown tables from class structure, if ever it can help you kickstart : https://github.com/glureau/K2D/tree/experimentation_k2d
v

v79

11/24/2023, 8:27 AM
Thank you, I will check it out.
Unfortunately I could not compile this project, either from the main or the experimentation branches.
g

glureau

11/27/2023, 8:14 AM
What is the error? I'm using it in production code atm. Are you using Kotlin 1.9 ?
v

v79

11/27/2023, 12:33 PM
Plugin Repositories (could not resolve plugin artifact 'com.glureau.k2d:com.glureau.k2d.gradle.plugin:0.4.1')
. I am using Kotlin 1.9.20.
IntelliJ can't make sense of the gradle-plugin module at all.
g

glureau

11/27/2023, 12:41 PM
Mmmh, because it's setup for a local build sorry about that (I'll change it later). Please comment the line in the sample app, build once, and then you can get back to using the plugin.
👍 1
3 Views