{"id":13509748,"url":"https://github.com/danmcclain/voorhees","last_synced_at":"2025-10-21T16:31:38.696Z","repository":{"id":31239537,"uuid":"34800960","full_name":"danmcclain/voorhees","owner":"danmcclain","description":null,"archived":true,"fork":false,"pushed_at":"2016-04-03T23:15:12.000Z","size":59,"stargazers_count":42,"open_issues_count":5,"forks_count":10,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-19T09:03:49.450Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danmcclain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-29T15:10:38.000Z","updated_at":"2023-09-01T12:07:54.000Z","dependencies_parsed_at":"2022-09-06T01:10:21.753Z","dependency_job_id":null,"html_url":"https://github.com/danmcclain/voorhees","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danmcclain%2Fvoorhees","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danmcclain%2Fvoorhees/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danmcclain%2Fvoorhees/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danmcclain%2Fvoorhees/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danmcclain","download_url":"https://codeload.github.com/danmcclain/voorhees/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246332205,"owners_count":20760438,"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":[],"created_at":"2024-08-01T02:01:12.291Z","updated_at":"2025-10-21T16:31:38.364Z","avatar_url":"https://github.com/danmcclain.png","language":"Elixir","funding_links":[],"categories":["Validations"],"sub_categories":[],"readme":"Voorhees\n========\n\n[![Build Status](https://travis-ci.org/danmcclain/voorhees.svg?branch=master)](https://travis-ci.org/danmcclain/voorhees)\n[![Inline docs](http://inch-ci.org/github/danmcclain/voorhees.svg?branch=master)](http://inch-ci.org/github/danmcclain/voorhees)\n\nA library for validating JSON responses\n\n## Documentation\n\nAPI documentation can be found at [http://hexdocs.pm/voorhees](http://hexdocs.pm/voorhees)\n\n## Examples\n\n### `Voorhees.matches_payload?`\n\nExpected payload keys can be either strings or atoms\n\n    iex\u003e payload = ~S[{ \"foo\": 1, \"bar\": \"baz\" }]\n    iex\u003e Voorhees.matches_payload?(payload, %{ :foo =\u003e 1, \"bar\" =\u003e \"baz\" })\n    true\n\nExtra key/value pairs in payload are ignored\n\n    iex\u003e payload = ~S[{ \"foo\": 1, \"bar\": \"baz\", \"boo\": 3 }]\n    iex\u003e Voorhees.matches_payload?(payload, %{ :foo =\u003e 1, \"bar\" =\u003e \"baz\" })\n    true\n\nExtra key/value pairs in expected payload cause the validation to fail\n\n    iex\u003e payload = ~S[{ \"foo\": 1, \"bar\": \"baz\"}]\n    iex\u003e Voorhees.matches_payload?(payload, %{ :foo =\u003e 1, \"bar\" =\u003e \"baz\", :boo =\u003e 3 })\n    false\n\nValidates scalar lists\n\n    iex\u003e payload = ~S/{ \"foo\": 1, \"bar\": [\"baz\"]}/\n    iex\u003e Voorhees.matches_payload?(payload, %{ :foo =\u003e 1, \"bar\" =\u003e [\"baz\"] })\n    true\n\n    # Order is respected\n    iex\u003e payload = ~S/{ \"foo\": 1, \"bar\": [1, \"baz\"]}/\n    iex\u003e Voorhees.matches_payload?(payload, %{ :foo =\u003e 1, \"bar\" =\u003e [\"baz\", 1] })\n    false\n\nValidates lists of objects\n\n    iex\u003e payload = ~S/[{ \"foo\": 1, \"bar\": { \"baz\": 2 }}]/\n    iex\u003e Voorhees.matches_payload?(payload, [%{ :foo =\u003e 1, \"bar\" =\u003e %{ \"baz\" =\u003e 2 } }])\n    true\n\nValidates nested objects\n\n    iex\u003e payload = ~S/{ \"foo\": 1, \"bar\": { \"baz\": 2 }}/\n    iex\u003e Voorhees.matches_payload?(payload, %{ :foo =\u003e 1, \"bar\" =\u003e %{ \"baz\" =\u003e 2 } })\n    true\n\nValidates nested lists of objects\n\n    iex\u003e payload = ~S/{ \"foo\": 1, \"bar\": [{ \"baz\": 2 }]}/\n    iex\u003e Voorhees.matches_payload?(payload, %{ :foo =\u003e 1, \"bar\" =\u003e [%{ \"baz\" =\u003e 2 }] })\n    true\n\n\n### `Voorhees.matches_schema?`\n\nValidating simple objects\n\n    iex\u003e payload = ~S[{ \"foo\": 1, \"bar\": \"baz\" }]\n    iex\u003e Voorhees.matches_schema?(payload, [:foo, \"bar\"]) # Property names can be strings or atoms\n    true\n\n    # Extra keys\n    iex\u003e payload = ~S[{ \"foo\": 1, \"bar\": \"baz\", \"boo\": 3 }]\n    iex\u003e Voorhees.matches_schema?(payload, [:foo, \"bar\"])\n    false\n\n    # Missing keys\n    iex\u003e payload = ~S[{ \"foo\": 1 }]\n    iex\u003e Voorhees.matches_schema?(payload, [:foo, \"bar\"])\n    false\n\nValidating lists of objects\n\n    iex\u003e payload = ~S/[{ \"foo\": 1, \"bar\": \"baz\" },{ \"foo\": 2, \"bar\": \"baz\" }]/\n    iex\u003e Voorhees.matches_schema?(payload, [:foo, \"bar\"])\n    true\n\n\nValidating nested lists of objects\n\n    iex\u003e payload = ~S/{ \"foo\": 1, \"bar\": [{ \"baz\": 2 }]}/\n    iex\u003e Voorhees.matches_schema?(payload, [:foo, bar: [:baz]])\n    true\n\nValidating that a property is a list of scalar values\n\n    iex\u003e payload = ~S/{ \"foo\": 1, \"bar\": [\"baz\", 2]}/\n    iex\u003e Voorhees.matches_schema?(payload, [:foo, bar: []])\n    true\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanmcclain%2Fvoorhees","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanmcclain%2Fvoorhees","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanmcclain%2Fvoorhees/lists"}