Need help with JSONSchema.swift?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

kylef
218 Stars 45 Forks BSD 3-Clause "New" or "Revised" License 144 Commits 7 Opened issues

Description

JSON Schema validator in Swift

Services available

!
?

Need anything else?

Contributors list

No Data

JSON Schema

An implementation of JSON Schema in Swift. Supporting JSON Schema Draft 4, 6 and 7.

JSONSchema.swift does not support remote referencing #9.

Installation

JSONSchema can be installed via CocoaPods.

pod 'JSONSchema'

Usage

import JSONSchema

JSONSchema.validate(["name": "Eggs", "price": 34.99], schema: [ "type": "object", "properties": [ "name": ["type": "string"], "price": ["type": "number"], ], "required": ["name"], ])

Error handling

Validate returns an enumeration

ValidationResult
which contains all validation errors.
print(validate(["price": 34.99], schema: ["required": ["name"]]).errors)
>>> "Required property 'name' is missing."

License

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

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.