Latest 0.3.0
Homepage https://github.com/kylef/JSONSchema.swift
License BSD
Platforms ios 8.0, osx 10.9, requires ARC
Authors

JSON Schema

An implementation of JSON Schema in Swift.

Installation

CocoaPods is the recommended installation method.

pod 'JSONSchema'

Usage

import JSONSchema

let schema = Schema([
    "type": "object",
    "properties": [
        "name": ["type": "string"],
        "price": ["type": "number"],
    ],
    "required": ["name"],
])

schema.validate(["name": "Eggs", "price": 34.99])

Error handling

Validate returns an enumeration ValidationResult which contains all
validation errors.

println(schema.validate(["price": 34.99]).errors)
>>> "Required property 'name' is missing."

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.

Latest podspec

{
    "name": "JSONSchema",
    "version": "0.3.0",
    "summary": "JSON Schema validator in Swift.",
    "homepage": "https://github.com/kylef/JSONSchema.swift",
    "license": {
        "type": "BSD",
        "file": "LICENSE"
    },
    "authors": {
        "Kyle Fuller": "[email protected]"
    },
    "social_media_url": "http://twitter.com/kylefuller",
    "source": {
        "git": "https://github.com/kylef/JSONSchema.swift.git",
        "tag": "0.3.0"
    },
    "platforms": {
        "ios": "8.0",
        "osx": "10.9"
    },
    "requires_arc": true,
    "source_files": [
        "Sources/JSONSchema.{h,swift}",
        "Sources/Validators.swift"
    ]
}

Pin It on Pinterest

Share This