Skip to content

Conversation

nikolaik
Copy link
Contributor

@nikolaik nikolaik commented Jan 10, 2023

Quick hack to see how much work it would be ref #222

The output is a bit unintuitive atm, but could probably be improved:

$ cat 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
Schema validation errors were encountered.
  yolo.yaml::$: {'apiVersion': 'backstage.io/v1alpha1', 'kind': 'Component', 'metadata': {'name': 'example-service'}, 'spec': {'owner': 'my-team', 'system': 'example-system'}} is not valid under any of the given schemas
  Underlying errors caused this.
  Best Match:
    $.kind: 'Component' is not one of ['API']
  All Errors:
    $.kind: 'Component' is not one of ['API']
    $.spec: 'type' is a required property
    $.spec: 'lifecycle' is a required property
    $.spec: 'definition' is a required property
    $.spec: 'type' is a required property
    $.spec: 'lifecycle' is a required property
    $.kind: 'Component' is not one of ['Domain']
    $.kind: 'Component' is not one of ['Group']
    $.spec: 'type' is a required property
    $.spec: 'children' is a required property
    $.kind: 'Component' is not one of ['Location']
    $.kind: 'Component' is not one of ['Resource']
    $.spec: 'type' is a required property
    $.kind: 'Component' is not one of ['System']
    $.apiVersion: 'backstage.io/v1alpha1' is not one of ['backstage.io/v1beta2']
    $.kind: 'Component' is not one of ['Template']
    $.spec: 'type' is a required property
    $.spec: 'steps' is a required property
    $.kind: 'Component' is not one of ['User']
    $.spec: 'memberOf' is a required property

Quick hack to check how much work it would be
martinmigasiewicz-tomtom added a commit to tomtom-forks/check-jsonschema that referenced this pull request May 21, 2024
martinmigasiewicz-tomtom added a commit to tomtom-forks/check-jsonschema that referenced this pull request May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant