News for hackers. Stuff that matters.
Re:The YAML Document from Hell by CipherThrowaway on Thursday January 12, 2023 @06:08AM (#34351883)
> Thinking that JSON is a suitable replacement, imagine writing Ansible or k8s stuff in it; that would be fun ;)

Writing in YAML doesn't feel much better. YMMV but I've been on teams using Pulumi for k8s and the developer experience has been significantly better. I can automate, type check, lint, click through to definitions the same way I do with other typescript.

Pulumi is a young product with many rough edges but it's already been a game changer for me.

Re:The YAML Document from Hell by ilyt on Thursday January 12, 2023 @08:24AM (#34353097)
It's very simple actually.

... just fucking don't, generate config in your configuration management tool of choice and then serialize it to YAML. You get all of the advantages (nice to read)and none of the disadvantages (need editor or it is PITA)

Re:The YAML Document from Hell by cocochanel on Thursday January 12, 2023 @08:29AM (#34353166)
I checked the sample Kubernetes project in Java [0] and it looks hideous. YAML looks much better in comparison.

[0] https://www.pulumi.com/docs/get-started/kubernetes/review-pr...

Re:The YAML Document from Hell by CipherThrowaway on Thursday January 12, 2023 @08:41AM (#34353320)
Don't disagree there. Java support is less than a year old and the Java API is.. not great. TypeScript is the more popular and mature choice.
Re:The YAML Document from Hell by danudey on Thursday January 12, 2023 @04:33PM (#34360548)
What, you mean you don't want to write code like

  Deployment("nginx",DeploymentArgs.builder().spec(DeploymentSpecArgs.builder().selector(LabelSelectorArgs.builder().matchLabels(labels).build()).replicas(1).template(PodTemplateSpecArgs.builder().metadata(ObjectMetaArgs.builder().labels(labels).build()).spec(PodSpecArgs.builder().containers(ContainerArgs.builder().name("nginx").image("nginx").ports(ContainerPortArgs.builder().containerPort(80).build()).build()).build()).build()).build()).build());
Re:The YAML Document from Hell by lifehasleft on Friday January 13, 2023 @09:36AM (#34368255)
I actually laughed out loud when I looked at the example and just saw a bunch of carefully-indented “.build()”s
Re:The YAML Document from Hell by brnewd on Thursday January 12, 2023 @08:48AM (#34353404)
I would love to swap Pulumi for Ansible, but it's cloud-only for the most part.
Re:The YAML Document from Hell by PaulHoule on Thursday January 12, 2023 @10:52AM (#34355356)
JSON has no comments. That disqualifies it immediately.
Re:The YAML Document from Hell by bogwog on Thursday January 12, 2023 @11:06AM (#34355595)

    {
        “/*These are the ports we use”: “*/”,
        “ports”: [22, 80, 443]
    }
Re:The YAML Document from Hell by ok123456 on Thursday January 12, 2023 @12:02PM (#34356746)
Now, write a json-schema for that.
Re:The YAML Document from Hell by dtech on Thursday January 12, 2023 @12:39PM (#34357439)
Can be done by either additionalProperties: true and not specifying the property, or "patternProperties": { "^/\*": { "type": "string" }}.
Re:The YAML Document from Hell by ok123456 on Thursday January 12, 2023 @02:58PM (#34359444)
I'd rather have real comments than this epicycle.
Re:The YAML Document from Hell by nawgz on Thursday January 12, 2023 @12:56PM (#34357719)
"additionalProperties": true
Re:The YAML Document from Hell by deterministic on Friday January 13, 2023 @07:13PM (#34375745)
“Comment”: ”This is a comment that is optional and ignored by code”
Re:The YAML Document from Hell by zvr on Sunday January 15, 2023 @06:40AM (#34388681)
"Comment": "but you can only have one per object"
Re:The YAML Document from Hell by deterministic on Monday January 16, 2023 @02:45AM (#34397997)
"Comment1": "This is the first comment"

"Comment2": "This is the next comment"

or

"Comments": ["Here is one", "Here is another!"]

or

"Comments": { "Name": "This is the name of the customer", "Age": "This is the age (0 to 1000) of the customer" }

or

"Values": [ {"Name":"Age", "Value":"20", "Comment":"This is the age of the customer"}, {"Name":"Name", "Value":"Mr. Foo Bar", "Comment":"This is the name of the customer"} ]

The only limit is your imagination.

Re:The YAML Document from Hell by int_19h on Thursday January 12, 2023 @04:12PM (#34360316)
Many JSON dialects do in practice.