Skip to content

Gives traceback on multi-document yaml files #4

@abentley

Description

@abentley
$ printf -- '---\na: b\n---'|yaml2jsonnet -
Traceback (most recent call last):
  File "/home/abentley/.local/bin/yaml2jsonnet", line 8, in <module>
    sys.exit(main())
  File "/home/abentley/.local/lib/python3.8/site-packages/yaml2jsonnet/cli.py", line 58, in main
    run(args)
  File "/home/abentley/.local/lib/python3.8/site-packages/yaml2jsonnet/cli.py", line 47, in run
    convert_yaml(yaml_data, args.out, args.document_comments)
  File "/home/abentley/.local/lib/python3.8/site-packages/yaml2jsonnet/yaml2jsonnet.py", line 14, in convert_yaml
    JsonnetRenderer(events, output, array, inject_comments).render()
  File "/home/abentley/.local/lib/python3.8/site-packages/yaml2jsonnet/jsonnet_renderer.py", line 210, in render
    self.state.send(event)
  File "/home/abentley/.local/lib/python3.8/site-packages/yaml2jsonnet/jsonnet_renderer.py", line 284, in _stream
    raise MultipleDocumentsError(self, event)
yaml2jsonnet.jsonnet_renderer.MultipleDocumentsError: Expecting a single document but got multiple: Last event was DocumentStartEvent(), the state was _stream, the queue was [(StreamStartEvent,_start)]

I think even "Expecting a single document but got multiple" without the rest would be fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions