I'm using nelmio/api-doc-bundle v4.9 in Symfony for documentation. Here's the annotation for an endpoint:
* @OA\RequestBody(
* required=true,
* @OA\JsonContent(
* example={
* "file": "file",
* "documentCategoryCode": "O"
* },
* @OA\Schema(
* type="object",
* @OA\Property(
* property="file",
* required=true,
* type="file",
* description="File to be uploaded",
* example="file"
* ),
* @OA\Property(
* property="documentCategoryCode",
* required=true,
* type="string",
* description="Document category")
* ),
* )
* )
* )
It shows the example fine:
However the "Schema" part is an empty object, like the properties are not recognized
Any ideas what am I missing here?
CodePudding user response:
* @OA\RequestBody(
* required=true,
* @OA\JsonContent(
* example={
* "file": "file",
* "documentCategoryCode": "O"
* },
* required={"file", "documentCategoryCode"},
* @OA\Property(
* property="file",
* type="file",
* description="File to be uploaded",
* example="file"
* ),
* @OA\Property(
* property="documentCategoryCode",
* type="string",
* description="Document category")
* )
* )
* )
Thanks to @Helen for the suggestion, this was the annotation that worked in the end.