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

YAML 1.2 support #20

Open
SoniEx2 opened this issue Oct 8, 2016 · 20 comments
Open

YAML 1.2 support #20

SoniEx2 opened this issue Oct 8, 2016 · 20 comments

Comments

@SoniEx2
Copy link

SoniEx2 commented Oct 8, 2016

Hi, I'd like YAML 1.2 support.

@ingydotnet
Copy link
Member

The next step is to make a list of the changes needed to get there.

@SoniEx2
Copy link
Author

SoniEx2 commented Oct 11, 2016

Is "start from scratch" a valid change?

@sigmavirus24
Copy link
Contributor

@SoniEx2 you mean, rm libyaml and start a new?

@SoniEx2
Copy link
Author

SoniEx2 commented Oct 11, 2016

@sigmavirus24 Yes.

@sigmavirus24
Copy link
Contributor

That may be a valid change, but it's not a change that would happen without good reasoning. What reasoning do you have for wanting to start from scratch? Further, if that's your desired first step, why not write a different implementation from scratch and forget this project? That's the easiest way to start from scratch.

@SoniEx2
Copy link
Author

SoniEx2 commented Oct 11, 2016

Refactoring is good. rm -rf is only the most extreme form of it.

@polyzen
Copy link

polyzen commented Mar 26, 2017

The next step is to make a list of the changes needed to get there.

https://yaml.readthedocs.io/en/latest/pyyaml.html#defaulting-to-yaml-1-2-support

sigmavirus24 pushed a commit to sigmavirus24/libyaml that referenced this issue Apr 6, 2017
Promising oss-fuzz in /src/oss-fuzz creates lots of confusion about where files come from.
Let's make everything explicit.

Fixes yaml#20
@EvanCarroll
Copy link

Just for reference from the 1.2 spec

The primary objective of this revision is to bring YAML into compliance with JSON as an official subset. YAML 1.2 is compatible with 1.1 for most practical applications - this is a minor revision. An expected source of incompatibility with prior versions of YAML, especially the syck implementation, is the change in implicit typing rules. We have removed unique implicit typing rules and have updated these rules to align them with JSON's productions. In this version of YAML, boolean values may be serialized as “true” or “false”; the empty scalar as “null”. Unquoted numeric values are a superset of JSON's numeric production. Other changes in the specification were the removal of the Unicode line breaks and production bug fixes. We also define 3 built-in implicit typing rule sets: untyped, strict JSON, and a more flexible YAML rule set that extends JSON typing.

@spgarbet
Copy link

spgarbet commented Feb 3, 2020

Looks like most of the changes are dropped features. I would posit that most of the upgrade would be just dropping some tokens from the parse tree. Or course, I've been bitten by things that seem so simple in the past. There is an additional escape added. This upgrade has been lingering for several years and there's even a stale branch that claimed to be the 1.2 upgrade.

If someone submitted a pull request, with tests to upgrade to 1.2 would this push this along?

@perlpunk
Copy link
Member

perlpunk commented Feb 3, 2020

I think we should make a list of things that need to be changed.
I started listing the changes between 1.1 and 1.2 a while ago:
https://github.com/yaml/yaml/wiki/YAML-1.2-Changelog

There are probably more changes, but I think they are mostly removing ambiguity from the 1.1 spec.

Can you think of anything else I should add?

perlpunk added a commit that referenced this issue Mar 30, 2020
This will allow `%YAML 1.2` directives.

See also #20

No changes are needed regarding tag directives.

In YAML 1.2 tag directives are for the following document only.
This is already implemented like that in libyaml.

We would rather have to fix the code if we want to have the correct behaviour
(global directives) in YAML 1.1. This would be a bit more complicated, as we
would have to save the default version and the current version in the parser
object.

New passing parser tests:

* 27NA: Spec Example 5.9. Directive Indicator
* 6ZKB: Spec Example 9.6. Stream
* 9DXL: Spec Example 9.6. Stream [1.3]
* RTP8: Spec Example 9.2. Document Markers

New failing error parser tests (before they were errors for the wrong reason):

* EB22: Missing document-end marker before directive
* RHX7: YAML directive without document end marker
@perlpunk
Copy link
Member

Actually number 6 (Directives are not global anymore) is not implemented correctly in libyaml currently. Directives are not global.
That means we could actually support %YAML 1.2 simply by adding one condition to the relevant if statement.

Fixing global directives for 1.1 would also be possible, but the question is if we want this.

I created #172

perlpunk added a commit that referenced this issue Apr 5, 2020
This will simply allow `%YAML 1.2` directives additionally to `%YAML 1.1`.
There is no change in behaviour.

See also #20

No changes are needed regarding tag directives.

In YAML 1.2 tag directives are for the following document only.
This is already implemented like that in libyaml.

We would rather have to fix the code if we want to have the correct behaviour
(global directives) in YAML 1.1. This would be a bit more complicated, as we
would have to save the default version and the current version in the parser
object.

New passing parser tests:

* 27NA: Spec Example 5.9. Directive Indicator
* 6ZKB: Spec Example 9.6. Stream
* 9DXL: Spec Example 9.6. Stream [1.3]
* RTP8: Spec Example 9.2. Document Markers

New failing error parser tests (before they were errors for the wrong reason):

* EB22: Missing document-end marker before directive
* RHX7: YAML directive without document end marker
perlpunk added a commit that referenced this issue Apr 10, 2020
This will simply allow `%YAML 1.2` directives additionally to `%YAML 1.1`.
There is no change in behaviour.

See also #20

No changes are needed regarding tag directives.

In YAML 1.2 tag directives are for the following document only.
This is already implemented like that in libyaml.

We would rather have to fix the code if we want to have the correct behaviour
(global directives) in YAML 1.1. This would be a bit more complicated, as we
would have to save the default version and the current version in the parser
object.

New passing parser tests:

* 27NA: Spec Example 5.9. Directive Indicator
* 6ZKB: Spec Example 9.6. Stream
* 9DXL: Spec Example 9.6. Stream [1.3]
* RTP8: Spec Example 9.2. Document Markers

New failing error parser tests (before they were errors for the wrong reason):

* EB22: Missing document-end marker before directive
* RHX7: YAML directive without document end marker
perlpunk added a commit that referenced this issue Apr 10, 2020
This will simply allow `%YAML 1.2` directives additionally to `%YAML 1.1`.
There is no change in behaviour.

See also #20

No changes are needed regarding tag directives.

In YAML 1.2 tag directives are for the following document only.
This is already implemented like that in libyaml.

We would rather have to fix the code if we want to have the correct behaviour
(global directives) in YAML 1.1. This would be a bit more complicated, as we
would have to save the default version and the current version in the parser
object.

New passing parser tests:

* 27NA: Spec Example 5.9. Directive Indicator
* 6ZKB: Spec Example 9.6. Stream
* 9DXL: Spec Example 9.6. Stream [1.3]
* RTP8: Spec Example 9.2. Document Markers

New failing error parser tests (before they were errors for the wrong reason):

* EB22: Missing document-end marker before directive
* RHX7: YAML directive without document end marker
@rriemann
Copy link

#172 was merged. How far is now 1.2 support?

@andry81
Copy link

andry81 commented Oct 23, 2020

May be it is not my business, but the idea "YAML is a superset of JSON" is a bad idea at very beginning.

@andypost
Copy link

As i see inital support for 1.2 already released as 0.2.3 (2020-04-11) but not clear what's left to do

@spgarbet
Copy link

How does one compile the library to get the closest 1.2 support? Are there any configure options?

@perlpunk
Copy link
Member

perlpunk commented May 29, 2023

See https://github.com/yaml/libyaml/wiki/YAML-1.2 for the status on YAML 1.2.
There are no configure options regarding that, it is already close to YAML 1.2 by default.

@perlpunk
Copy link
Member

Note that there are other things where libyaml diverges from the spec, that don't have anything to do with the differences of 1.1 and 1.2.

I collected those cases for libyaml and pyyaml together here: https://github.com/yaml/pyyaml/wiki/Testsuite---Failing-cases

@andry81
Copy link

andry81 commented May 29, 2023

edited by @perlpunk and split out to #269

@perlpunk
Copy link
Member

@andry81 that has nothing to do with YAML 1.2 support, so it doesn't belong in this issue.

@perlpunk
Copy link
Member

I recommend to try out libfyaml. It fully supports YAML 1.2. Depending on your use cases it might already have every functionality you need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants