cdxschema

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cdxschema validates CycloneDX JSON documents against the specification's own schemas, embedded in the binary so validation needs no network and no files.

It serves the import path (PRD-003 REQ-ING-2): a third-party document is checked against the schema of the version it declares before anything is stored. Versions 1.6 and 1.7 are accepted, because earlier versions have no cryptographic assets. The schemas are the specification's, unmodified, with their provenance and checksums in schemas/MANIFEST.md.

Index

Constants

This section is empty.

Variables

View Source
var Supported = []string{"1.6", "1.7"}

Supported lists the specification versions a document may declare.

Functions

func Curves

func Curves() []string

Curves lists the elliptic curve identifiers of the 1.7 cryptography registry.

func Families

func Families() []string

Families lists the algorithm families of the 1.7 cryptography registry.

func IsSupported

func IsSupported(specVersion string) bool

IsSupported reports whether specVersion may be imported.

Types

type Problem

type Problem struct {
	Path    string `json:"path"`
	Message string `json:"message"`
}

Problem is one reason a document is not valid, short enough to show to a person.

func Validate

func Validate(doc []byte, specVersion string, max int) ([]Problem, error)

Validate checks doc against the schema for specVersion. It returns at most max problems (the first in document order), each bounded, so a hostile document cannot make the error itself large. A nil result means the document is valid.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL