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(
132132 public function toArray (): array
133133 {
134134 if ($ this ->definition !== null ) {
135- return [
136- 'definition ' => $ this ->definition ,
137- ];
135+ return $ this ->definition ;
138136 }
139137
140138 $ schema = [];
Original file line number Diff line number Diff line change @@ -397,4 +397,17 @@ public function parameterSchemaInferredType(
397397 $ inferredParam
398398 ): void {
399399 }
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+ }
400413}
Original file line number Diff line number Diff line change 354354
355355 expect ($ schema ['required ' ])->toEqual (['inferredParam ' ]);
356356});
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