Archy YAML keys

Hello

I've seen that there might be a problem with the YAML files that the Archy tool uses. The thing is that in the Decision elements, it uses "yes" and "no" as keys for the outputs. In YAML, those values are considered booleans, and many YAML parsers do that translation. So, as it is now, it is impossible to use them to process those files.

For example, using the most used Python YAML processing package (pyyaml):

Code:

import yaml

with open('Test Archy Booleans_v1-0.yaml') as f:
    data = yaml.safe_load(f)

with open('Test Archy Booleans_v1-1.yaml', 'w') as f:
    yaml.dump(data, f)

Input:

# ...
  
  tasks:
    - task:
        name: Starting Task
        refId: Starting Task_12
        actions:
          - decision:
              name: Decision
              condition:
                lit: true
              outputs:
                yes:
                  actions:
                    - disconnect:
                        name: Disconnect
                no:
                  actions:
                    - disconnect:
                        name: Disconnect

Output:

# ...
  
  tasks:
    - task:
        name: Starting Task
        refId: Starting Task_12
        actions:
          - decision:
              name: Decision
              condition:
                lit: true
              outputs:
                true:
                  actions:
                    - disconnect:
                        name: Disconnect
                false:
                  actions:
                    - disconnect:
                        name: Disconnect

Hi Adrian,

I'd recommend trying putting your output names "yes" and "no" in quotes like this:

...
outputs:
  "yes":
    actions:
...

Archy accepts these quoted output names the same as unquoted output names, and your parser should hopefully treat string literals as such without trying to convert them.

Thanks,
Scott

Thank you Scott

Yes, that seems to work. But it means that I have to pre-process the YAML file as text, substituting all the yes and no to string literals, and then load it in the YAML parser.

I think that when the flow is exported using Archy or the "Export as .yaml" in Architect, it should already have that fields as strings.

Hi Adrian_Santamaria,

It does appear as though we should be quoting the yes/no outputs when exporting to YAML. This fix will be included with the next release of Archy. Thanks for reporting this issue!

Thanks,
Jon

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.