-
Notifications
You must be signed in to change notification settings - Fork 211
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
dhall-to-{json,yaml,yaml-ng}: Handle empty maps correctly #1561
Conversation
Unfortunately
Could you take a look at that @patrickmn? |
@@ -32,6 +33,10 @@ testTree = | |||
, testDhallToYaml | |||
Dhall.JSON.Yaml.defaultOptions | |||
"./tasty/data/special" | |||
, testDhallToYaml | |||
Dhall.JSON.Yaml.defaultOptions | |||
{ conversion = Dhall.JSON.Conversion "mapKey" "mapValue" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder whether we should update these defaultOptions
to accurately reflect the default CLI options.
(In testDhallToJSON
, we already use this Conversion
by default:
dhall-haskell/dhall-json/tasty/Main.hs
Lines 69 to 74 in 6c68f82
let mapKey = "mapKey" | |
let mapValue = "mapValue" | |
let conversion = Conversion {..} | |
let convertedExpression = | |
Dhall.JSON.convertToHomogeneousMaps conversion resolvedExpression |
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have prepared a patch that adds a defaultConversion
, that we could apply after this fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it would be a good idea to keep them in sync
Yep, will fix. |
Ping @patrickmn! :) |
@patrickmn Any chance this could make it into the new release (#1575)? |
Sorry, wasn't here much lately. Yes, if it's just the empty objects and not the single vs. double-quoting right now I can push a change and release in the next hour or so. |
No worries @patrickmn. I would really appreciate a fix for the empty-object encoding! :) #1516 is less important IMHO. |
Ok, should be fixed in 1.0.5.0 - clovyr/aeson-yaml@2b4abb1 |
9092a2b
to
c39fb37
Compare
Thanks for the fix @patrickmn! :) |
@@ -32,6 +33,10 @@ testTree = | |||
, testDhallToYaml | |||
Dhall.JSON.Yaml.defaultOptions | |||
"./tasty/data/special" | |||
, testDhallToYaml | |||
Dhall.JSON.Yaml.defaultOptions | |||
{ conversion = Dhall.JSON.Conversion "mapKey" "mapValue" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it would be a good idea to keep them in sync
While generalizing list annotations In 0ee6ce6, I had forgotten to update
dhall-json
.Fixes #1559.
This requires aeson-yaml >= 1.0.5.0 since older versions
incorrectly encode empty objects.
The raised bound also fixes #1560. A regression test is included.