-
Notifications
You must be signed in to change notification settings - Fork 109
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
Introduction of bug related to optional as part of RC28 commits #461
Comments
@vigoo When you get time, can u take a look at why. I tried to identify myself on whats going on, but couldn't track down. Another change in behaviour which I noticed is reduced view of the error. For example ╥
╠══╗
║ ║
║ ╠─MissingValue
║ ║ path: database
║ ║ Details: optional value
║ ║
║ ╠─MissingValue
║ ║ path: database
║ ║ Details: optional value, value of type string
║ ▼
▼) In this case, first database is an optional product, but we don't see the details of the product. This was available before and its important to give out this info to the user. |
I believe the recursive config support changed the error reporting for this and we discussed this in that PR too, I think here: #409 (comment) I don't know why your first example on the top behaves like that, I agree that should report the missing two fields. In the second one if |
For sure. The first example did work at RC27 and broke at RC28. I am not entirely sure out of the big change, which part made that bug. I thought, you will have a quick idea on where it went wrong. I agree, with the second case we did have a discussion and thanks for reminding me about it. |
Unfortunately I haven't got any quick ideas :( |
No worries. Came in with this logic anyway final def requiredZipAndOrFields[A](config: ConfigDescriptor[A]): Int = {
def countZipSize[A](config: ConfigDescriptor[A]): Int =
config match {
case ConfigDescriptorAdt.Zip(left, right) =>
countZipSize(left.get()) + countZipSize(right.get())
case _ => 1
}
def countOrElseSize[A](config: ConfigDescriptor[A]): Int =
config match {
case ConfigDescriptorAdt.OrElse(left, right) =>
countOrElseSize(left.get()) + countOrElseSize(right.get())
case _ => 1
}
def countOrElseEitherSize[A](config: ConfigDescriptor[A]): Int =
config match {
case ConfigDescriptorAdt.OrElseEither(left, right) =>
countOrElseEitherSize(left.get()) + countOrElseEitherSize(right.get())
case _ => 1
}
def loop[B](count: List[K], config: ConfigDescriptor[B]): Int =
config match {
case ConfigDescriptorAdt.Zip(_, _) => countZipSize(config)
case ConfigDescriptorAdt.XmapEither(cfg, _, _) => loop(count, cfg.get())
case ConfigDescriptorAdt.Describe(cfg, _) => loop(count, cfg.get())
case ConfigDescriptorAdt.Nested(_, _, next) => loop(count, next.get())
case ConfigDescriptorAdt.Source(_, _) => 1
case ConfigDescriptorAdt.Optional(_) => 0
case ConfigDescriptorAdt.OrElse(_, _) => countOrElseSize(config)
case ConfigDescriptorAdt.OrElseEither(_, _) => countOrElseEitherSize(config)
case ConfigDescriptorAdt.Default(_, _) => 0
case ConfigDescriptorAdt.Sequence(_, _) => 1
case ConfigDescriptorAdt.DynamicMap(_, _) => 1
}
loop(Nil, config)
}
|
@vigoo Apologies that we had to revert back some of the changes as part of RC28 in the process of fixing the bug (which I think was not looking good). We will definitely follow up on the changes and the tests related to recursion as a later commit. The issue will be reopened. |
Don't really undertsand the motivation here, if there is a bug why not fix it with keeping/improving the already implemented other features? Looks like there is some hidden deadline here? |
Sorry I didn't get u when u said "Why not fix bug?" Motivation is "not putting users into risk of losing a basic functionality mentioned in the issue." So its not really a revert. It is a bug fix. |
The commits for RC28 has introduced bugs in zio-config when dealing with optional values.
read(descriptor[RawTableConfig] from TypesafeConfigSource.fromHoconString(string).loadOrThrow)
returns
Right(RawTableConfig(None))
while it should have complained about missingseparator
andheader
.Note: These functionalities were in-tact at RC27 and it is seem to broken by RC28. The corresponding test cases were also changed as part of RC28, and hence this wasn't picked up
The text was updated successfully, but these errors were encountered: