File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change 8
8
use App \Helpers \MetaFormats \Validators \VEmail ;
9
9
use App \Helpers \MetaFormats \Validators \VFloat ;
10
10
use App \Helpers \MetaFormats \Validators \VInt ;
11
+ use App \Helpers \MetaFormats \Validators \VMixed ;
11
12
use App \Helpers \MetaFormats \Validators \VString ;
12
13
use App \Helpers \MetaFormats \Validators \VTimestamp ;
13
14
use App \Helpers \MetaFormats \Validators \VUuid ;
@@ -196,6 +197,9 @@ private static function convertAnnotationValidationToValidatorString(string $val
196
197
case "numeric " :
197
198
$ validatorClass = VFloat::class;
198
199
break ;
200
+ case "mixed " :
201
+ $ validatorClass = VMixed::class;
202
+ break ;
199
203
default :
200
204
throw new InternalServerException ("Unknown validation rule: $ validation " );
201
205
}
@@ -221,9 +225,9 @@ public static function convertRegexCapturesToParenthesesBuilder(array $annotatio
221
225
}
222
226
$ parenthesesBuilder ->addValue ("\"{$ annotationParameters ["name " ]}\"" );
223
227
224
- // replace missing validations with string validations
228
+ // replace missing validations with placeholder validations
225
229
if (!array_key_exists ("validation " , $ annotationParameters )) {
226
- $ annotationParameters ["validation " ] = "string " ;
230
+ $ annotationParameters ["validation " ] = "mixed " ;
227
231
}
228
232
$ nullable = false ;
229
233
$ validation = $ annotationParameters ["validation " ];
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace App \Helpers \MetaFormats \Validators ;
4
+
5
+ use App \Helpers \MetaFormats \MetaFormatHelper ;
6
+ use App \Helpers \MetaFormats \PhpTypes ;
7
+
8
+ /**
9
+ * Placeholder validator used for endpoints with no existing validation rules.
10
+ */
11
+ class VMixed
12
+ {
13
+ public const SWAGGER_TYPE = "string " ;
14
+
15
+ public function getExampleValue ()
16
+ {
17
+ return "value " ;
18
+ }
19
+
20
+ public function validate (mixed $ value ): bool
21
+ {
22
+ return true ;
23
+ }
24
+ }
You can’t perform that action at this time.
0 commit comments