pypyr.steps.fetchyaml permalink

load & parse yaml permalink

Loads a yaml file into the pypyr context.

This step requires the following key in the pypyr context:

 - name: pypyr.steps.fetchyaml
    description: fetch yaml from path
    in:
      fetchYaml:
        path: ./path.yaml # required. path to file on disk. can be relative.
        key: destinationKey # optional. write yaml to this context key.

If you do not specify key, yaml writes directly to context root.

If you do not want to specify a key, you can also use the streamlined format:

 - name: pypyr.steps.fetchyaml
    description: fetch yaml with simplified path input
    in:
      fetchYaml: ./path.yaml # required. path to file on disk. can be relative.

All inputs support substitutions.

See some worked examples of fetchyaml.

merging logic permalink

pypyr will parse the yaml from the file and merge it into the pypyr context. This will overwrite existing values if the same keys are already in there.

I.e if file yaml has

eggs: boiled

but context {'eggs': 'fried'} already exists, after fetchyaml context will be:

eggs: fried

input yaml structure permalink

If you do not specify key, the yaml should NOT be a list at the top level, but rather a mapping.

So the top-level yaml should not look like this:

- eggs
- ham

but rather like this:

breakfastOfChampions:
  - eggs
  - ham

see also

last updated on .