I can find enum classes with the `KoModifier.ENUM`...
# konsist
c
I can find enum classes with the
KoModifier.ENUM
but how do I then match the enum values?
i
Currently this is not possible, but it is likely it will be added. Can you share a test you have in mind? BTW ATM you can only get the text (not ideal and should be abstracted by konsist, but may allow for some checks)
Copy code
Konsist.scopeFromProject()
    .classes()
    .assert { it.text }
c
It is serialization related again, since enums are serialized to their value name.
I’d like to have an explicit
@SerialName
so they don’t break with refactoring.
i
makes seance - I will look into this
Konsist <ℹ️%20Konsist%20v0.11.0%20has%20been%20released%20https://github.com/LemonAppDev/konsist/releases/tag/v0.11.0|v0.11.0> has been released. New API allows to get the enum constants:
Copy code
Konsist.scopeFromProject()
    .classes()
    .enumConstants
    .assert { it.hasAnnotationsOf(SerialName::class) }
We still need to add support for arguments, but you cna get constant name and annotation.
c
Perfect, that’s what I needed for now!
i