Tabs in YAML may cause errors

Hello

I've seen a behavior that I do not know if it's a bug or not... It is about how the flows are exported in YAML format.

Let's suppose I have a flow that has an expression that includes tab (\t) characters. When it is exported, the YAML fragment would be something like this:

      - updateData:
          name: RNG y Output default
          statements:
            - string:
                variable: Task.output_element
                value:
                  exp: GetAt( 	Task.elements,  	Task.random_int % Count(Task.elements) )

(Note the TAB between GetAt( and Task.elements, and also before Task.random_int, inside the non-quoted string)

Although it does not make Archy fail, some YAML processing tools may do. For example, the Python's package ruamel.yaml fails when it tries to load that because of the tab.

Searching on the internet, I've seen several places saying that using tabs outside unquoted strings is discouraged. Though, I am unsure if that's a rule or just a recommendation.

It would be nice if when the flows were exported, the strings containing tabs were quoted, like:

      - updateData:
          name: RNG y Output default
          statements:
            - string:
                variable: Task.output_element
                value:
                  exp: "GetAt( 	Task.elements,  	Task.random_int % Count(Task.elements) )"

Hi @Adrian_Santamaria,

Thanks for reaching out on this! I agree with you and will make a ticket to look into adding quotes on strings that contain tab characters.

Thanks,
Jon

Thank you!

By the way, Tim once told me that the library that Archy uses for YAML handling is js-yaml - npm. I've made a test on my computer using that library. And although it can parse the unquoted strings with tabs without errors, when dumping it does indeed quote them. For example, this:

const yaml = require('js-yaml');

const text = 'a: hello\tworld';

const parsed = yaml.load(text);

console.log('Parsed yaml:');
console.log(parsed);

console.log('-------------');

const dumped = yaml.dump(parsed);

console.log('Dumped json:');
console.log(dumped);

Produces this output:

Parsed yaml:
{ a: 'hello\tworld' }
-------------
Dumped json:
a: "hello\tworld"

So I have no idea why when exporting the flows, it does not quote those strings.

Hello Jon

Could you please tell me the status of this? Our internal processes rely on parsing and editing YAMLs automatically, and it is breaking our pipelines :frowning:

Hi @Adrian_Santamaria,

Im planning an Archy release later this week or early next week with the change. No guarantees on this as it has to go through QA testing first but I will let you know when the fix is available!

Thanks,
Jon

1 Like

Hi @Adrian_Santamaria,

Archy version 2.24.1 should have a fix for yaml exports with tab characters. Let me know if this version resolves your issue.

Thanks,
Jon

Thank you, Jon. It looks like when exporting the flow using archy, it quotes those expressions successfully. HOWEVER, when exporting the YAML using the Architect UI, it doesn't. Could you have a look at it, please?

Hi @Adrian_Santamaria,

This will functionality will also be available with the next build of the Architect UI that is released.

Thanks,
Jon

Thank you Jon. Is there an ETA for that release?

@Adrian_Santamaria I believe we are targeting a new Architect UI release this week, but that is dependent on QA as well.

Thanks,
Jon

Hello Jon

I've just exported a flow using the Architect UI and it keeps not putting the quotes. Did this come out?

Hi @Adrian_Santamaria,

QA still has not approved a new Architect UI release for production. They are hoping to approve one by this week.

Thanks,
Jon

Hello all!

It looks like it has been released, as it is quoting those expressions now.

Thank you!

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