class
CycloneDX::License
- CycloneDX::License
- Reference
- Object
Included Modules
- JSON::Serializable
Defined in:
cyclonedx/models.crConstructors
- .new(pull : JSON::PullParser)
- .new(id : String | Nil = nil, name : String | Nil = nil, url : String | Nil = nil, bom_ref : String | Nil = nil, text : AttachedText | Nil = nil, acknowledgement : String | Nil = nil)
Instance Method Summary
- #acknowledgement : String | Nil
- #bom_ref : String | Nil
- #id : String | Nil
- #name : String | Nil
- #text : AttachedText | Nil
-
#to_json(json : JSON::Builder)
CycloneDX LicenseChoice wraps the license object:
{"license": {...}}. - #to_xml(xml : XML::Builder)
- #url : String | Nil
Constructor Detail
def self.new(id : String | Nil = nil, name : String | Nil = nil, url : String | Nil = nil, bom_ref : String | Nil = nil, text : AttachedText | Nil = nil, acknowledgement : String | Nil = nil)
#
Instance Method Detail
def to_json(json : JSON::Builder)
#
CycloneDX LicenseChoice wraps the license object: {"license": {...}}.
We override #to_json (the JSON::Serializable-generated implementation
would produce a flat object). from_json keeps the flat shape, which is
fine because we never parse SBOM licenses arrays back in.
#id is preferred when present (canonical SPDX identifier);
#name is the free-form fallback for licenses not in the SPDX list.