Skip to content

Enhancement: more information about schema errors #35

Closed
@esnible

Description

@esnible

I tried sbom-utility against https://github.com/chainguard-dev/bom-shelter/blob/main/in-the-wild/cyclonedx/obsidian-sailboat-sbom-cdx.json . 407 errors were found, here is the first one:

	1. Type: [number_one_of], Field: [components.0.licenses.0.license], Description: [Must validate one and only one schema (oneOf)] 
	Failing object: [{
	  "url": "https://github.com/AngleSharp/AngleSharp/blob/master/LICENSE"
	}]

First question. sbom-utility logged Schema "schema/cyclonedx/1.2/bom-1.2.schema.json" loaded. but the error seems to be coming from validation in resources/schema/cyclonedx/1.2/bom-1.2-strict.schema.json, not resources/schema/cyclonedx/1.2/bom-1.2.schema.json.

The failing validation is

            "oneOf":[
              {
                "required": ["license"]
              },
              {
                "required": ["expression"]
              }

The failing component has

      "licenses": [
        {
          "license": {
            "url": "https://github.com/AngleSharp/AngleSharp/blob/master/LICENSE"
          }
        }
      ],

It isn't clear to me what is wrong with this license. In this case I could tell from the URL which fragment was the problem but I would like to see the JSON Path, e.g. to component. I would also like to see the more details of the failed validation. At first glance I see a license.

Type: [number_one_of], Field: [components.0.licenses.0.license], Description: [Must validate one and only one schema (oneOf)] No "license", no "expression"
Failing object components[0]/license[0] : [{
"url": "https://github.com/AngleSharp/AngleSharp/blob/master/LICENSE"
}]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions