Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@adamgfraser
Copy link
Contributor

Resolves #7716.

Currently if we have a config like Config.string("greeting") and a config provider like ConfigProvider.fromMap("greeting" -> "Hello, World!") the result of loading this config will be Hello.

While this has some internal logic to it since the , is a sequence delimiter and if a sequence isn't requested the first value will be returned, this also seems somewhat unexpected to me. Not only is the additional information in the value silently dropped but I also said I wanted to just load a string and not a sequence of strings.

This PR changes that behavior so that now we only split a string if a sequence is requested. So loading Config.chunkOf(Config.string("greeting")) would return Chunk("Hello", "World!") whereas loading Config.string("greeting") would just load "Hello, World!".

Unfortunately, this does require significant contortions in the implementation of Flat to support this while preserving binary compatibility since the current signature of Flat#load does not give the implementation enough information to know whether it is being requested to load a single value or a collection of values.

@adamgfraser adamgfraser requested a review from jdegoes January 18, 2023 23:26
@jdegoes jdegoes merged commit 3f7a018 into zio:series/2.x Jan 19, 2023
@adamgfraser adamgfraser deleted the split branch January 19, 2023 14:14
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.

zio.Config to allow not delimited string value

2 participants