Questions tagged [yaml]

Use this tag for questions about the YAML data serialization format only, not for questions about programs (or examples) that happen to have their configuration in a YAML format. Questions about the CSS framework also called YAML should be tagged [yaml-css] instead.

From the Wikipedia article about YAML:

YAML (/ˈjæməl/, rhymes with camel) is a human-readable data serialization language that takes concepts from programming languages such as C, Perl, and Python, and ideas from XML and the data format of electronic mail (RFC 2822). YAML was first proposed by Clark Evans in 2001, who designed it together with Ingy döt Net and Oren Ben-Kiki. It is available for several programming languages.

YAML is a recursive acronym for "YAML Ain't Markup Language". Early in its development, YAML was said to mean "Yet Another Markup Language", but it was then reinterpreted (backronyming the original acronym) to distinguish its purpose as data-oriented, rather than document markup.

Features:

  • Its familiar indented outline and lean appearance make it especially suited for tasks where humans are likely to view or edit data structures, such as configuration files, dumping during debugging, and document headers.
  • Although well-suited for hierarchical data representation, it also has a compact syntax for relational data as well.
  • A major part of its accessibility comes from eschewing the use of enclosures like quotation marks, brackets, braces, and open/close-tags, which can be hard for the human eye to balance in nested hierarchies.

See also

Related tags

15259 questions
91
votes
4 answers

application.yml vs application.properties for Spring Boot

In my project i'm currently using application.yml for configuration. Spring Initializr generate application.properties? What are the Pro/Cons for each one?
cupakob
  • 8,411
  • 24
  • 67
  • 76
91
votes
11 answers

Validating a yaml document in python

One of the benefits of XML is being able to validate a document against an XSD. YAML doesn't have this feature, so how can I validate that the YAML document I open is in the format expected by my application?
Jon
  • 9,815
  • 9
  • 46
  • 67
89
votes
6 answers

Set root logging level in application.yml

I used an application.properties with Spring Boot (1.3 M1) and started to translate it into a yaml file because it grew more and more complex. But I have problems translating this into…
Marged
  • 10,577
  • 10
  • 57
  • 99
88
votes
5 answers

If YAML ain't markup language, what is it?

I fail to see what makes YAML any less of a markup language than XML. The purpose of a markup language is to define the structure of a document, and YAML does exactly that (YAML stands for YAML ain't markup language). What YAML should instead stand…
desbest
  • 4,746
  • 11
  • 51
  • 84
85
votes
7 answers

Embedding JSON Data into YAML file

I am writing a fixture for my table. And a one of the coloums takes in a JSON string as a value. The problem is the fixture is not loading failing as: Fixture::FormatError: a YAML error occurred parsing…
Saurajeet
  • 1,088
  • 2
  • 8
  • 10
85
votes
3 answers

Reuse portion of github action across jobs

I have a workflow for CI in a monorepo, for this workflow two projects end up being built. The jobs run fine, however, I'm wondering if there is a way to remove the duplication in this workflow.yml file with the setting up of the runner for the job.…
Brad Martin
  • 5,637
  • 4
  • 28
  • 44
82
votes
7 answers

AWS SAM YAML template - Unknown Tag !Ref

When I try to deploy my AWS SAM YAML file, it fails saying the !Ref is an unknown tag. Any ideas to get around this? AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Resources: MySimpleFunction: Type:…
EdsonF
  • 2,719
  • 3
  • 30
  • 34
82
votes
6 answers

jinja2 how to remove trailing newline

I'm using jinja 2 to output a yaml file but can't seem to get rid of a trailing newline and the end of a for loop. Eg the below - request: path: {{ path }} headers: origin: 'somedomain.com' user-agent: 'agent' …
Yunti
  • 6,761
  • 12
  • 61
  • 106
81
votes
1 answer

Reading YAML file with Python results in yaml.composer.ComposerError: expected a single document in the stream

I have a yaml file that looks like --- level_1: "test" level_2: 'NetApp, SOFS, ZFS Creation' request: 341570 --- level_1: "test" level_2: 'NetApp, SOFS, ZFS Creation' request: 341569 --- level_1: "test" level_2: 'NetApp, SOFS, ZFS Creation' request:…
Sriharsha
  • 2,373
  • 1
  • 16
  • 20
80
votes
2 answers

YAML mapping values are not allowed in this context

I am trying to configure a YAML file in this format: jobs: - name: A - schedule: "0 0/5 * 1/1 * ? *" - type: mongodb.cluster - config: - host: mongodb://localhost:27017/admin?replicaSet=rs - minSecondaries: 2 -…
Chris Edwards
  • 1,518
  • 2
  • 13
  • 23
79
votes
19 answers

Docker-Compose file has yaml.scanner.ScannerError

compose.yml file, which looks like this: version: '2' services: discovery-microservice: build: discovery-microservice context: /discovery-microservice/target/docker dockerfile: Dockerfile ports: - "8761:8761" While I am…
Skeffington
  • 1,281
  • 2
  • 10
  • 13
78
votes
3 answers

Multiple YAML build pipelines in Azure DevOps

I'm currently trying to create multiple build pipelines for my Angular app in Azure DevOps using the new YAML way. I used to create a new build pipeline for the different environments I've set up (dev, staging, prod) when I was using the "legacy"…
Thomas
  • 4,030
  • 4
  • 40
  • 79
77
votes
4 answers

How to read a YAML file

I have an issue with reading a YAML file. I think it's something in the file structure but I can't figure out what. YAML file: conf: hits:5 time:5000000 code: type conf struct { hits int64 `yaml:"hits"` time int64…
MIkCode
  • 2,655
  • 5
  • 28
  • 46
76
votes
4 answers

Save/dump a YAML file with comments in PyYAML

I have a yaml file that looks like this: # The following key opens a door key: value Is there a way I can load and dump this data while maintaining the comment?
Harley Holcombe
  • 175,848
  • 15
  • 70
  • 63
76
votes
29 answers

rails error, couldn't parse YAML

After updating the gems I've got this: /home/megas/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/psych.rb:148:in `parse': couldn't parse YAML at line 182 column 9 (Psych::SyntaxError) from…
megas
  • 21,401
  • 12
  • 79
  • 130