NAME

PAGI::Middleware::Lint - Validate PAGI application compliance

SYNOPSIS

use PAGI::Middleware::Builder;

my $app = builder {
    enable 'Lint',
        strict => 1,
        on_warning => sub  {
    my ($msg) = @_; warn "PAGI Lint: $msg\n" };
    $my_app;
};

DESCRIPTION

PAGI::Middleware::Lint validates that wrapped applications follow the PAGI specification. It checks for common mistakes and spec violations, helping developers catch issues early.

CONFIGURATION

  • strict (default: 0)

    In strict mode, violations throw exceptions instead of warnings.

  • on_warning (optional)

    Callback for lint warnings. Receives warning message.

  • enabled (default: 1)

    Set to false to completely disable lint checks.

CHECKS PERFORMED

Scope Validation

  • Required type key present

  • HTTP scope has method, path, scheme

  • Headers are arrayref of [name, value] pairs

  • Header names are lowercase

Event Validation

  • Events are hashrefs with type key

  • http.response.start has status

  • http.response.body has more key

  • Events sent in correct order

  • No events after response finished

Completion Validation

  • HTTP apps send http.response.start

  • HTTP apps send final http.response.body with more=0

SEE ALSO

PAGI::Middleware - Base class for middleware

PAGI::Middleware::Debug - Development debug panel