-
Notifications
You must be signed in to change notification settings - Fork 65
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
Does the error case QLJ7 indicate a breaking change between 1.1 and 1.2? #45
Comments
Yes, this is actually something that changed.
The point is probably, that you should be able to take out a YAML document of a file or stream and put it elsewhere, and it should work the same. |
Thank you for the explanation. I have two follow-up questions:
Given: %YAML 1.1
---
x: 0
---
x: 1 is it so that the first document version is explicitly v1.1 and second is implicitly v1.2 (provided the implementation uses 1.2 as default version)? And to make this implicit v1.2 inference of second document explicitly clear, it would require explicit %YAML 1.1
---
x: 0
...
%YAML 1.2
---
x: 1
...
Lets say that processor has a configuration option called |
The spec doesn't actually cover how a stream of documents from more than one YAML version should be handled, so your examples are getting into implementation-specific behaviour. Speaking on behalf of import YAML from 'yaml'
const src11 = `
%YAML 1.1
---
x: 0
---
x: 1`
const stream = YAML.parseAllDocuments(src11, { version: '1.2' )
stream.map(doc => doc.version) // [ '1.1', '1.1' ]
stream.map(doc => doc.toJSON()) // [ { x: 0 }, { x: 1 } ] For YAML 1.2, that doesn't work though, because its spec doesn't consider preceding documents: const src12 = `
%YAML 1.2
---
x: 0
---
x: 1`
const stream = YAML.parseAllDocuments(src12, { version: '1.1' )
stream.map(doc => doc.version) // [ '1.2', null ]
stream.map(doc => doc.schema.name) // [ 'core', 'yaml-1.1' ]
stream.map(doc => doc.toJSON()) // [ { x: 0 }, { x: 1 } ] |
Hello @perlpunk, I just wanted to confirm whether this was a breaking change from YAML 1.1 in 1.2?
1.1 spec states (https://yaml.org/spec/1.1/#l-first-document):
1.2 spec states (https://yaml.org/spec/1.2/spec.html#id2784064):
My current understanding is:
should parse, but by replacing
1.1
with1.2
, it should fail.Thanks!
The text was updated successfully, but these errors were encountered: