{"action":"created","issue":{"url":"https://api.github.com/repos/api-platform/api-platform/issues/352","repository_url":"https://api.github.com/repos/api-platform/api-platform","labels_url":"https://api.github.com/repos/api-platform/api-platform/issues/352/labels{/name}","comments_url":"https://api.github.com/repos/api-platform/api-platform/issues/352/comments","events_url":"https://api.github.com/repos/api-platform/api-platform/issues/352/events","html_url":"https://github.com/api-platform/api-platform/issues/352","id":240479964,"number":352,"title":"How to create custom endpoint and add it to the documentation?","user":{"login":"ssimplix","id":12474739,"avatar_url":"https://avatars1.githubusercontent.com/u/12474739?v=3","gravatar_id":"","url":"https://api.github.com/users/ssimplix","html_url":"https://github.com/ssimplix","followers_url":"https://api.github.com/users/ssimplix/followers","following_url":"https://api.github.com/users/ssimplix/following{/other_user}","gists_url":"https://api.github.com/users/ssimplix/gists{/gist_id}","starred_url":"https://api.github.com/users/ssimplix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssimplix/subscriptions","organizations_url":"https://api.github.com/users/ssimplix/orgs","repos_url":"https://api.github.com/users/ssimplix/repos","events_url":"https://api.github.com/users/ssimplix/events{/privacy}","received_events_url":"https://api.github.com/users/ssimplix/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-07-04T18:28:34Z","updated_at":"2017-07-06T15:16:42Z","closed_at":null,"body":"I want to create endpoint like `/api/v1/me` that returns information (`User` object) about currently authenticated user and add it to my documentation. \r\n\r\nI have an action:\r\n\r\n````php\r\nnamespace AppBundle\\Action\\Me;\r\n\r\nuse AppBundle\\Entity\\User;\r\nuse Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Security;\r\nuse Symfony\\Component\\Routing\\Annotation\\Route;\r\nuse Symfony\\Component\\Security\\Core\\Authentication\\Token\\Storage\\TokenStorageInterface;\r\n\r\nclass MeView\r\n{\r\n\r\n    /**\r\n     * @var TokenStorageInterface\r\n     */\r\n    private $tokenStorage;\r\n\r\n    public function __construct(TokenStorageInterface $tokenStorage)\r\n    {\r\n        $this->tokenStorage = $tokenStorage;\r\n    }\r\n\r\n    /**\r\n     * @Security(\"is_authenticated()\")\r\n     *\r\n     * @Route(\r\n     *     name=\"me_view\",\r\n     *     path=\"/me\",\r\n     *     methods={\"GET\"},\r\n     *     defaults={\"_api_item_operation_name\"=\"view_myself\"}\r\n     * )\r\n     *\r\n     * @return User\r\n     */\r\n    public function __invoke()\r\n    {\r\n        return $this->tokenStorage->getToken()->getUser();\r\n    }\r\n}\r\n````\r\n\r\nI define this action in my entity:\r\n\r\n````php\r\nnamespace AppBundle\\Entity;\r\n\r\nuse ApiPlatform\\Core\\Annotation as Api;\r\nuse AppBundle\\Repository\\UserRepository;\r\nuse Doctrine\\ORM\\Mapping as ORM;\r\n\r\n/**\r\n * @Api\\ApiResource(\r\n *     itemOperations={\r\n *         \"view_myself\"={\"route_name\"=\"me_view\"}\r\n *     }\r\n * )\r\n *\r\n * @ORM\\Entity(repositoryClass=UserRepository::class)\r\n */\r\nclass User\r\n{\r\n\r\n    /**\r\n     * @ORM\\Id()\r\n     * @ORM\\GeneratedValue(strategy=\"AUTO\")\r\n     * @ORM\\Column(type=\"integer\")\r\n     *\r\n     * @var int\r\n     */\r\n    private $id;\r\n\r\n    public function getId(): ?int\r\n    {\r\n        return $this->id;\r\n    }\r\n\r\n    public function setId(?int $id)\r\n    {\r\n        $this->id = $id;\r\n    }\r\n}\r\n\r\n````\r\nBut in the docs it asks for `id` parameter.\r\n\r\n![image](https://user-images.githubusercontent.com/12474739/27840120-37739c06-60ff-11e7-9ea9-57aa4c93fba8.png)\r\n\r\nDidn't found in Api Platform docs same recipes. What am I doing wrong?\r\n"},"comment":{"url":"https://api.github.com/repos/api-platform/api-platform/issues/comments/313427285","html_url":"https://github.com/api-platform/api-platform/issues/352#issuecomment-313427285","issue_url":"https://api.github.com/repos/api-platform/api-platform/issues/352","id":313427285,"user":{"login":"ssimplix","id":12474739,"avatar_url":"https://avatars1.githubusercontent.com/u/12474739?v=3","gravatar_id":"","url":"https://api.github.com/users/ssimplix","html_url":"https://github.com/ssimplix","followers_url":"https://api.github.com/users/ssimplix/followers","following_url":"https://api.github.com/users/ssimplix/following{/other_user}","gists_url":"https://api.github.com/users/ssimplix/gists{/gist_id}","starred_url":"https://api.github.com/users/ssimplix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssimplix/subscriptions","organizations_url":"https://api.github.com/users/ssimplix/orgs","repos_url":"https://api.github.com/users/ssimplix/repos","events_url":"https://api.github.com/users/ssimplix/events{/privacy}","received_events_url":"https://api.github.com/users/ssimplix/received_events","type":"User","site_admin":false},"created_at":"2017-07-06T15:16:42Z","updated_at":"2017-07-06T15:16:42Z","body":"@Gounlaf, this one about endpoints mapped with entities."}}
{"actor":{"display_login":"ssimplix"}}