All Projects → NoRedInk → json-elm-schema

NoRedInk / json-elm-schema

Licence: BSD-3-Clause license
No description, website, or topics provided.

Programming Languages

elm
856 projects
javascript
184084 projects - #8 most used programming language

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].