Skip to content

Resources not matching schema should be an error, and provide more info #114

@technicalpickles

Description

@technicalpickles

Given this config:

apiVersion: scope.github.com/v1alpha
kind: ScopeDoctorGroup
metadata:
  name: kafka
  description: Kafka
spec:
  actions:
    - name: port-available
      description: Port available
      needs:
        - tes
      check:
        commands:
          - script/wait-for-it.sh localhost:9092 --timeout=1 --quiet
      fix:
        commands:
          - docker-compose up -d kafka
          - script/wait-for-it.sh localhost:9092 --timeout=45

I get a warning that it doesn't match the schema, and it reports as successfully:

❯ scope doctor run --only server                                                                                                                                                                                                                                       
 WARN Resource 'ScopeDoctorGroup/kafka' didn't match the schema for ScopeDoctorGroup. Additional properties are not allowed ('needs' was unexpected)
Summary: 1 groups succeeded

This sends some mixed messaging. The succeeded language suggests it is run despite it matching the schema.

I think as someone writing and implementing scope checks, I'd want to see this be an error and not run anything else.

Some things I think I'd want to see when that happens:

  • the path to the file
  • what part didn't match, bonus points for line numbers
  • link to the supported schema

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions