• moonpiedumplings@programming.dev
    link
    fedilink
    English
    arrow-up
    3
    ·
    19 hours ago

    Try the yaml language server by red hat, it comes with a docker compose validator.

    But in general, off the top of my head, dashes = list. No dashes is a dictionary.

    So this is a list:

    thing:
        - 1
        - 2
    

    And this is a dictionary:

    dict:
        key1: value1
        key2: value2
    

    And then when they can be combined into a list of dictionaries.

    listofdicts:
        - key1dict1: value1dict1
        - key1dict2: value1dict2
          key2dict2: value2dict2
    

    And then abother thing to note is that yaml wilL convert things into a string. So if you have ports 8080:80, this will be converted into a string, which is a clue that this is a string in a list, rather than a dictionary.