module
CycloneDX::LicenseChoiceConverter
Overview
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.
Defined in:
cyclonedx/models.crClass Method Summary
- .from_json(pull : JSON::PullParser) : Array(License | LicenseExpression)
- .to_json(value : Array(License | LicenseExpression), json : JSON::Builder) : Nil