File tree Expand file tree Collapse file tree 3 files changed +27
-3
lines changed Expand file tree Collapse file tree 3 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -132,9 +132,7 @@ public function __construct(
132
132
public function toArray (): array
133
133
{
134
134
if ($ this ->definition !== null ) {
135
- return [
136
- 'definition ' => $ this ->definition ,
137
- ];
135
+ return $ this ->definition ;
138
136
}
139
137
140
138
$ schema = [];
Original file line number Diff line number Diff line change @@ -397,4 +397,17 @@ public function parameterSchemaInferredType(
397
397
$ inferredParam
398
398
): void {
399
399
}
400
+
401
+ /**
402
+ * Parameter with complete custom definition via #[Schema(definition: ...)]
403
+ */
404
+ public function parameterWithRawDefinition (
405
+ #[Schema(definition: [
406
+ 'description ' => 'Custom-defined schema ' ,
407
+ 'type ' => 'string ' ,
408
+ 'format ' => 'uuid '
409
+ ])]
410
+ string $ custom
411
+ ): void {
412
+ }
400
413
}
Original file line number Diff line number Diff line change 354
354
355
355
expect ($ schema ['required ' ])->toEqual (['inferredParam ' ]);
356
356
});
357
+
358
+ it ('uses raw parameter-level schema definition as-is ' , function () {
359
+ $ method = new ReflectionMethod (SchemaGeneratorFixture::class, 'parameterWithRawDefinition ' );
360
+ $ schema = $ this ->schemaGenerator ->generate ($ method );
361
+
362
+ expect ($ schema ['properties ' ]['custom ' ])->toEqual ([
363
+ 'description ' => 'Custom-defined schema ' ,
364
+ 'type ' => 'string ' ,
365
+ 'format ' => 'uuid '
366
+ ]);
367
+
368
+ expect ($ schema ['required ' ])->toEqual (['custom ' ]);
369
+ });
You can’t perform that action at this time.
0 commit comments