-
Notifications
You must be signed in to change notification settings - Fork 55
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
Remove timestamp examples from the 1.2 spec #268
Comments
Sounds good to me. I think we might be able to consider this errata in 1.2.2 and we could list it as such before publishing 1.2.3. Thoughts? |
Thanks @perlpunk for clarifying this. In this case, is the correct way of handling a date/time a string? |
See my answer in ruby/psych#262 |
Related: |
@perlpunk does this mean that |
Note - this won't remove references to `timestamp` type.
@ioggstream binary and timestamp aren't official tags anymore at all in 1.2 |
@perlpunk so https://yaml.org/type/ does not apply as an extension to YAML 1.2 ? |
@ioggstream I would say no, and if you have a look at the individual types under that link you will find "Working Draft 2005-01-18" on all of them, so they were actually never finalized at all. |
yaml.org/type is a sore spot that I've wanted to take down for a very long time. Clark put these up as ideas in 2005, and they just stuck around even though we never agreed on them, iirc. The 1.2.1 spec does reference that URL so we can't really take it down. Perhaps the best solution now is to do something like we do for https://spec.yaml.io/main/spec/1.3.0/ |
where can I find a rationale for the takedown?
I think the reason is that they actually have real-life use cases
Can you pls link me the section, since I wasn't able to find it? :P Since yaml aims to be extensible, which extension mechanisms do you envision? Thx++ |
I want to second that giving up on tags (especially datetime tags) may not be the best policy. JSON has a poor and underspecified set of scalar (literal) types, so to reliably transfer scalars, it's best to use strings with another field signifying the tag (RDF datatype, called I guess nothing stops us from defining XSD tags, eg something like this? %TAG ! http://www.w3.org/2001/XMLSchema#
dc:date: !dateTime 2022-05-18T14:07:00 |
Deleted comment on YAML-LD, which was in the wrong repo. Reproduced in json-ld/yaml-ld#17 (comment). |
You would think that would be legal, given the definition of ns-global-tag-prefix. The Ruby Psych implementation based on libyaml does not accept the trailing I'd expect the following to parse correctly: %YAML 1.2
%TAG ! http://www.w3.org/2001/XMLSchema#
---
"@context":
"@vocab": http://xmlns.com/foaf/0.1/
name: !string Gregg Kellogg
homepage: https://greggkellogg.net/
depiction: http://www.gravatar.com/avatar/42f948adff3afaa52249d963117af7c8
date: !date 2022-08-08 |
yamlpp-parse-emit is written in perl. And yes, that it accepts only |
Since Psych 4.0, the `safe_load` is used as default loading mechanism. There are just a few permitted classes and `Time` is not one of them [[1]]. This results it test failure: ~~~ Error: test_converting_to_yaml(DocumentTest::TestSimpleConventionallyNamedDocument): Psych::DisallowedClass: Tried to load unspecified class: Time ~~~ Please also note that in YAML specs 1.2, the `timestamp` is not listed as supported tag anymore [[2]]. Given that: 1) ronn-ng does not provide any supported way of loading the serialized YAML. 2) The `to_yaml` does not appear to be used internally/externally anywhere. 2) If there were users of this functionality, it would have been already know, reported and fixed at this moment. The best course of action is fixing the test case by listing the `Time` as valid class for parsing. Fixes apjanke#80 [1]: https://docs.ruby-lang.org/en/master/Psych.html#method-c-safe_load [2]: yaml/yaml-spec#268
Since Psych 4.0, the `safe_load` is used as default loading mechanism. There are just a few permitted classes and `Time` is not one of them [[1]]. This results it test failure: ~~~ Error: test_converting_to_yaml(DocumentTest::TestSimpleConventionallyNamedDocument): Psych::DisallowedClass: Tried to load unspecified class: Time ~~~ Please also note that in YAML specs 1.2, the `timestamp` is not listed as supported tag anymore [[2]]. Given that: 1) ronn-ng does not provide any supported way of loading the serialized YAML. 2) The `to_yaml` does not appear to be used internally/externally anywhere. 3) If there were users of this functionality, it would have been already know, reported and fixed at this moment. The best course of action is fixing the test case by listing the `Time` as valid class for parsing. Fixes apjanke#80 [1]: https://docs.ruby-lang.org/en/master/Psych.html#method-c-safe_load [2]: yaml/yaml-spec#268
Also relevant: 11ty/eleventy#413 |
👋 so here's my opinion (summarizing my comments at nodeca/js-yaml#477 (comment) & ruby/psych#262 (comment)) These other tickets are dealing with two cases:
These are real world concerns of users interacting with very widely deployed parsers, and we're not going to take those working "YAML" documents out of the universe. We can take the examples out, but the parser implementations aren't going remove support without a better alternative for users. But today the spec is way to ambiguous on its definition of timestamps. YAML 1.2 §10.1. Failsafe Schema doesn't actually provide any guidance about what to do with Example 2.22 Timestamps even though it's implied that it shouldn't need an explicit tag. I'm inclined to say we should defer to RFC 3339 Date and Time on the Internet: Timestamps §5.6 Internet Date/Time Format, which covers the
to instead have:
But then we don't either allow I think that a well specified standard would require not just that the date-time match the ABNF, but that it be a valid date. If we deferred to RFC3339, it says:
Which pretty clearly implies If we're throwing backward compatibility away, then referencing xmlschema dateTime with explicit tags is probably best, and we should add examples of its use instead of just removing timestamp examples. Either way, the spec should hold the answers to these implementation tickets. |
https://yaml.org/spec/1.2.2/#24-tags
Example 2.22:
This should be removed, as none of the 1.2 schemas provides a timestamp tag anymore, and it might confuse people.
I saw it mentioned here: ruby/psych#262 (comment)
The text was updated successfully, but these errors were encountered: