Conversation
Add a `maxErrors` constructor parameter (default: 20, 0 = unlimited via PHP_INT_MAX) and pass it to the opis/json-schema Validator. `stopAtFirstError` is true only when maxErrors is 1.
Reject negative maxErrors values with InvalidArgumentException to enforce the contract that maxErrors must be 0 (unlimited) or positive.
Change is_int() guard to is_numeric() + (int) cast so that string values returned by env() (e.g. "10") are accepted instead of silently falling back to the default.
- Use 50-item payloads to prove truncation works in maxErrors tests - Add capped vs unlimited comparison, boundary, and negative input tests - Add Laravel trait tests for max_errors config, string casting, and fallback
- Change "original behavior" to "pre-v0.x default" in the maxErrors: 1 code comment to avoid misleading upgrading users - Reword API Reference description from "controlling how many schema errors are collected before stopping" to "that limits how many validation errors the underlying JSON Schema validator collects"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
OpenApiResponseValidatorがデフォルトで最大20件のバリデーションエラーを一括報告するようになりました。これまではスキーマ違反が1件見つかった時点で停止していたため、開発者は fix → run → fix のサイクルを繰り返す必要がありました。変更内容
OpenApiResponseValidatorにmaxErrorsコンストラクタパラメータを追加(デフォルト:20)0は無制限(PHP_INT_MAX)として扱うmaxErrors === 1の場合のみstopAtFirstError: trueで動作(従来の挙動)max_errorsキーを追加(デフォルト:20)ValidatesOpenApiSchemaトレイトがmax_errors設定値を読み取り、バリデータに渡すよう更新maxErrorsの挙動を検証するユニットテストを3件追加maxErrorsパラメータのドキュメントを追加関連情報