An implementation of JSON Schema in Swift.

Installation

Usage

import JSONSchema let schema = Schema([ "type": "object", "properties": [ "name": ["type": "string"], "price": ["type": "Number"]], "required" : (" name "),]) schema. The validate ([" name ":" dense Eggs ", "price" : 34.99])Copy the code

Error handling

Validate returns an enumeration ValidationResult which contains all validation errors.

Println (schema.validate(["price": 34.99]).errors) >>> "Required property 'name' is missing."Copy the code

JSONSchema has full support for the draft4 of the specification. It does not yet support remote referencing #9.

License

JSONSchema is licensed under the BSD license. See LICENSE for more info.