{"id":19210340,"url":"https://github.com/seniverse/ex_fieldmask","last_synced_at":"2025-05-12T19:22:48.143Z","repository":{"id":62429109,"uuid":"189205008","full_name":"seniverse/ex_fieldmask","owner":"seniverse","description":"FieldMask implements Partial Responses protocol of Google+ API purely in Elixir via algorithmic method.","archived":false,"fork":false,"pushed_at":"2019-10-21T11:00:59.000Z","size":53,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-12T19:22:36.592Z","etag":null,"topics":["elixir","elixir-lang","elixir-library","google-api","graphql","partial-responses"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/ex_fieldmask/readme.html","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seniverse.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}},"created_at":"2019-05-29T10:36:55.000Z","updated_at":"2024-10-17T07:58:43.000Z","dependencies_parsed_at":"2022-11-01T20:03:24.683Z","dependency_job_id":null,"html_url":"https://github.com/seniverse/ex_fieldmask","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seniverse%2Fex_fieldmask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seniverse%2Fex_fieldmask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seniverse%2Fex_fieldmask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seniverse%2Fex_fieldmask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seniverse","download_url":"https://codeload.github.com/seniverse/ex_fieldmask/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253806237,"owners_count":21967125,"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":["elixir","elixir-lang","elixir-library","google-api","graphql","partial-responses"],"created_at":"2024-11-09T13:35:46.913Z","updated_at":"2025-05-12T19:22:48.087Z","avatar_url":"https://github.com/seniverse.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FieldMask\n\n[![Build Status](https://travis-ci.org/seniverse/ex_fieldmask.svg?branch=master)](https://travis-ci.org/seniverse/ex_fieldmask)\n[![Coverage Status](https://coveralls.io/repos/github/seniverse/ex_fieldmask/badge.svg?branch=master)](https://coveralls.io/github/seniverse/ex_fieldmask?branch=master)\n[![hex.pm version](https://img.shields.io/hexpm/v/ex_fieldmask.svg)](https://hex.pm/packages/ex_fieldmask)\n[![hex.pm downloads](https://img.shields.io/hexpm/dt/ex_fieldmask.svg)](https://hex.pm/packages/ex_fieldmask)\n\nFieldMask implements [Partial Responses protocol of Google+ API](https://developers.google.com/+/web/api/rest/#partial-responses) purely in Elixir via algorithmic method rather than grammar way which is adopted by [fieldmask](https://github.com/seniverse/fieldmask).\n\nIt's the counterpart of [JSON Mask](https://github.com/nemtsov/json-mask) in JavaScript and [jsonmask](https://github.com/zapier/jsonmask) in Python.\n\n## Installation\n\nThe package can be installed by adding `ex_fieldmask` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:ex_fieldmask, \"~\u003e 0.3.0\"} # replace version with newest one\n  ]\nend\n```\n\n## Examples\n\n```shell\niex\u003e FieldMask.mask(\"a,b\", %{\"a\" =\u003e 1, \"b\" =\u003e 2, \"c\" =\u003e 3})\n{:ok, %{\"a\" =\u003e 1, \"b\" =\u003e 2}}\n\niex\u003e FieldMask.mask(\"a/b\", %{\"a\" =\u003e %{\"b\" =\u003e 2, \"c\" =\u003e 3}})\n{:ok, %{\"a\" =\u003e %{\"b\" =\u003e 2}}}\n\niex\u003e FieldMask.mask(\"a(b,c)\", %{\"a\" =\u003e %{\"b\" =\u003e 1, \"c\" =\u003e 2, \"d\" =\u003e 3}, \"e\" =\u003e 4})\n{:ok, %{\"a\" =\u003e %{\"b\" =\u003e 1, \"c\" =\u003e 2}}}\n\niex\u003e FieldMask.mask(\"a/*/c\", %{\"a\" =\u003e %{\"b\" =\u003e %{\"c\" =\u003e 2, \"e\" =\u003e 1}, \"d\" =\u003e %{ \"c\" =\u003e 4, \"f\" =\u003e 3}}})\n{:ok, %{\"a\" =\u003e %{\"b\" =\u003e %{\"c\" =\u003e 2}, \"d\" =\u003e %{\"c\" =\u003e 4}}}}\n\niex\u003e FieldMask.mask(\"a/b)\", %{\"a\" =\u003e 1, \"b\" =\u003e 2, \"c\" =\u003e 3})\n{:error, \"Invalid text with mismatched brackets: a/b)\"}\n```\n\nCheck test folder to see more examples.\n\nIt returns `{:ok, masked_json}` or `{:error, error_message}`. `masked_json` is either a Map or a List in Elixir and `error_message` is a String. Besides, if `text` in invalid or data isn't a decoded JSON, exception would be raised. You are expected to `rescue` the exception or just let it crash catering to the actual condition.\n\nUse [`Poison`](https://github.com/devinus/poison) or other JSON related packages to encode/decode a JSON to/from inner data structure of Elixir.\n\n## One more thing\n\nTake a look at [json-mask#syntax](https://github.com/nemtsov/json-mask#syntax) for the syntax and grammar of Partial Responses protocol of Google+ API.\n\nUnlike package [fieldmask](https://github.com/seniverse/fieldmask) also in the [Seniverse](https://github.com/seniverse) orgnization, this one adopt algorithmic way to parse descriptive `text` and mask your data object. By this way, it's not that strict while parsing text. For example, `\"a(b)c\"` is equivalent to `\"a(b),c\"` although you miss the comma `,`. They can both pass the validation and compiled as `%{\"a\" =\u003e %{\"b\" =\u003e %{}}, \"c\" =\u003e %{}}` to do the masking job. This is intentional but you should always use the strict valid syntax.\n\n## Benchmark\n\nSee [fieldmask_benchmark](https://github.com/seniverse/fieldmask_benchmark).\n\n## ChangeLog\n\n[CHANGELOG](https://github.com/seniverse/ex_fieldmask/blob/master/CHANGELOG.md)\n\n## License\n\n[Apache 2.0](https://github.com/seniverse/ex_fieldmask/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseniverse%2Fex_fieldmask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseniverse%2Fex_fieldmask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseniverse%2Fex_fieldmask/lists"}