Would I be able to use KSP to generate a text file...
# ksp
v
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
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
Thank you, I will check it out.
Unfortunately I could not compile this project, either from the main or the experimentation branches.
g
What is the error? I'm using it in production code atm. Are you using Kotlin 1.9 ?
v
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
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