Sebastian Schuberth
10/04/2026, 1:05 PMwithExplicitSealedTypes() in Hoplite 3? Its docs say it was supposed to become the default in v3, but apparently it didn't. Which actually is good for me, as I still need to deserialize sealed interfaces without a type descriptor. However, doing that now seem to be broken, as the returned type always is one fixed sealed interface member, and not the one with matching properties. So, to start with, is deserializing without a type descriptor supposed to work in v3 at all?Sebastian Schuberth
10/04/2026, 2:48 PMDataClassDecoder().decode() regards data as valid even if the key names do not match the property names...Sebastian Schuberth
10/04/2026, 3:59 PMSebastian Schuberth
10/04/2026, 4:03 PMsam
10/04/2026, 4:50 PMSebastian Schuberth
10/04/2026, 4:53 PMSebastian Schuberth
10/04/2026, 5:21 PMwhat's the status ofAny comment here? If it's not intended to become the default anymore, I could make another PR to fixup the docs in that regard.in Hoplite 3?withExplicitSealedTypes()
sam
10/04/2026, 8:12 PMSebastian Schuberth
10/05/2026, 6:41 AMsam
10/05/2026, 6:49 AMSebastian Schuberth
10/05/2026, 7:11 AMSebastian Schuberth
10/07/2026, 12:47 PMsam
10/07/2026, 1:50 PMrocketraman
10/21/2026, 4:48 AMwithExplicitSealedTypes in 3.0 still prints a deprecation warning though -- is not using withExplicitSealedTypes actually still deprecated?Sebastian Schuberth
10/21/2026, 6:34 AMrocketraman
10/21/2026, 12:07 PMrocketraman
10/21/2026, 12:34 PMwithExplicitSealedTypes as it is currently implemented: the default type discriminator is _type which works very poorly with the new idiomatic env var style rolled out in 3.x -- in fact, in the testing I just did, I can see it does not work at all.
Updating the env var parsing logic to handle a double-underscore naively may cause issues with users upgrading from 2.x, as their existing env var variables of the form FOO__BAR will silently get transformed to foo._bar instead of foo.bar, which is a good reason to not futz with the current parsing logic.
Given an input type:
data class SomeConfig(
val sealedValue: SomeSealedClass
)
// only one implementation shown
data class Foo(val x: String) : SomeSealedClass
A user might assume this should work:
SOMECONFIG_SEALEDVALUE__TYPE=Foo
SOMECONFIG_SEALEDVALUE_X=abc
but that is both ugly, and does not work anyway, because the current code splits on _.
The natural and idiomatic way to express that in environment variables (or really any source with flat keys) would be:
SOMECONFIG_SEALEDVALUE=Foo
SOMECONFIG_SEALEDVALUE_X=abc
But formats like HOCON can't express this -- they can't have a key that is both a value and a map. So those would still require the discriminator.
I haven't investigated what the code for this would look like, but in principle what do you guys think about that approach? It makes flat sources parse a bit differently than structured ones, but I think in a good way.
Related: I think I would also want subtype lookup to honor withResolveTypesCaseInsensitive() (the kdoc already mentions "type/name" resolution, so I think that is consistent with the original intent).Sebastian Schuberth
10/21/2026, 12:38 PMare we actually changing directions, or just delaying the change?I was asking the same to @sam but got no clear answer π Just to clarify: I'm not against un-deprecating (de-)serialization without type descriptors. Actually, we currently depend on not having type descriptors. But I felt that doing the fixups that I did was the smallest investment to make things consistent again, until we have clarity on the above question.
Sebastian Schuberth
10/21/2026, 12:41 PMrocketraman
10/21/2026, 12:47 PMwithExplicitSealedTypes, That being said, I wouldn't deprecate the implicit approach unless it creates an unreasonable maintenance burden to keep it.rocketraman
10/21/2026, 1:04 PMSebastian Schuberth
10/21/2026, 1:23 PMthe default type discriminator isOk, but why would you ever want to set such kind of metadata values via environment variables? As a user, I wouldn't even necessarily expect it to work...which works very poorly with the new idiomatic env var style_type
rocketraman
10/21/2026, 1:32 PMSebastian Schuberth
10/21/2026, 1:34 PMrocketraman
10/21/2026, 1:36 PMSebastian Schuberth
10/21/2026, 1:37 PMrocketraman
10/21/2026, 1:39 PMrocketraman
10/24/2026, 2:27 AMwithExplicitSealedTypes and env vars not being able to specify the discriminator value _type, with the nice benefit that it allows env vars and other flat sources to specify sealed class subtypes cleanly and elegantly:
https://github.com/sksamuel/hoplite/pull/604
Example:
# specifies the type
DATABASE=Elasticsearch
DATABASE_PORT=9200