{"action":"created","issue":{"url":"https://api.github.com/repos/prolic/fpp/issues/31","repository_url":"https://api.github.com/repos/prolic/fpp","labels_url":"https://api.github.com/repos/prolic/fpp/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/prolic/fpp/issues/31/comments","events_url":"https://api.github.com/repos/prolic/fpp/issues/31/events","html_url":"https://github.com/prolic/fpp/issues/31","id":309402508,"number":31,"title":"Wrongly generated Commands with enum types?","user":{"login":"Maikel-Koek","id":6301809,"avatar_url":"https://avatars3.githubusercontent.com/u/6301809?v=4","gravatar_id":"","url":"https://api.github.com/users/Maikel-Koek","html_url":"https://github.com/Maikel-Koek","followers_url":"https://api.github.com/users/Maikel-Koek/followers","following_url":"https://api.github.com/users/Maikel-Koek/following{/other_user}","gists_url":"https://api.github.com/users/Maikel-Koek/gists{/gist_id}","starred_url":"https://api.github.com/users/Maikel-Koek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Maikel-Koek/subscriptions","organizations_url":"https://api.github.com/users/Maikel-Koek/orgs","repos_url":"https://api.github.com/users/Maikel-Koek/repos","events_url":"https://api.github.com/users/Maikel-Koek/events{/privacy}","received_events_url":"https://api.github.com/users/Maikel-Koek/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2018-03-28T14:52:53Z","updated_at":"2018-03-28T15:57:31Z","closed_at":"2018-03-28T15:45:16Z","author_association":"NONE","body":"Hi @prolic,\r\n\r\nI've just changed my declaration to the new ENUM style:\r\n\r\n```\r\n    data CancellationReason = BadService | UnknownReason deriving(Enum);\r\n```\r\n\r\nBut this seems to be causing issues when using in a command.\r\n\r\nMy .fpp (shortened):\r\n\r\n```\r\nnamespace ReachDigital\\Subscription\\Model\\Subscription {\r\n    data SubscriptionId = SubscriptionId deriving(Uuid);\r\n    ...\r\n    data CancellationReason = BadService | UnknownReason deriving(Enum);\r\n}\r\nnamespace ReachDigital\\Subscription\\Model\\Subscription\\Command {\r\n    ...\r\n    data CancelSubscription = CancelSubscription {\r\n        \\ReachDigital\\Subscription\\Model\\Subscription\\SubscriptionId $subscriptionId,\r\n        \\ReachDigital\\Subscription\\Model\\Subscription\\CancellationReason $reason\r\n    } deriving(Command);\r\n    ...\r\n}\r\n```\r\n\r\nThis results in the following file for `ReachDigital\\Subscription\\Model\\Subscription\\Command\\CancelSubscription`:\r\n\r\n```\r\n<?php\r\n\r\n// this file is auto-generated by prolic/fpp\r\n// don't edit this file manually\r\n\r\ndeclare(strict_types=1);\r\n\r\nnamespace ReachDigital\\Subscription\\Model\\Subscription\\Command;\r\n\r\nfinal class CancelSubscription extends \\Prooph\\Common\\Messaging\\Command\r\n{\r\n    use \\Prooph\\Common\\Messaging\\PayloadTrait;\r\n\r\n    protected $messageName = 'ReachDigital\\Subscription\\Model\\Subscription\\Command\\CancelSubscription';\r\n\r\n    public function subscriptionId(): \\ReachDigital\\Subscription\\Model\\Subscription\\SubscriptionId\r\n    {\r\n        return \\ReachDigital\\Subscription\\Model\\Subscription\\SubscriptionId::fromString($this->payload['subscriptionId']);\r\n    }\r\n\r\n    public function reason(): \\ReachDigital\\Subscription\\Model\\Subscription\\CancellationReason\r\n    {\r\n        return \\ReachDigital\\Subscription\\Model\\Subscription\\CancellationReason::fromString($this->payload['reason']);\r\n    }\r\n\r\n    public static function with(\\ReachDigital\\Subscription\\Model\\Subscription\\SubscriptionId $subscriptionId, \\ReachDigital\\Subscription\\Model\\Subscription\\CancellationReason $reason): CancelSubscription\r\n    {\r\n        return new self([\r\n            'subscriptionId' => $subscriptionId->toString(),\r\n            'reason' => $reason->toString(),\r\n        ]);\r\n    }\r\n\r\n    protected function setPayload(array $payload): void\r\n    {\r\n        if (! isset($payload['subscriptionId']) || ! is_string($payload['subscriptionId'])) {\r\n            throw new \\InvalidArgumentException(\"Key 'subscriptionId' is missing in payload or is not a string\");\r\n        }\r\n\r\n        if (! isset($payload['reason']) || ! is_string($payload['reason'])) {\r\n            throw new \\InvalidArgumentException(\"Key 'reason' is missing in payload or is not a string\");\r\n        }\r\n\r\n        $this->payload = $payload;\r\n    }\r\n}\r\n```\r\n\r\nWhich causes issues, because `CancellationReason::fromString()` and `CancellationReason::toString()` are being used, while these are not in the that class anymore since the updated enum logic.\r\n\r\nAm I doing something wrong?\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/prolic/fpp/issues/comments/376939429","html_url":"https://github.com/prolic/fpp/issues/31#issuecomment-376939429","issue_url":"https://api.github.com/repos/prolic/fpp/issues/31","id":376939429,"user":{"login":"Maikel-Koek","id":6301809,"avatar_url":"https://avatars3.githubusercontent.com/u/6301809?v=4","gravatar_id":"","url":"https://api.github.com/users/Maikel-Koek","html_url":"https://github.com/Maikel-Koek","followers_url":"https://api.github.com/users/Maikel-Koek/followers","following_url":"https://api.github.com/users/Maikel-Koek/following{/other_user}","gists_url":"https://api.github.com/users/Maikel-Koek/gists{/gist_id}","starred_url":"https://api.github.com/users/Maikel-Koek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Maikel-Koek/subscriptions","organizations_url":"https://api.github.com/users/Maikel-Koek/orgs","repos_url":"https://api.github.com/users/Maikel-Koek/repos","events_url":"https://api.github.com/users/Maikel-Koek/events{/privacy}","received_events_url":"https://api.github.com/users/Maikel-Koek/received_events","type":"User","site_admin":false},"created_at":"2018-03-28T15:57:31Z","updated_at":"2018-03-28T15:57:31Z","author_association":"NONE","body":"Awesome, working now, thanks!"}}
{"actor":{"display_login":"Maikel-Koek"}}