No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cli
example
src
tests
.gitignore
.travis.yml
LICENSE
README.md
elm-package.json
package.json
yarn.lock

README.md

Elm JSON Schema

It's very easy to write a JSON Schema that is valid JSON but not a valid JSON Schema. Such faulty schema's still work, they'll just be less strict then you think they are. Usually you'll learn about this a bit later than you'd prefer.

Elm-json-schema allows you to write your JSON schema's in Elm, ensuring a valid result.

Example

personSchema : Schema
personSchema =
    object
        [ title "person"
        , properties
            [ required "firstName" <| string []
            , required "lastName" <| string []
            , optional "age" <|
                integer
                    [ description "Age in years"
                    , minimum 0
                    ]
            , optional "height" <|
                number
                    [ description "Height in meters"
                    , minimum 0
                    ]
            , required "tags" <|
                array 
                    [ items <| string []
                    , minItems 1
                    ]
            ]
        ]

Links