module

CycloneDX::LicenseChoiceConverter

Serializes and deserializes a CycloneDX licenses array, whose entries are either a {"license": {...}} wrapper or a bare {"expression": "..."} object (the schema's licenseChoice).

A plain Array(License | LicenseExpression) cannot round-trip this. Union deserialization tries License first, and since a wrapper's only key is license — which License does not declare — every wrapped license parsed into an all-nil License without raising, then re-serialized as {"license":{}}, which no CycloneDX schema accepts. The data loss was silent, so this converter handles the wrapper explicitly.

Class methods

from_json(pull : JSON::PullParser) : Array(License | LicenseExpression)
Source
to_json(value : Array(License | LicenseExpression), json : JSON::Builder) : Nil
Source