NelmioApiDocBundle icon indicating copy to clipboard operation
NelmioApiDocBundle copied to clipboard

Property type array attribute does not work, annotation does

Open bazo opened this issue 2 years ago • 2 comments

Hi, so i have a doctrine User entity with property roles = []

use OpenApi\Attributes as OA;
use OpenApi\Annotations as OAA;

class User {
/**
	 * @ORM\Column(type="array")
	 */
	#[Groups(groups: ["current_user"])]
	#[OA\Property(type: "array", items: new OA\Items(type: "string"))] #doesn't work
	///** @OAA\Property(type="array", @OAA\Items(type="string")) */ does work
	private array $roles = [];
}

with the attribute defined like that i get error Property "User::roles" is an array, but its items type isn't specified. You can specify that by using the type string[] for instance or @OA\Property(type="array", @OA\Items(type="string")).

when using annotation, no warning

how can i make the attribute work?

thanks

bazo avatar Feb 22 '23 14:02 bazo

Can't reproduce this issue.

mario-fehr avatar Feb 22 '23 21:02 mario-fehr

Same problem

Agnius avatar Apr 18 '23 12:04 Agnius