I'm writing a JSON service for JIRA, and I've come across a requirement that conflicts with Haskell's namespace. I have this record
data Assignee = Assignee {name :: Text} deriving Generic
instance ToJSON Assignee
This is dictated by what JIRA wants, unfortunately it wants the same field for a different object.
data Reporter = Reporter {name :: Text} deriving Generic
instance ToJSON Reporter
I see a few options:
- Maybe I can circumvent the compiler's complaining with template Haskell, but how?
- I could simply not have a Reporter record, and change the reporter field with a seperate service after the ticket has been created. That I know how to do, but is it the best way?
Create the JSON object by hand, but I form it from this record:
data Fields = Fields { project :: HashMap Key Project , summary :: Text , issuetype :: HashMap Name Task , versions :: [HashMap Name Text] , description :: Text , assignee :: Assignee } deriving (Generic)
The thought of making this by hand gives me the wiggins. If I must I will.
So, my question now is, if there is no other better way than the ones I've presented, which of these is the best course of action?