NelmioApiDocBundle
NelmioApiDocBundle copied to clipboard
use attributes instead of groups
I have a constant array of specific entity attributes
const SELECT_ATTRIBUTES = [
"id",
"email",
];
/**
* List of users.
*
* This call return all the users.
*
* @OA\Response(
* response=200,
* description="Returns list of all the users",
* @OA\JsonContent(
* type="array",
* @OA\Items(
* type="object",
* ref=@Model(type=User::class, options={"attributes"=User::SELECT_ATTRIBUTES})),
* )
* )
* @OA\Tag(name="users")
* @Security(name="cookieAuth")
*/
I want to use attributes instead of groups
see example selecting-specific-attributes
Sure that would be nice!
That shouldn't be too complicated to implement, maybe we could just use a key serializer_context
as default context passed to the property info, would that suit you to then use: @Model(type=User::class, options={"serializer_context"={"attributes=User::SELECT_ATTRIBUTES}}))
?
I don't have much time to dedicate to developping new features in this bundle unfortunately but I'd be happy to merge pull requests :)