NAME

CSAF::Validator::Base - Base class for CSAF validation

SYNOPSIS

use CSAF::Validator::Base;

my $v = CSAF::Validator::Base->new( csaf => $csaf );

DESCRIPTION

ATTRIBUTES

messages

ARRAY of validation messages.

tests

ARRAY of test IDs.

METHODS

CSAF::Validator::Base inherits all methods from CSAF::Base and implements the following new ones.

add_message

Add new CSAF::Validator::Message item.

$v->add_message(
    type     => 'warning',
    category => 'optional',
    path     => '/document/tracking/initial_release_date',
    code     => '6.2.5',
    message  => 'Older Initial Release Date than Revision History'
);
exec_test

Execute a single validation test.

$v->exec_test('6.2.5');
has_error

Check if validation have error messages

my @messages = $v->validate;

if ($v->has_error) {
    say "Invalid CSAF document";
    say $_ for (@messages);
}
has_warning

Check if validation have warning messages

my @messages = $v->validate;

if ($v->has_warning) {
    say "CSAF document with warnings";
    say $_ for (@messages);
}
validate

Execute all validation tests and return all validation messages.

my @messages = $v->validate;
say $_ for (@messages);

SUPPORT

Bugs / Feature Requests

Please report any bugs or feature requests through the issue tracker at https://github.com/giterlizzi/perl-CSAF/issues. You will be notified automatically of any progress on your issue.

Source Code

This is open source software. The code repository is available for public review and contribution under the terms of the license.

https://github.com/giterlizzi/perl-CSAF

git clone https://github.com/giterlizzi/perl-CSAF.git

AUTHOR

  • Giuseppe Di Terlizzi <gdt@cpan.org>

LICENSE AND COPYRIGHT

This software is copyright (c) 2023-2024 by Giuseppe Di Terlizzi.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.