-
Notifications
You must be signed in to change notification settings - Fork 7
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 strings value are quoted differently if the first character is a number. #7
Comments
What to quote, when, and how, is very much a balancing act. We've gone back and forth many times (including on whether to quote single/simple words), and what we have now is the combination that seems the least upsetting. I think going back to quoting single words to accommodate the checksum example would not be worth it, as it would make common outputs like this very hard to read: apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: foo
name: "{{ .Release.Name }}-deployment"
spec:
replicas: 1
selector:
matchLabels:
app: foo
template:
metadata:
labels:
app: foo
name: "{{ .Release.Name }}-pod"
spec:
containers:
- command:
- /data/bin/foo
- "--port=7654"
image: ubuntu:latest
name: "{{ .Release.Name }}-container"
ports:
- containerPort: 7654
script: |
#!/bin/bash
echo hello world
volumeMounts:
- mountPath: /data/mount1
name: "{{ .Release.Name }}-volume-mount1"
- mountPath: /data/mount2
name: "{{ .Release.Name }}-volume-mount2" Single words are specifically not quoted to make this kind of output look familiar. The second example of an IP vs. IP/CIDR is an oddity, yeah. It's because we know it's safe to single-quote the first string, whereas the latter has symbols and we fall back to Aeson's encoding which is double-quoted. I would be happy to accept a PR that makes CIDR strings single-quoted so that those two are at least consistent. Might I also suggest using |
I agree the current status-quo is the least upsetting. I'll have a look to add a special case for IP/CIDR. Thank you for the detailed feedback. |
This change makes CIDR string encoded using the same quote as IP address. Fixes clovyr#7
The context for this is dhall-lang/dhall-haskell#1894 where I am wondering if a string value that contains a single word could always be quoted. This would enable a nicer output when the values are checksum, for example:
Instead of the current output:
Another odd behavior is regarding single vs double quote on this output:
The text was updated successfully, but these errors were encountered: