{"id":23172063,"url":"https://github.com/choonkeat/elm-auto-encoder-decoder","last_synced_at":"2025-08-18T07:32:28.885Z","repository":{"id":36668610,"uuid":"228419125","full_name":"choonkeat/elm-auto-encoder-decoder","owner":"choonkeat","description":"cli to watch *.elm file changes and generate Elm encoder and decoders for each type in the source code. used in https://github.com/choonkeat/elm-webapp","archived":false,"fork":false,"pushed_at":"2024-06-16T10:20:29.000Z","size":184,"stargazers_count":8,"open_issues_count":5,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-08-10T08:49:14.776Z","etag":null,"topics":["decoder","elm","encoder","json"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/elm-auto-encoder-decoder","language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/choonkeat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-16T15:38:27.000Z","updated_at":"2024-01-12T13:58:25.000Z","dependencies_parsed_at":"2022-08-27T06:50:40.015Z","dependency_job_id":null,"html_url":"https://github.com/choonkeat/elm-auto-encoder-decoder","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/choonkeat/elm-auto-encoder-decoder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choonkeat%2Felm-auto-encoder-decoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choonkeat%2Felm-auto-encoder-decoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choonkeat%2Felm-auto-encoder-decoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choonkeat%2Felm-auto-encoder-decoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/choonkeat","download_url":"https://codeload.github.com/choonkeat/elm-auto-encoder-decoder/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choonkeat%2Felm-auto-encoder-decoder/sbom","scorecard":{"id":278785,"data":{"date":"2025-08-11","repo":{"name":"github.com/choonkeat/elm-auto-encoder-decoder","commit":"06d081f190f97a8d0f197e7d80155da7e4743a4b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.1,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":6,"reason":"4 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T15:11:34.300Z","repository_id":36668610,"created_at":"2025-08-17T15:11:34.300Z","updated_at":"2025-08-17T15:11:34.300Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270961777,"owners_count":24675916,"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","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["decoder","elm","encoder","json"],"created_at":"2024-12-18T04:20:54.003Z","updated_at":"2025-08-18T07:32:28.621Z","avatar_url":"https://github.com/choonkeat.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# elm-auto-encoder-decoder\n\nGenerate automatic encoder and decoder. Leveraged by [choonkeat/elm-webapp](https://github.com/choonkeat/elm-webapp#readme) `Client` and `Server` instances to pass `Msg` to and fro.\n\n_NOTE: While the generated decoders can always decode json encoded by the same version generator, there is no guarantee future versions can decode whatever was encoded in prior versions. :. If you're storing json for later retrieval, I do not recommend using the encoder/decoder here; I don't._\n\n## Usage\n\n```\nnpx elm-auto-encoder-decoder src/Types.elm\n```\n\nany time `src/Types.elm` file changes, `src/Types/Auto.elm` will be regenerated.\n\n## ENV variable configurations\n\n`GENERATED_SRC` will write `Auto.elm` files to a different directory than the source files, while keeping the directory hierarchy. e.g. `GENERATED_SRC=generated/src`\n\n`WATCHING` when set to `false` will exit after a single run, instead of hanging around waiting for file changes. e.g. `WATCHING=false`\n\n`EXTRA_IMPORT` is written to all `Auto.elm` files if present, e.g. `EXTRA_IMPORT='Time.Extra excposing (..)'`\n\n## How it works\n\nAn Elm module `Foo.Bar` like below\n\n``` elm\nmodule Foo.Bar exposing (..)\n\ntype alias Choice =\n    Option Bool\n\n\ntype Option a\n    = None\n    | Some a\n```\n\nwill be encoded and decoded as JSON like\n\n\n```json\n[\"Foo.Bar.None\"]\n[\"Foo.Bar.Some\",true]\n```\n\nby the generated Elm functions in the corresponding [`Foo.Bar.Auto` module function](https://github.com/choonkeat/elm-auto-encoder-decoder/blob/21a3cd4d46e8bbdd418a3069fb5b79f6efd6a1be/src/Foo/Bar/Auto.elm#L242-L246)\n\n### Auto encoder decoders of related types\n\nIf `src/A.elm` imports from `src/B.elm`, its better to provide both filenames to the cli. The generated encoder/decoder of `A` will automatically reference the generated encoder/decoder of `B`\n\n### Exposed types\n\nNo encoder/decoder functions will be generated for types that are not fully exposed. i.e. a custom type has to be exposed with `(..)` e.g. `MyType(..)`.\n\nHowever, if there are exposed types that are composed from unexposed types, you're expected to supply the encoder/decoder functions manually by naming convention (see next point)\n\n### Don't be alarmed with \"I cannot find ... variable\" compiler errors\n\nIf your `src/Types.elm` contain types imported from other modules, e.g. `Time.Posix`\n\n```elm\ntype alias User = { name : String, createdAt : Time.Posix }\n```\n\nthe generated code will likely not compile\n\n```\n-- NAMING ERROR --------------------------------------------- src/Types/Auto.elm\n\nI cannot find a `decodeTimePosix` variable:\n\n248|         |\u003e Json.Decode.map2 (|\u003e) (Json.Decode.at [ \"createdAt\" ] (decodeTimePosix))\n                                                                       ^^^^^^^^^^^^^^^\n-- NAMING ERROR --------------------------------------------- src/Types/Auto.elm\n\nI cannot find a `encodeTimePosix` variable:\n\n197|         , (\"createdAt\", (encodeTimePosix) value.createdAt)\n                              ^^^^^^^^^^^^^^^\n```\n\n**just implement and expose those function names** in your source `src/Types.elm` (or a different file specified by `EXTRA_IMPORT` env), for example:\n\n``` elm\ndecodeTimePosix : Json.Decode.Decoder Time.Posix\ndecodeTimePosix =\n    Json.Decode.int\n        |\u003e Json.Decode.map Time.millisToPosix\n\n\nencodeTimePosix : Time.Posix -\u003e Json.Encode.Value\nencodeTimePosix t =\n    Json.Encode.int (Time.posixToMillis t)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchoonkeat%2Felm-auto-encoder-decoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchoonkeat%2Felm-auto-encoder-decoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchoonkeat%2Felm-auto-encoder-decoder/lists"}