Configuration files with parameter extensions (#174, #203) can break workflow builds since key names are dumped to config.yaml as :Name rather than ":Name". This can cause issues when parsing the parameters back into GRAPEVNE. The issue could be resolved by forcing all keys to be dumped as quoted strings.
The config.yaml files are dumped by the builder (Python) component. A potential implementation to fix this issue would be to provide a custom key representer, e.g.
import yaml
from yaml.representer import SafeRepresenter
# Define a custom representer to always quote keys
class QuotedKey(str):
pass
def quoted_key_representer(dumper, data):
return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='"')
# Add the custom representer to the SafeRepresenter
yaml.add_representer(QuotedKey, quoted_key_representer, Dumper=yaml.SafeDumper)
# Example dictionary
data = {
QuotedKey('key1'): 'value1',
QuotedKey('key2'): 'value2'
}
# Dump the dictionary with quoted keys
yaml_str = yaml.dump(data, Dumper=yaml.SafeDumper)
print(yaml_str)
Configuration files with parameter extensions (#174, #203) can break workflow builds since key names are dumped to
config.yaml
as:Name
rather than":Name"
. This can cause issues when parsing the parameters back into GRAPEVNE. The issue could be resolved by forcing all keys to be dumped as quoted strings.The
config.yaml
files are dumped by thebuilder
(Python) component. A potential implementation to fix this issue would be to provide a custom key representer, e.g.This will produce
as opposed to