Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building a shared collection of useful YAML tags/types #464

Closed
eemeli opened this issue Apr 14, 2023 · 1 comment
Closed

Building a shared collection of useful YAML tags/types #464

eemeli opened this issue Apr 14, 2023 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@eemeli
Copy link
Owner

eemeli commented Apr 14, 2023

As discussed in #457 (comment), it seems like it might be useful to put together a collection of YAML tags for JS data types. This is now getting built here: eemeli/yaml-types.

As I mention in its contribution guide:

Additions to this library are very welcome! Many data types are useful beyond any single project, and while the core yaml library is mostly limited to the YAML spec, no such restriction applies here.

While working at this, I'm also hitting a couple of minor issues that'll need fixing here, in particular regarding TS types.

@eemeli eemeli added enhancement New feature or request help wanted Extra attention is needed labels Apr 14, 2023
@eemeli eemeli pinned this issue Apr 14, 2023
@isaacs
Copy link
Contributor

isaacs commented Apr 21, 2023

tap-yaml provides these, which are useful in a node test environment:

  • symbol
  • shared symbol
  • error (YAMLMap, but omits node's domain properties if present, and always shows name/message even if not enumerable)
  • regexp (scalar string, with the !re tag)
  • function (block literal of ${name}\n${toString}, toJSON() returns a no-op function with matching toString() return and name property)
  • null object (YAMLMap, but toJSON() starts with Object.create(null))
  • domain (just an empty YAMLMap, those objects have a zillion references that are super noisy)
  • date (similar to timestamp, but must be a full ISO 8601 UTC string; planning to stop producing these and move to just !timestamp, but keep them in the tap-yaml parser in case any are out there in the wild still)

I will probably eventually need to add custom tags for various browser things as well. Eg, it'd be nice if dom nodes were yaml encoded as their outerHTML string or something. React components also will likely need some special treatment.

@eemeli eemeli closed this as completed Feb 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants