Преглед изворни кода

fix: Array with Form request doesn't generate both example and fields at the same time (#840)

Wanderson Costa пре 1 година
родитељ
комит
0fd9abb979
1 измењених фајлова са 5 додато и 2 уклоњено
  1. 5 2
      src/Extracting/ParsesValidationRules.php

+ 5 - 2
src/Extracting/ParsesValidationRules.php

@@ -636,8 +636,11 @@ trait ParsesValidationRules
                 // 2. If `users.<name>` exists, `users` is an `object`
                 // 3. Otherwise, default to `object`
                 // Important: We're iterating in reverse, to ensure we set child items before parent items
-                // (assuming the user specified parents first, which is the more common thing)
-                if ($childKey = Arr::first($allKeys, fn($key) => Str::startsWith($key, "$name.*"))) {
+                // (assuming the user specified parents first, which is the more common thing)y
+                if(Arr::first($allKeys, fn($key) => Str::startsWith($key, "$name.*."))) {
+                    $details['type'] = 'object[]';
+                    unset($details['setter']);
+                } else if ($childKey = Arr::first($allKeys, fn($key) => Str::startsWith($key, "$name.*"))) {
                     $childType = ($converted[$childKey] ?? $parameters[$childKey])['type'];
                     $details['type'] = "{$childType}[]";
                 } else { // `array` types default to `object` if no subtype is specified