-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi-type items #65
Comments
I tried this strategy: class MapOrString private constructor(source: Either<String, Map<String, String>) {
val string: String? = source.leftOrNull
val map: Map<String, String>? = source.rightOrNull
constructor(stringDescriptor: String) : this(Either.left(stringDescriptor))
constructor(map: Map<String, String>) : this(Either.right(map))
}
object FooSpec : ConfigSpec("") {
val multitype by required<MapOrString>()
} but it fails with:
It looks like Konf never tries secondary constructors... |
I found a way! Secondary constructors need to be annotated with |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 30 days if no further activity occurs, but feel free to re-open a closed issue if needed. |
Hi,
I'd like to be able to express the following valid configurations:
I can support either one, but not both:
Is there a way to capture both cases? I cannot rename the key.
The text was updated successfully, but these errors were encountered: