Skip to content
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-yaml-ng quotes the keys that contain a dash while dhall-to-yaml does not #1873

Open
PierreR opened this issue Jun 21, 2020 · 4 comments

Comments

@PierreR
Copy link
Contributor

PierreR commented Jun 21, 2020

I don't quite understand why this simple file:
Given this command:

→ dhall-to-yaml-ng --file openshift/examples/test.dhall --output openshift/examples/test.yaml

Using this input file:

let k8s =
      https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/master/1.17/package.dhall sha256:7150ac4309a091740321a3a3582e7695ee4b81732ce8f1ed1691c1c52791daa1

in  k8s.Namespace::{
    , metadata = k8s.ObjectMeta::{
      , name = Some "test"
      , annotations = Some
          ( toMap
              { `openshift.io/display-name` = "A very long name"
              , `openshift.io/requester` = "test"
              }
          )
      }
    }

I will get this output yaml file:

apiVersion: v1
kind: Namespace
metadata:
  annotations:
    "openshift.io/display-name": A very long name
    openshift.io/requester: test
  name: test

I can't really make sense of the dichotomy of the two annotations.

If I use dhall-to-yaml I have this output file

apiVersion: v1
kind: Namespace
metadata:
  annotations:
    openshift.io/display-name: A very long name
    openshift.io/requester: test
  name: test
@PierreR
Copy link
Contributor Author

PierreR commented Jun 21, 2020

Sorry about that. I have just realized there is a much simpler user case:

→ echo '{ `display-name` = "hello world" }' | dhall-to-yaml
display-name: hello world

→ echo '{ `display-name` = "hello world" }' | dhall-to-yaml-ng
"display-name": hello world

Is there any reason to quote the key when it contains a - ?

@PierreR PierreR changed the title dhall-to-yaml-ng output differs from dhall-to-yaml in an odd way dhall-to-yaml-ng quotes the keys that contain a dash while dhall-to-yaml does not Jun 21, 2020
@sjakobi
Copy link
Collaborator

sjakobi commented Jun 21, 2020

I think the underlying issue is haskell-hvr/HsYAML#37.

@PierreR
Copy link
Contributor Author

PierreR commented Jun 21, 2020

@sjakobi thanks ! The activity on that repo doesn't look promising for the future, does it ?

@sjakobi
Copy link
Collaborator

sjakobi commented Jun 21, 2020

It's hard to say. If someone would provide a fix it could be released fairly soon, I guess. The maintainer is quite busy though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants