You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To my knowledge, strictyaml currently doesn't explicitly support reading multiple YAML documents within a single YAML stream.
For simple enough YAML documents, this is trivial to implement manually. Instead of calling
strictyaml.load(input)
I can call
strictyaml.load(input.split("\n---\n"))
This doesn't handle several edge cases though. --- may appear at the beginning or at the end of the document. The --- line may also contain additional control characters:
--- >Mark McGwire'syear was crippledby a knee injury.
The biggest problem is that validation errors report the "local" line number instead of the "global" one (using my naïve solution). I assume that the members of the YAMLValidationError (or other error class) instance could be edited manually to match the "real" line number, but that would likely result in interacting with implementation details.
A "quick and easy" solution would be to add a keyword argument to strictyaml.load() and strictyaml.dirty_load() that would set a line number offset. This number could be added to the resulting line number reported by strictyaml exceptions.
The text was updated successfully, but these errors were encountered:
To my knowledge, strictyaml currently doesn't explicitly support reading multiple YAML documents within a single YAML stream.
For simple enough YAML documents, this is trivial to implement manually. Instead of calling
I can call
This doesn't handle several edge cases though.
---
may appear at the beginning or at the end of the document. The---
line may also contain additional control characters:The biggest problem is that validation errors report the "local" line number instead of the "global" one (using my naïve solution). I assume that the members of the
YAMLValidationError
(or other error class) instance could be edited manually to match the "real" line number, but that would likely result in interacting with implementation details.A "quick and easy" solution would be to add a keyword argument to
strictyaml.load()
andstrictyaml.dirty_load()
that would set a line number offset. This number could be added to the resulting line number reported by strictyaml exceptions.The text was updated successfully, but these errors were encountered: