Parse YAML workaround. See #875.
This PR
- modify the parser to accept YAML instead of JSON
Notes
I tried to bundle the editor with npm run build:editor, but it does not seem to work on my PC, while just modifying the .js works.
- Certainly need to update the source for any such change. The generated code will be overwritten.
- This is probably a more involved discussion. The playground code doesn't yet handle the YAML-LD spec. I'm guessing you at least want the minimal feature of parsing JSON-LD that was serialized as YAML. That's fine, but I think the playground should also be able to have a mode that only accepts valid JSON. Which probably means the parsing type needs to be a choice. I'm not sure how that should all work.
I tried to bundle the editor with npm run build:editor, but it does not seem to work on my PC, while just modifying the .js works.
@ioggstream what bundling error did you experience? I'd like to make sure that's fixed.
I like the intent of this PR! I'll see about getting it in via a pre-built code change and probably also some UX affordances to make sure it's clear one could do either.
However, I agree with @davidlehn that we also need to have an eye on any requirements/tweaks introduced to "just YAML" by the YAML-LD spec. @anatoly-scherbakov can probably advise where it may go beyond a simple YAML.parse() operation. At minimum, I think we'd need to throw errors if/when more advanced YAML features appear in the document.
Definitely something we want to see happen, though!
The YAML-LD spec does not forbid advanced YAML features, it just warns that documents with such features will be not round-trippable. Which is fair. Other than that users can write whatever valid YAML they wish.