|
#!/usr/bin/env perl
my $validator = Tapir::Validator->new(
audit_types => 1,
warn_unused_types => 1,
docs => {
require => {
methods => 1,
rest => 1,
},
flags => {
optional => 1,
utf8 => 1,
secure => 1,
},
},
);
foreach my $fn ( @ARGV ) {
my $idl = Thrift::IDL->parse_thrift_file( $fn );
my @errors = $validator ->audit_idl_document( $idl );
if ( @errors ) {
print "File $fn failed the audit:\n" ;
print " - $_\n" foreach @errors ;
}
else {
print "File $fn passed the audit\n" ;
foreach my $service (@{ $idl ->services }) {
print "Service " . $service ->name . "\n" ;
foreach my $method (@{ $service ->methods }) {
printf " %s %s calls %s\n" , uc ( $method ->{doc}{rest}{method}), $method ->{doc}{rest}{route}, $method ->name;
}
}
}
}
|