{"id":13509738,"url":"https://github.com/prio/shape","last_synced_at":"2025-10-21T15:32:26.828Z","repository":{"id":57547359,"uuid":"38010961","full_name":"prio/shape","owner":"prio","description":"A data validation library for Elixir based on Prismatic Scheme","archived":false,"fork":false,"pushed_at":"2015-06-25T20:08:43.000Z","size":140,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-19T21:49:28.253Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/prio.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2015-06-24T21:06:41.000Z","updated_at":"2020-09-18T23:32:20.000Z","dependencies_parsed_at":"2022-09-05T12:30:36.155Z","dependency_job_id":null,"html_url":"https://github.com/prio/shape","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/prio/shape","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prio%2Fshape","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prio%2Fshape/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prio%2Fshape/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prio%2Fshape/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prio","download_url":"https://codeload.github.com/prio/shape/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prio%2Fshape/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280286345,"owners_count":26304709,"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-10-21T02:00:06.614Z","response_time":58,"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":[],"created_at":"2024-08-01T02:01:12.178Z","updated_at":"2025-10-21T15:32:26.779Z","avatar_url":"https://github.com/prio.png","language":"Elixir","funding_links":[],"categories":["Validations"],"sub_categories":[],"readme":"Shape\n=====\n\nShape is library that allows you to declaratively describe and validate your data structures.\n\nTo use add\n\n[{:shape, \"0.0.2\"}]\n\nto your mix dependencies.\n\nExample Usage:\n\u003cpre\u003e\n  iex\u003e alias Shape, as: S\n  nil\n\n  iex\u003e S.validate(S.Num, 42)\n  :ok\n\n  iex\u003e S.validate(S.Num, \"42\")\n  {:error, \"42 is not a number\"}\n\n  # Check list shape\n  iex\u003e S.validate([S.Atom, S.Str, S.Int], [:a, \"b\", 1])\n  :ok\n\n  iex\u003e S.validate([S.Int], [1, 2, 3])\n  :ok\n\n  iex\u003e S.validate([S.Str, S.Int, S.Int], [:a, \"b\", 1])\n  {:error, [\"a is not a string\", \"b is not a integer\"]}\n\n  # Check map shape\n  iex\u003e S.validate(%{S.Atom =\u003e S.Str}, %{o: \"k\"})\n  :ok\n\n  iex\u003e S.validate(%{S.Atom =\u003e S.Int, S.Str =\u003e S.Int}, %{\"o\" =\u003e \"k\", \"o\" =\u003e :k})\n  {:error, [\"o is not a atom\", \"k is not a integer\"]}\n\n  # Check map key values rather than types\n  iex\u003e S.validate(%{:o =\u003e S.Str, \"o\" =\u003e S.Str}, %{:o =\u003e \"k\", \"o\" =\u003e \"k\"})\n  :ok\n\n  iex\u003e S.validate(%{:b =\u003e S.Str, \"o\" =\u003e S.Str}, %{:o =\u003e \"k\", \"o\" =\u003e \"k\"})\n  {:error, [\"o is not equal to b\"]}\n\n  # check Keyword list shape\n  iex\u003e S.validate([o: S.Str, a: S.Str], [o: \"k\", a: \"ok\"])\n  :ok\n\n  iex\u003e S.validate([o: S.Int, b: S.Str], [o: \"k\", a: \"ok\"])\n  {:error, [\"a is not equal to b\", \"k is not a integer\"]}\n\u003c/pre\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprio%2Fshape","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprio%2Fshape","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprio%2Fshape/lists"}