Forum Discussion

Stoplight's avatar
Stoplight
Community Manager
7 months ago

linting yaml files with multiple documents in the yaml file

Originally posted by user ItsGameOvrMan to the Stoplight Community on 01/25/2023 at 14:32 ET.

Trying to run against a yaml file:

apiVersion: backstage.io/v1alpha1
kind: Domain
metadata:
  name: demo-name
  title: A demo
  description: The Demo for spectral
spec:
  owner: group:org-group
---
apiVersion: backstage.io/v1alpha1
kind: Domain
metadata:
  name: demo-name-2
  title: A demo
  description: The Demo for spectral
spec:
  owner: group:org-group

Here is the ruleset:

rules:
  metadata-name-kebab-case:
    description: Metadata name attribute should be kebab-case.
    message: "{{property}} should be kebab-case (lower-case and separated with hyphens)"
    severity: error
    given: $.metadata.name
    then:
      function: pattern
      functionOptions:
        match: "^(\/|[a-z0-9-.]+|{[a-zA-Z0-9_]+})+$"

Getting an error: 1:1 error parser Expected a single document in the stream, but found more

How can I have it run/apply to multiple documents within a yaml file or has this feature been removed?

No RepliesBe the first to reply