Reuse a hash in YAML

Try reusing a full group by importing it: Defaults: &defaults Company: foo Item: 123 Computer: <<: *defaults Price: 3000 Documentation:

If condition possible in yaml file?

As a supplement to Vaibhav’s response: although yml does not inherently support if statements, some applications that use yml files for instructions may be able to parse if statements included in the yml. GitLab is one notable example. In GitLab’s CI/CD, the .gitlab-ci.yml file can be configured to include if statements such as: job: script: … Read more

Specifying the string-value ‘Yes’ in YAML

It depends 😉 In YAML 1.1 the bool type is defined as following: A Boolean represents a true/false value. Booleans are formatted as English words (“true”/“false”, “yes”/“no” or “on”/“off”) for readability and may be abbreviated as a single character “y”/“n” or “Y”/“N”. The regexp the parser should use is y|Y|yes|Yes|YES|n|N|no|No|NO| true|True|TRUE|false|False|FALSE| on|On|ON|off|Off|OFF In YAML 1.2.2 … Read more

How do you put HTML or XML into a YAML?

Example Here is a sample record from a YAML-based snippet management system I created years ago: – caption: fieldset msie5 tinycap: fieldset domain: html desc: fieldset and legend tag wwbody: | <fieldset> <legend>legend</legend> </fieldset> You can repeat that or something like it for all the snippets you want to manage. This particular system stores the … Read more

Multi-line literals in swagger editor?

I believe the problem is the way you started the text on your description block. It must be indented one level to the right of description: Here’s an example of something that works for me: /{user-id}: get: summary: Facebook User description: | Displays all information about a Facebook user, depending on access privileges. Displays all … Read more