Skip to content

tommy351/mayo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mayo

Build Status Hex pm Coverage Status Inline docs

Schema validator inspired by Joi.

Installation

Add mayo to mix.exs dependencies.

defp deps do
  [{:mayo, "~> 0.1.0"}]
end

Download the dependencies.

$ mix deps.get

Usage

defmodule MyModule do
  require Mayo

  def call do
    Mayo.validate %{
      username: "John",
      password: "1234"
    }, %{
      username: Mayo.Any.string |> Mayo.String.min(4),
      password: Mayo.Any.string |> Mayo.String.min(6)
    }
    # {:error, %Mayo.Error{type: "string.min", paths: [:password]}}
  end
end

About

Schema validator inspired by Joi.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages