{"id":17791700,"url":"https://github.com/jonathanjouty/aeson-possible","last_synced_at":"2025-04-02T01:51:04.773Z","repository":{"id":216662449,"uuid":"733638337","full_name":"jonathanjouty/aeson-possible","owner":"jonathanjouty","description":"Three-valued types for use with aeson. Useful for use in PATCH endpoints.","archived":false,"fork":false,"pushed_at":"2024-01-23T13:40:14.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-25T23:02:21.070Z","etag":null,"topics":["aeson"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonathanjouty.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-19T19:30:52.000Z","updated_at":"2024-06-27T17:09:02.891Z","dependencies_parsed_at":"2024-06-27T17:08:57.681Z","dependency_job_id":null,"html_url":"https://github.com/jonathanjouty/aeson-possible","commit_stats":null,"previous_names":["jonathanjouty/aeson-possible"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanjouty%2Faeson-possible","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanjouty%2Faeson-possible/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanjouty%2Faeson-possible/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanjouty%2Faeson-possible/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonathanjouty","download_url":"https://codeload.github.com/jonathanjouty/aeson-possible/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246741185,"owners_count":20826063,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aeson"],"created_at":"2024-10-27T10:55:03.059Z","updated_at":"2025-04-02T01:51:04.749Z","avatar_url":"https://github.com/jonathanjouty.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# aeson-possible\n\n[![Build \u0026 Test](https://github.com/jonathanjouty/aeson-possible/actions/workflows/ci-haskell.yml/badge.svg)](https://github.com/jonathanjouty/aeson-possible/actions/workflows/ci-haskell.yml)\n\nThree-valued possible types for use with `aeson`.\n\nUseful for use in PATCH endpoints: use in records which have `ToJSON` and\n`FromJSON` instances.\n\nInspired by the [`possible`](https://hackage.haskell.org/package/possible)\npackage, but additionally provides To/FromJSON instances using `aeson \u003e= 2.2`'s\n`omitField` and `omittedField` machinery.\n\n## Usage\n\nUse `Possible a` in your records\n\n```hs\ndata MyRecord = MyRecord\n    { myBool :: Possible Bool\n    , myInt  :: Possible Int\n    , myStr  :: Possible Text\n    }\n    deriving (Generic)\n```\n\nand then make sure to use the correct options if you are generically deriving\nyour To/FromJSON instances:\n\n```hs\ninstance ToJSON MyRecord where\n    toJSON = genericToJSON $ defaultOptions{omitNothingFields = True}\n\ninstance FromJSON MyRecord where\n    parseJSON = genericParseJSON $ defaultOptions{allowOmittedFields = True}\n```\n\nNote that `omitNothingFields` affects `ToJSON`, and `allowOmittedFields`\naffects `FromJSON`. You can, of course, also set both to `True`.\n\nIf you are creating instances any other way, see `aeson`'s documentation for\nhow to make use of `omitField` and `omittedField`.\n\n_Caveat:_ if you are using `Possible` outside a record, even a `Missing` value\nwill likely be encoded as `null` (_e.g._ if you have a list of `Possible`\nvalues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanjouty%2Faeson-possible","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonathanjouty%2Faeson-possible","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanjouty%2Faeson-possible/lists"}