Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add initial ToJSON #15

Closed
wants to merge 2 commits into from
Closed

WIP: Add initial ToJSON #15

wants to merge 2 commits into from

Conversation

Exegetech
Copy link

Issue reference:
#12

This is my first attempt to add ToJSON instances. I am not sure how to do it better with line 689

I am also curious, how does FromJSON parses the time format for created_at, updated_at, and closed_at. I looked through the file and the repl, it seems there's no instance FromJSON UTCTime anywhere.

@kvanbere
Copy link
Member

kvanbere commented Apr 20, 2018

There should be instances for those (at least I think they seem to work fine in the smoke tests?).

Maybe fields should not be rendered at all (i.e. not present) when they are Nothing rather than rendering with blank or zero content. I will have to do some reading on aeson to review this properly.

@Exegetech
Copy link
Author

I see, it could be somewhere, I'll just have to look it up. I just wanted to double check.

, "comments" .= whIssueCommentCount hookIssue
, "created_at" .= whIssueCreatedAt hookIssue
, "updated_at" .= whIssueUpdatedAt hookIssue
, "closed_at" .= (case whIssueClosedAt hookIssue of
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to return an empty string if there is no value for closed_at - i.e. it is Nothing?

Instead, how about about letting it possibly be null via fmap toJSON (whIssueClosedAt hookIssue) ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I'll do that

@kvanbere
Copy link
Member

kvanbere commented May 6, 2018

There's still a lot to do here, isn't there? Not a 0.11.0 item?

@Exegetech
Copy link
Author

Sorry, I still haven't find time to work on it since the latest changes. Currently in the middle of finishing my semester with homework and final exams. I'll get back to it soon!

@kvanbere kvanbere force-pushed the master branch 11 times, most recently from 9ecea05 to 05b1a85 Compare October 17, 2019 11:03
@kvanbere
Copy link
Member

I'm going to close this because it's reasonably old. Anyone attempting this can try and rebase it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants