conformance library

Laravel 12 conformance contracts (BLUEPRINT_V2 §11.2): fixtures taken from the Laravel and Sanctum sources plus matchers, shared by the framework's conformance suite and by applications that want to verify their API still speaks Laravel's wire format.

import 'package:daravel_test/conformance.dart';

expect(response.json, isLaravelValidationError({'email': [...]}));

Classes

LaravelContract
Laravel 12 wire and storage contracts that Daravel locks (BLUEPRINT_V2 §11.2). Each value cites the Laravel / Sanctum source it was taken from (laravel/framework 12.x, laravel/sanctum 4.x, laravel/laravel 12.x), so a change in either framework is traceable. Changing a value here is a compatibility decision and needs an ADR.

Constants

laravelValidationMessages → const Map<String, String>
Laravel 12.x default English validation messages.

Functions

isLaravelErrorBody(String message) → Matcher
Matches {"message": message} and nothing else.
isLaravelLengthAwarePaginator() → Matcher
Matches a paginate() body: Laravel key order, links shape with the UrlWindow page labels, and consistent from/to/last_page.
isLaravelPaginatedResource(Map<String, Object?> paginatorJson) → Matcher
Matches a paginated JsonResource::collection body: {data, links: {first, last, prev, next}, meta} with meta equal to the paginator array minus data and the URL keys.
isLaravelValidationError([Map<String, List<String>>? errors]) → Matcher
Matches a Laravel 422 body: exactly {message, errors}, the message being the LaravelContract.validationSummary of the errors, and (when given) the exact errors.