-
-
Notifications
You must be signed in to change notification settings - Fork 149
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
in yaml, a ~ key should allow to assing a value to the parent key #506
Comments
To clarify, this is causing issues with the Spotless formatter, it is basically transforming any ~ key in the "~" string |
Quick question: how would you represent such document without
which is impossible structurally? Put another way; how would equivalent, non-tilde-using document look like? |
I think you cannot, that's the whole point of the ~ key, it allows you to assign a value to a key that also has children |
So could you not access If there is no equivalent document, I don't think Jackson data model can represent this. But I guess I am also not clear on point of using such marker. EDIT: note, too, that link was to YAML 1.2 spec: Jackson 2.x uses SnakeYAML which supports YAML 1.1 only (https://bitbucket.org/snakeyaml/snakeyaml). |
Ohhh. Maybe it's effectively "empty" key? So something like JSON would have: { "quarkus": {
"log": {
"sentry": {
"": true,
"dsn": "some string"
}
}
}
} ... although that would not be hidden by Jackson either; would need to be access with empty String as key. EDIT: close, it is actually This is not something Jackson can represent since its data model does require all |
Based on all of above, I am pretty sure we cannot, in general make this work:
since So the question would be whether to map |
The point of using this marker is to allow the use of yaml in configuration systems that have not initially been thought of with yaml in mind |
Yeah the problem is that it does really map to Put another way: what is being specifically asked is not doable. But I am open to ideas of alternative improvements. |
In Yaml spec, if one property is the prefix of another, a value can be attributed to the parent one using ~ as a null key to represent any YAML property that is a prefix of another one.
The following test is failing:
instead, the following statement is true:
assertTrue(node.get("quarkus").get("log").get("sentry").get("~").booleanValue())
quarkus.log.sentry."~" is true instead of quarkus.log.sentry
Relevant conversation:
https://quarkusio.zulipchat.com/#narrow/stream/187038-dev/topic/yaml.20property.20conflict
Relevant spec:
https://quarkus.io/guides/config-yaml#configuration-property-conflicts
https://yaml.org/spec/1.2.2/
The text was updated successfully, but these errors were encountered: