JSON support in Archy

Hello

Currently, the Archy tool allows to manage flows in YAML format. However, sometimes that format can be difficult to process automatically (and the Welcome to Archy page says that [...] Archy is intended for use in automated environments.).

In fact, when parsing YAML files, many languages just transform them to a JSON-like object (as YAML is already a superset of JSON). But as each YAML parser works differently, it can lead to some problems.

For example, this can happen:

  1. original.yaml -> parsed_yaml_object
  2. parsed_yaml_object -> new.yaml
  3. original.yaml is different from new.yaml !!!!!!!!

And this is not the only problem with YAML...

So my question is... Would it be too difficult to implement support for JSON files? Have you planned to include it in the roadmap?

Can you provide details about the specific issues you're running into generating a YAML document?

Some examples that come to my mind:

  1. YAML 1.2 is enforced, as previous versions would turn terms like "yes" and "no" to booleans. And for example, Decision actions use those keys
  2. Depending on the yaml parser/dumper, it can do some things that can make Archy to fail, like:
    • Use simple quotes instead of the double quotes
    • Use different indentation
    • Add/Remove some quotes to some strings
  3. It may mess with the order of map elements, which makes it more difficult to compare flows using text diff tools.

JSON is much safer to use, many programming languages support it natively without having to install external dependencies... And, as YAML is a superset of JSON, I supposed it wouldn't be that difficult to add support for it too.

This means you'll need to use a YAML 1.2 compliant library to generate YAML files for Archy. Internally, the Archy tool is using https://www.npmjs.com/package/js-yaml to parse the files. If you use that too (if you're in a JS environment), you shouldn't have any issues generating valid files.

Archy's YAML parser is known to be tolerant of single or double quotes for strings. Can you provide an archy file where single quotes cause an error?

Same as the previous, can you provide an archy file that causes an indentation-based error with archy?

Quotes are optional in YAML unless there are characters in the value that will confuse the parser (e.g. colons). Are you reporting a problem with archy here or is this just something you don't like about YAML?

This is expected, mapping keys do not have an order. Maps must always be compared by presence of keys, not by the order of the keys.

You can request new features and share your use case at https://genesyscloud.ideas.aha.io/ideas.

Hello Tim

Thank you! It is nice to know which package you are using, so we could use the same :smiley:

Sadly, I do not have sample files right now. I just remembered that once, I got some Archy errors, that where gone after messing up with the YAML tool configuration regarding quotes and indentation.

These are not problems with archy itself (although I think that the quotes that it always puts in the Refs are not necessary in all cases). The thing is that for comparing flows, it is very useful to use tools that compare text. And as YAML has that freedom in its format, then it cause that functionally equal YAMLs are detected as different with those tools. JSON is has a more strict format, so it is more consistent. This point was about convenience, more than anything.

Yes, but the Ideas in the Ideas portal many times tend to be abandoned and forgotten. And as I suspect that Archy is not a tool that everybody uses, I think it would not get many votes either. So I wanted to ask first here, to know what were your thoughts about it.
Also, as you said that Archy uses Javascript, I guess it wouldn't be that hard to include that option, right? I mean, JSON comes from Javascript, so... Wouldn't it be just parse/dump it in one format or another?

The ideas portal is the only way to request features. Having a discussion on the forum does not affect prioritization, but posting ideas on the ideas portal does. There's no guarantee that making a post will result in the feature being implemented. But there is a guarantee that if you don't submit an idea, product management won't see it and your request will never be considered.

Thank you, Tim. Yes, I will consider posting the Idea in the Ideas Portal. This was only to discuss its viability beforehand, and to check if you already had it in the roadmap.

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