use constant JSON_SCHEMA_1_2 => 'http://cyclonedx.org/schema/bom-1.2b.schema.json';
use constant JSON_SCHEMA_1_3 => 'http://cyclonedx.org/schema/bom-1.3a.schema.json';
use constant JSON_SCHEMA_1_4 =>
bom-1.4.schema.json';
use constant JSON_SCHEMA_1_5 => 'http://cyclonedx.org/schema/bom-1.5.schema.json';
use constant JSON_SCHEMA_1_6 => 'http://cyclonedx.org/schema/bom-1.6.schema.json';
our $VERSIO
N = 1.05;
our %JSON_SCHEMA = (
'1.2' => JSON_SCHEMA_1_2,
'1.3' => JSON_SCHEMA_1_3,
'1.4' => JSON_SCHEMA_1_4,
'1.5' => JSON_SCHEMA_1_5,
'1.6' => JSON_SCHEMA_1_6,
);
has bom_format
alContact->new }
);
sub TO_JSON {
my $self = shift;
my $json = {};
$json->{organization} = $self->organization if %{$self->organization->TO_JSON};
$json->{individual} = $self->in
dividual if %{$self->individual->TO_JSON};
return $json;
}
1;
=encoding utf-8
=head1 NAME
SBOM::CycloneDX::License::Licensee - Licensee
=head1 SYNOPSIS
SBOM::CycloneDX::License::Lice
}[0] }
sub last { $_[0]->{collections}[-1] }
sub to_array { [@{$_[0]->{collections}}] }
sub TO_JSON { [@{$_[0]->{collections}}] }
# Aliases
sub add { $_[0]->push(@_[1 .. $#_]) }
1;
=encoding ut
->unshift('baz');
=item $c->to_array
Return the collection ARRAY.
=item $c->TO_JSON
Convert the collenction in JSON.
=back
=head1 SUPPORT
=head2 Bugs / Feature Requests
Please report any bugs
ngs;
use utf8;
use Cpanel::JSON::XS;
use overload '""' => \&to_string, fallback => 1;
sub TO_JSON { }
sub to_string {
my $self = shift;
my $json = Cpanel::JSON::XS->new->utf8->canonical-
;
return $json->encode($self->TO_JSON);
}
sub to_hash {
my $self = shift;
say ref($self);
my $json = $self->to_string;
return Cpanel::JSON::XS->new->decode($json);
}
1;
=enc
YNOPSIS
$component->to_string; # Convert object in JSON
$license->to_hash; # Convert object in HASH
$bom->TO_JSON; Helper for JSON packages
=head1 DESCRIPTION
L<SBOM::CycloneDX::BomR
'rw', isa => Str);
sub TO_JSON {
my $self = shift;
my $json = {};
$json->{'bom-ref'} = $self->bom_ref if $self->bom_ref;
$json->{country} = $s
country;
$json->{region} = $self->region if $self->region;
$json->{locality} = $self->locality if $self->locality;
$json->{postOfficeB
$json->{postalCode} = $self->postal_code if $self->postal_code;
$json->{streetAddress} = $self->street_address if $self->street_address;
return $json;
}
p::carp 'Malformed timestamp';
return Time::Piece->new;
}
sub to_string { shift->TO_JSON }
sub TO_JSON { shift->value->datetime . '.000Z' }
1;
=encoding utf-8
=head1 NAME
SBOM::CycloneDX::
=item $ts->value
Return L<Time::Piece> object.
=item $ts->to_string
=item $ts->TO_JSON
Return timestamp in JSON format.
=back
=head1 SUPPORT
=head2 Bugs / Feature Requests
Please report any bu
eDX::List->new }
);
sub TO_JSON {
my $self = shift;
my $json = {ref => $self->ref};
$json->{dependsOn} = $self->depends_on if @{$self->depends_on};
$json->{provides} = $self->prov
ides if @{$self->provides};
return $json;
}
1;
=encoding utf-8
=head1 NAME
SBOM::CycloneDX::Dependency - Dependency
=head1 SYNOPSIS
SBOM::CycloneDX::Dependency->new();
=head1 DESCR
OrganizationalContact']);
sub TO_JSON {
my $self = shift;
my $json = {};
$json->{organization} = $self->organization if $self->organization;
$json->{contact} = $self->contact
if $self->contact;
return $json;
}
1;
=encoding utf-8
=head1 NAME
SBOM::CycloneDX::DataGovernanceResponsibleParty - Data Custodians
=head1 SYNOPSIS
SBOM::CycloneDX::DataGovernance
ile);
use JSON::Validator;
use Types::Standard qw(HashRef InstanceOf);
use Moo;
use constant DEBUG => $ENV{SBOM_DEBUG} || 0;
our @JSON_SCHEMA_REGISTRY = (
'bom-1.2-strict.schema.json', 'bom-1.
-1.3-strict.schema.json', 'bom-1.3.schema.json',
'bom-1.4.schema.json', 'bom-1.5.schema.json', 'bom-1.6.schema.json', 'jsf-0.82.schema.json',
'spdx.schema.json',
);
has bom => (
elf) = @_;
my $jv = JSON::Validator->new;
foreach my $json_schema_file (@JSON_SCHEMA_REGISTRY) {
DEBUG and say sprintf('-- Preload JSON Schema file %s', $json_schema_file);
$
cloneDX::List->new });
sub TO_JSON {
my $self = shift;
my $json = {type => $self->type};
$json->{id} = $self->id if $self->id;
$json->{name} = $self->name
f $self->description;
$json->{source} = $self->source if $self->source;
$json->{references} = $self->references if @{$self->references};
return $json;
}
1;
=encoding utf-8
=> Str, required => 1);
sub TO_JSON {
my $self = shift;
my $json = {url => $self->url};
$json->{title} = $self->title if $self->title;
return $json;
}
1;
=encoding utf-8
=head
;
sub TO_JSON {
my $self = shift;
my $json = {};
$json->{timestamp} = $self->timestamp if $self->timestamp;
$json->{name} = $self->name if $self->name;
$json->{email}
= $self->email if $self->email;
return $json;
}
1;
=encoding utf-8
=head1 NAME
SBOM::CycloneDX::IdentifiableAction - Identifiable Action
=head1 SYNOPSIS
SBOM::CycloneDX::Ident
_JSON {
my $self = shift;
my $json = {};
$json->{'bom-ref'} = $self->bom_ref if $self->bom_ref;
$json->{thirdParty} = $self->third_party if $self->third_party;
$json-
>{organization} = $self->organization if $self->organization;
return $json;
}
1;
=encoding utf-8
=head1 NAME
SBOM::CycloneDX::Declarations::Assessor - Assessor
=head1 SYNOPSIS
SBOM::Cy
[HashRef]);
sub TO_JSON {
my $self = shift;
my $json = {name => $self->name};
$json->{'bom-ref'} = $self->bom_ref if $self->bom_ref;
$json->{provider}
lf->provider;
$json->{group} = $self->group if $self->group;
$json->{version} = $self->version if $self->version;
$json->{description}
iption;
$json->{endpoints} = $self->endpoints if @{$self->endpoints};
$json->{authenticated} = $self->authenticated if $self->authenticated;
$json->{'x-trust-
rations::Confidence']);
sub TO_JSON {
my $self = shift;
my $json = {};
$json->{requirement} = $self->requirement if $self->requirement;
$json->{claims} = $self->claims
$self->claims};
$json->{counterClaims} = $self->counter_claims if @{$self->counter_claims};
$json->{conformance} = $self->conformance if $self->conformance;
$json->{confidence} = $
self->confidence if $self->confidence;
return $json;
}
1;
=encoding utf-8
=head1 NAME
SBOM::CycloneDX::Declarations::Map - Map
=head1 SYNOPSIS
SBOM::CycloneDX::Declarations::Map->n
=> 'rw', isa => Str);
sub TO_JSON {
my $self = shift;
my $json = {name => $self->name};
$json->{value} = $self->value if $self->value;
return $json;
}
1;
=encoding utf-8
=hea
DX::List->new }
);
sub TO_JSON {
my $self = shift;
my $json = {type => $self->type};
$json->{title} = $self->title if $self->title;
$json->{featuredImage} = $self-
f->featured_image;
$json->{socialImage} = $self->social_image if $self->social_image;
$json->{description} = $self->description if $self->description;
$json->{timestamp} = $se
if $self->timestamp;
$json->{aliases} = $self->aliases if @{$self->aliases};
$json->{tags} = $self->tags if @{$self->tags};
$json->{resolves} = $self-
elf->url eq '1';
}
sub TO_JSON {
my $self = shift;
my $json = {};
if ($self->expression) {
$json->{expression} = $self->expression;
$json->{acknowledgement} = $sel
f->acknowledgement if $self->acknowledgement;
$json->{'bom-ref'} = $self->bom_ref if $self->bom_ref;
}
else {
my $spdx_license = $self->id;
my $license_n
}
$json->{license} = {};
$json->{license}->{id} = $spdx_license if $spdx_license;
$json->{license}->{name} = $license_name if $license_name;
$json->{license}->{
::CycloneDX::List->new }
);
sub TO_JSON {
my $self = shift;
my $json = {};
$json->{components} = $self->components if @{$self->components};
$json->{services} = $self->services
if @{$self->services};
return $json;
}
1;
=encoding utf-8
=head1 NAME
SBOM::CycloneDX::Tools - [Deprecated] The tool(s) used in the creation, enrichment,
and validation of the BOM
=head1 SY
er types of network or intra-process services.
See L<SBOM::CycloneDX::Service>.
=item $tools->TO_JSON
=back
=head1 SUPPORT
=head2 Bugs / Feature Requests
Please report any bugs or feature reques
nt'], required => 1);
sub TO_JSON {
my $self = shift;
my $json = {text => $self->text};
$json->{locale} = $self->locale if $self->locale;
return $json;
}
1;
=encoding utf-8
=h