Hate YAML!

Park Sehun
3 min readJul 5, 2021

YAML stands for YAML (Not XML), and text-based, the human-readable language used in mainly pipeline tools. YAML is widely used in configuration files, like Circle CI, Travis CI, Azure DevOps, Jenkins, Sprint Boot, Docker, Chef, Ansible, Kubernetes, AWS CloudFormation and more. YAML has been started (around) since 2001 and the use of YAML is growing up quite quickly.

As we all know how useful it is, now I’m going to talk about why we need to stop using YAML. Of course, it will work if there is alternative one. I’m not against YAML engineering, I still think in many cases YAML is much better than JSON (No comment allowed) and (fxxkin) XML. But just warn that you need to consider SOMETHING when your engineering is heavily rely on YAML. Then we can be prepared before starting using YAML to have good to best practices in your YAML engineering.

(1) Human-readable?

Chef, Ansible, Kubernetes and many tools use YAML to provision large, complex enterprise infrastructure. In the YAML code, there are a lot of factors to be considered not only necessary resources to be provisioned but also many configurations, security settings, and variables required to launch the web engines. It may be ended up with 20,000 lines codes in 4–5 depths of the repository tree.

If you are the engineer to initiate the infrastructure, define all guidelines, standards and actually structure & code the YAML, you can understand 20,000 lines in 200 files. But the resources will be larger as the business goes larger and of course the engineers will repeat joining/leaving continuously. Without having documentations with diagrams, configurations, and definitions, your companies may no longer have master engineer who understand everything.

Hiring senior YAML engineer(?!)

(2) YAML specification is ambigous

YAML sometimes makes trouble when it’s not a declarative enough, but written in YAML. Then it will make you more hard to read them.

This may be true or false. But you can easily see the interpreted result from the same contents by parsing may be different from what it was defined yesterday.

ref: https://github.com/cblp/yaml-sucks

(3) IDE may not help you

Most of engineers are using their own (familiar) IDE based on what kind of language you are using. But as YAML is declartive language, IDE will only give you high-level error notifications if you are doing wrong. Rather you won’t get an error messages if the error is not detected by your IDE, as the code may be cryptic. You always need to understand specs to avoid the errors and detect them before you provision huge infrastructure. Here is some tips you can refer to. https://www.redhat.com/sysadmin/yaml-tips

Hm… it doesn’t actually look like too bad… comparing to using JSON, XML, and any other languages. But we can always make some viewpoints (Good practices) before using YAML.

  • Structure YAML files
  • Comments for next engineers
  • Read specs (documents for tools) carefully
  • Configure your IDE
  • Share good tips with your engineers

Of course, we also can find many anti-YAML solutions like

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response