NAME

CSAF::Validator - Conformance Validator

SYNOPSIS

use CSAF::Validator;

my $v = CSAF::Validator( csaf => $csaf );
my @messages = $v->validate;

if ($v->has_error) {
    say "Validator errors";
    say $_ for (@messages);
}

DESCRIPTION

CSAF::Validator reads documents and performs a check against the JSON schema (CSAF::Validator::Schema), performs all mandatory (CSAF::Validator::MandatoryTests), optional (CSAF::Validator::OptionalTests) and informative tests (CSAF::Validator::Informative).

Conformance profiles:

  • CSAF basic validator: A program that reads a document and checks it against the JSON schema and performs mandatory tests.

  • CSAF extended validator: A CSAF basic validator that additionally performs optional tests.

  • CSAF full validator: A CSAF extended validator that additionally performs informative tests.

https://docs.oasis-open.org/csaf/csaf/v2.0/os/csaf-v2.0-os.html

METHODS

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

validate ( [$type] )

Execute all validation tests type (schema, mandatory, optional and informative) and return all validation messages.

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

# Execute only the mandatory tests

my @messages = $v->validate('mandatory');
Carp::croak 'Validation error' if @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.