How to fix ErrorException: @OA\Items() is required when @OA\Property() has type "array"?

11,202

I've found the solution:

 * @OA\Property(
 *      type="array",
 *      @OA\Items(
 *          type="array",
 *          @OA\Items()
 *      ),
 *      description="bla bla bla"
 * )

The issue was @OA\Schema

Share:
11,202
Andrei Lupuleasa
Author by

Andrei Lupuleasa

I write code

Updated on June 25, 2022

Comments

  • Andrei Lupuleasa
    Andrei Lupuleasa over 1 year

    I've tried to add a nested array of arbitrary types. These are my annotations:

    * @OA\Property(
    *      @OA\Schema(
    *          type="array",
    *          @OA\Items(
    *              type="array",
    *              @OA\Items(type={})
    *          )
    *      ),
    *      description="bla bla bla"
    * )
    
  • Henry
    Henry almost 4 years
    Thanks, this really helped!
  • ali Falahati
    ali Falahati over 2 years
    how we can set required for a field?
  • Andrei Lupuleasa
    Andrei Lupuleasa over 2 years
    * @OA\Parameter( * name="", * in="path", * @OA\Schema(type="string"), * required=true, * description="" * ),