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
Accumulate duplicated keys #169
Comments
Hi @MiSikora, if you're interested in making a PR, that would be a great enhancement. I'm not sure we need to make it configurable - I'm thinking we can just always report all duplicates. What do you think? |
Sure, if you think it would be a good default I'm all for it. |
I played around with it for a while today and I have couple of questions. kaml/src/commonMain/kotlin/com/charleskorn/kaml/YamlException.kt Lines 23 to 33 in 8fcf0eb
Is I could create some other base exception and make // New exception
public open class YamlException(
override val message: String,
override val cause: Throwable? = null,
) : SerializationException(message, cause)
// Current YamlException
public open class SinglePathYamlException(
override val message: String,
public val path: YamlPath,
override val cause: Throwable? = null,
) : YamlException(message, cause)
// New exception for multiple duplicate keys, probably remove DuplicateKeyException
public class DuplicateKeysException : YamlException |
Great question. I'd like to preserve the path and location (line and column) information wherever possible - this is really helpful when presenting information about the error to a user, and I know of at least one consumer of the library that uses this information extensively. For example, being able to say "property 'blah' on line 2, column 5 has value 'abc' which is not a valid boolean value" is useful information for a human. I think this is the first case where we can't definitively provide one path and location as the source of the error (the previous |
This issue has been automatically marked as stale because it has not had any activity in the last 60 days. It will automatically be closed if no further activity occurs in the next seven days to enable maintainers to focus on the most important issues. |
This issue has been automatically closed because it has not had any recent activity. |
In case of multiple key duplicates I would like to see information about all of them and not first one encountered. Would it be possible to make it a configurable behaviour? I can make a PR if it is something you see fitting for the library.
The text was updated successfully, but these errors were encountered: