{"id":19866149,"url":"https://github.com/tlux/vx","last_synced_at":"2026-03-01T12:01:46.773Z","repository":{"id":229471810,"uuid":"706829338","full_name":"tlux/vx","owner":"tlux","description":"Elixir schema parser","archived":false,"fork":false,"pushed_at":"2024-07-19T21:42:49.000Z","size":310,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-19T22:49:47.546Z","etag":null,"topics":["elixir","elixir-library","hex-package","schema-validation"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"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/tlux.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-18T17:41:10.000Z","updated_at":"2024-05-18T19:35:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"93001d0c-9b2d-4dff-8755-56ec4d7850d7","html_url":"https://github.com/tlux/vx","commit_stats":null,"previous_names":["tlux/vx"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/tlux/vx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlux%2Fvx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlux%2Fvx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlux%2Fvx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlux%2Fvx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tlux","download_url":"https://codeload.github.com/tlux/vx/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlux%2Fvx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29969243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T11:43:06.159Z","status":"ssl_error","status_checked_at":"2026-03-01T11:43:03.887Z","response_time":124,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["elixir","elixir-library","hex-package","schema-validation"],"created_at":"2024-11-12T15:25:06.379Z","updated_at":"2026-03-01T12:01:46.758Z","avatar_url":"https://github.com/tlux.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vx\n\n[![Build](https://github.com/tlux/vx/actions/workflows/elixir.yml/badge.svg)](https://github.com/tlux/vx/actions/workflows/elixir.yml)\n[![Coverage Status](https://coveralls.io/repos/github/tlux/vx/badge.svg?branch=main)](https://coveralls.io/github/tlux/vx?branch=main)\n[![Module Version](https://img.shields.io/hexpm/v/vx.svg)](https://hex.pm/packages/vx)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/vx/)\n[![License](https://img.shields.io/hexpm/l/vx.svg)](https://github.com/tlux/vx/blob/main/LICENSE.md)\n[![Last Updated](https://img.shields.io/github/last-commit/tlux/vx.svg)](https://github.com/tlux/vx/commits/main)\n\nThe Elixir schema validator.\n\n## Installation\n\nThe package can be installed by adding `vx` to your list of dependencies in\n`mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:vx, \"~\u003e 0.4.0\"}\n  ]\nend\n```\n\n## Usage\n\nWith Vx, you have the capability to define schemata for validating complex data\neffortlessly.\n\nFirst, you need to define your schema.\n\n```elixir\nschema = Vx.String.t()\n```\n\nAfter that, you can call `Vx.validate/2` or `Vx.validate!/2` to check if a given\nvalues matches:\n\n```elixir\nVx.validate(schema, \"foo\")\n# :ok\n```\n\nWhen the value does not match, an error is returned (or raised, respectively),\nindicating the specific issue.\n\n```elixir\nVx.validate(schema, 123)\n# {:error, %Vx.Error{...}}\n```\n\n```elixir\nVx.validate!(schema, 123)\n# ** (Vx.Error) must be a string\n```\n\nAdditional constraints can be added to certain types by piping everything\ntogether:\n\n```elixir\nVx.Number.t()\n|\u003e Vx.Number.gteq(3)\n|\u003e Vx.Number.lt(7)\n```\n\nYou can combine multiple types and constraints to validate more complex\nschemata:\n\n```elixir\nVx.Map.shape(%{\n  \"name\" =\u003e Vx.String.t(),\n  \"age\" =\u003e Vx.Number.t(),\n  \"hobbies\" =\u003e\n    Vx.List.t(Vx.String.present())\n    |\u003e Vx.List.non_empty(),\n  \"type\" =\u003e Vx.Enum.t([\"user\", \"admin\"]),\n  \"addresses\" =\u003e Vx.List.t(Vx.Struct.t(Address))\n})\n```\n\n## Docs\n\nTake a look at the [documentation](https://hexdocs.pm/vx) to find out available\ntypes and options.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftlux%2Fvx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftlux%2Fvx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftlux%2Fvx/lists"}