Skip to content

Support yaml files with multiple documents #222

Open
@nikolaik

Description

@nikolaik

Is there any interest in adding support for checking yaml files with multiple documents in them? That is:

catalog-info.yaml:

---
apiVersion: backstage.io/v1alpha1
kind: System
metadata:
  name: example-system
spec:
  owner: my-team
---
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: example-service
spec:
  owner:  my-team
  system: example-system
❯ check-jsonschema --schemafile "https://json.schemastore.org/catalog-info.json" -v catalog-info.yaml
Several files failed to parse.
  FailedFileLoadError: Failed to parse catalog-info.yaml
    in "/Users/nikolark/.pyenv/versions/3.10.8/lib/python3.10/site-packages/check_jsonschema/instance_loader.py", line 31
    >>> data: t.Any = self._parsers.parse_file(path, self._default_filetype)

    caused by

    ComposerError: expected a single document in the stream
    in "<byte string>", line 2, column 1:
      apiVersion: backstage.io/v1alpha1
      ^ (line: 2)
  but found another document
    in "<byte string>", line 8, column 1:
      ---
      ^ (line: 8)
      in "/Users/nikolark/.pyenv/versions/3.10.8/lib/python3.10/site-packages/check_jsonschema/parsers/__init__.py", line 89
      >>> return loadfunc(fp)

Ref https://yaml.org/spec/1.2.2/#22-structures

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds-investigationRequires study to find an appropriate resolution

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions