-
Notifications
You must be signed in to change notification settings - Fork 517
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 #116
Comments
Having just started a project which is also my first use of YAML, and reading the official documentation, I've been wondering why "%YAML 1.2" at the start of the file was throwing errors. I take it there's still no support for this ? |
Any updates on this issue? |
I have some ideas on how to implement it.
I created a temporary repo with test data for that: yaml-test-schema Apart from that we need: I could start with creating the resolvers/constructors, so that they can already be loaded explicitly. In YAML::PP I implemented it like this. I added an option for the yaml version that can take the following values:
|
@perlpunk what would be the default if no I think it needs to be 1.1, with a deprecation period. I'd like the default to eventually be the most recent version. I like this plan to move to 1.2 support overall and suggest we move towards making it happen. |
1.1 for now
This could be problematic, and a lot of work. What should we do if we encounter
I experimented already a bit (with implementing point 1) and can try to push my branch the next days. It includes a lot of moving functions around, but isn't complicated. |
When you're talking about adding a As far as how to implement it, couldn't we just take the existing YAML 1.2 parser from ruyaml/ruamel.yaml? That seems easier than translating the Perl version. Indeed, in the short term we could probably enable the easiest case (adding a |
@dHannasch I think we should differentiate between the parser and the loader/resolver. Regarding the parser, both pyyaml and ruamel diverge from the spec and do not fully support YAML 1.1 or 1.2. Regarding ruamel as a dependency: if users want to process YAML 1.2, they can already use ruamel. Regarding the loader/resolver: Implementing the rules is not that difficult, as I said. If we use the existing test data, it will simply be a lot to write. So I am not sure where you would actually use ruamel code and how much sense that would make.
Something like that, yes. |
I made a branch that allows |
#555 Support for the YAML 1.2 Core and JSON schemas |
It's been 5 years...is it going to be decided if YAML 1.2 will be supported by PyYAML? If not, should PyYAML be consider deprecated as a YAML parser? YAML 1.2 released in 2009. PyYAML at the very least could reference other parsers to use instead of choking itself out with the safe_loader() when it finds a YAML tag. I had to go on a time traveling scavenger hunt to understand the current reason why PyYAML is still throwing the error of Seems like 1.2 support should of been in PyYAML 6.0 as seen here - #555 but it was passed up. Maybe it'll turn up in 7.0? In either case this is what got me past the error:
|
Whether a YAML file contains a tag Please don't mix different issues here. thanks. |
Having |
If you need 1.2 support and haven't read it yet, please checkout my other comment here about a new library on top of PyYAML for YAML 1.2 Core Schema support |
I maintain https://github.com/kislyuk/yq, and as seen in kislyuk/yq#10, the lack of YAML 1.2 support in this library is a hindrance to parsing YAML in a consistent "least surprise" manner. Recognizing the time constraints that the maintainers face, is there any roadmap or guidance on how YAML 1.2 support may be introduced into PyYAML (either from ruamel.yaml or otherwise)? Any implementation guidance for potential contributors who might work on a PR?
The text was updated successfully, but these errors were encountered: