-
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
yaml-to-dhall
is erratic with unions
#1197
Comments
$ yaml-to-dhall --version ''
1.4.0
$ dhall version
1.25.0 |
Similar behaviour is observed with $ echo '{"x":1}' | json-to-dhall ./U.dhall
< x : { x : Optional Natural } | y : { y : Optional Natural } >.x { x = Some 1 }
$ echo '{"y":1}' | json-to-dhall ./U.dhall
< x : { x : Optional Natural } | y : { y : Optional Natural } >.x
{ x = None Natural } |
The reason for the inconsistency in This is also the same reason why this example fails: $ echo 'y: 1' | yaml-to-dhall ./U.dhall
< x : { x : Optional Natural } | y : { y : Optional Natural } >.x
{ x = None Natural } Because However, you are right to be surprised about this behavior: $ echo "'y': 1" | yaml-to-dhall ./U.dhall
< x : { x : Optional Natural } | y : { y : Optional Natural } >.x
{ x = None Natural } The root cause behind that is because ... and indeed on $ yaml-to-dhall '< x : { x : Optional Natural } | y : { y : Optional Natural } >' <<< "'y': 1"
< x : { x : Optional Natural } | y : { y : Optional Natural } >.y { y = Some 1 } |
According to https://stackoverflow.com/a/42284910/1013393 only |
This was indeed fixed by #1248! Thanks @vijayphoenix! :) It might be a good idea to add regression tests, so we can ensure that this keeps working even with the |
Agreed. I plan to do a PR no later than the weekend. |
This slipped my mind when I was adding the list of special strings (aeson-yaml will quote 'y'/'n'/'on'/'off'). Will submit a fix and regression test soon. FYI this seems like a general issue: kubernetes/kubernetes#34146 (comment) (Also, perhaps expectedly, when I remove the quoting of 'yes'/'no', my test to assert that libyaml decodes the original input fails.) ..but it seems reasonable to expect the Dhall user not to feed "yes" to Kubernetes. |
Valid YAML, but inconsistent use of quoting:
Correct:
Wrong:
The text was updated successfully, but these errors were encountered: