8000 DataClassDecoder: defer null/undefined handling by rocketraman · Pull Request #486 · sksamuel/hoplite · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

DataClassDecoder: defer null/undefined handling #486

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rocketraman
Copy link
Contributor
@rocketraman rocketraman commented Mar 17, 2025

The DataClassDecoder extends the NullHandlingDecoder, so with undefined input the data class decoder never actually executes, even if the data class provides defaults -- the NullHandlingDecoder kicks out the undefined immediately, resulting in missing config errors.

Prefixes make this much more likely to happen because there is almost always defined (but irrelevant) config at the root e.g. env vars, properties, etc -- thus giving the DataClassDecoder a chance to do its thing with defaults -- but prefixed config is much more likely to be completely Undefined.

Resolves #480

The `DataClassDecoder` extends the `NullHandlingDecoder`, so with
undefined input the data class decoder never actually executes -- the
`NullHandlingDecoder` kicks out the undefined immediately, resulting in
a missing config error.

Prefixes make this much more likely to happen because there is almost
always defined (but irrelevant) config at the root e.g. env vars,
properties, etc -- thus giving the `DataClassDecoder` a chance to do its
thing with defaults -- but prefixed config is much more likely to be
completely `Undefined`.

Resolves sksamuel#480
@sschuberth
Copy link
Contributor

@sksamuel any chance that we could still get a 2.x release with this fix included?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default values don't work when specifying a prefix
2 participants
0