libelektra: YAJL: Plugin Does Not Save Value Directly Below Mountpoint
Steps to Reproduce the Problem
kdb mount config.json user/tests/yajl yajl
kdb set user/tests/yajl 'This May Be the Year I Disappear'
kdb ls user/tests/yajl
#> user/tests/yajl
kdb get user/tests/yajl
Expected Result
The last command should print the text This May Be the Year I Disappear.
Actual Result
The last command prints an empty line.
System Information
- Elektra Version: master
- OS: macOS 10.13.6
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17 (17 by maintainers)
Commits related to this issue
- Yajl: Add top level value tests #2129 — committed to PhilippGackstatter/libelektra by deleted user 5 years ago
- Yajl: Add top level value tests #2129 — committed to PhilippGackstatter/libelektra by deleted user 5 years ago
I fully agree.
So let us implement the same with yajl.
Which test? (see also below)
It is easier to see if something is an acceptable solution if:
No, this example only demonstrates that
{"", "some value"}is not an ideal way to represent the parentKey’s value.Seems like YAML CPP handles this data properly:
. I did not adapt the plugin for empty keys though. Just calling
setBaseNamein a storage plugin, using the correct string value (""), should be enough to support this feature.There is also nothing else special about it except that some configuration file formats do not have a way to simply describe a value without a key.
Empty keys allow you to map documents like
{"root": {"": "something"}}. How do you map this currently to a KeySet?This seems to have changed: https://stackoverflow.com/questions/13318420/is-a-single-string-value-considered-valid-json
In https://www.ietf.org/rfc/rfc7159.txt there are even examples showing that “only values” are allowed. But it seems like yajl does not support this… (yajl 2.1.0-2+b3 yields the error
Expected “{” but found “"”)With the feature from RFC 7159 we could map:
"some value"-> parent = “some value”{"", "some value"}-> parent/% = “some value”But we would need to work around yajl then… (the ChangeLog also does not indicate that this feature was added later).
I think I can look into this as my first issue. Can you give me a few pointers where I should start to look @markus2330? Thanks.
As far as I can tell, yes.
Thank you for reporting the problem!
How would such a JSON document look like? We also need documentation for the special semantics of configuration files only containing the parent key.