That looks amazing
# strikt
r
That looks amazing
🤗 1
m
well...not yet. But I'll put in some effort. 🙂 thanks!
r
It’s a great idea. Had certainly crossed my mind but I’d never put any serious thought into how it could be done.
m
It's pretty gross tbh and I could not have done it without squareup's libraries around kotlin metadata.
kapt
is straightforward, but it does not give you the necessary type information to generate assertions. Will have to do more testing before expanding from data classes to other types (classes, sealed classes, inheritance,...)
r
Yeah, I’ve tried to do some stuff inferring Open API schemas from Kotlin types and it’s not beautiful.
c
is it possible to do this without annotating the data class? I think tests should not need chages to tested classes.
m
AFAIK it is possible to run an annotation processor without annotations, but I will have to verify. You will then have to configure the classes you want Assertions to be generated for in the gradle plugin. Could look something like this:
build.gradle
Copy code
strikt {
     sources += com.acme.MyClass //fqcn

}
Though I have to say that adding one annotation with source retention (annotation isn't stored in binary output) to the main classpath should not really matter...
🤔 I think I can get rid of the annotation and kapt altogether and just use a gradle plugin. Should simplify things a lot for users. Thanks for the brain stimulus Christoph.
c
yay!
r
I think that’s a good idea. It feels like it ought to be possible to find classes by package scanning.