-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Handle empty list keeping backward compatibility #7891
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
Conversation
loop(prefix, config, split = true).map(Chunk(_)) | ||
|
||
case Right(chunk) => | ||
if (chunk.size == 1 && (chunk.headOption.contains("<nil>"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<nil>
is another way (along with empty string) to encode empty list when the config is actually indexed. Usually only libraries like zio-config (or advanced users) would ever need to encode emptiness using as a String<nil>
Users who prefer to write flat-structure hardly end up doing this and can use ""
as before. This implies, as test cases indicate, we keep all the existing behaviour of ConfigProvider as it is.
We can remove this pre-requisite in zio-3.x, where ConfigPath
is the default behaviour
if (chunk.size == 1 && (chunk.headOption.contains("<nil>"))) | ||
ZIO.succeed(Chunk.empty).map(Chunk(_)) | ||
else loop(prefix, config, split = true).map(Chunk(_)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIXME: A bit of clean up - just tested the functionality as of now and it works
<nil>
is another way (along with empty string) to encode empty list when the config is actually indexed. Usually only libraries like zio-config (or advanced users) would ever need to encode emptiness using as a String<nil>
Users who prefer to write flat-structure hardly end up doing this and can use "" as before. This implies, as test cases indicate, we keep all the existing behaviour of ConfigProvider as it is.
We can remove this pre-requisite in zio-3.x, where ConfigPath is the default behaviour