-
Notifications
You must be signed in to change notification settings - Fork 621
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
feat(encoding/yaml): Add support for JS types and user types #789
Conversation
}; | ||
|
||
const expected = `regexp: | ||
simple: !<tag:yaml.org,2002:js/regexp> /foobar/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so unfortunately, in js-yaml 3 (ported version of Deno), custom tags were dumped with !<tag:yaml.orf,2022:..>
, and it has been fixed in v4 (nodeca/js-yaml@a0d0caa)
it does works though, it's just the display which is a bit more verbose and less pretty
|
||
Deno.test({ | ||
name: | ||
"`!!js/*` yaml types are correctly handled with extended schema while stringifying", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice test!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests look very well (It has 81% diff coverage ref: https://github.com/denoland/deno_std/pull/789/checks?check_run_id=2079608904)
LGTM
This extends current YAML support with an
EXTENDED_SCHEMA
which supports!!js/regexp
,!!js/function
and!!js/undefined
to remove current Deno limitation (heavily based on nodeca/js-yaml-js-types but reworked a bit to be more succint).This also exposes the
Type
function (which is already implemented but not available to end-users) to allow the creation of custom types with!tags
as defined in YAML spec.