• Stars
    star
    274
  • Rank 150,274 (Top 3 %)
  • Language
    Swift
  • License
    BSD 3-Clause "New...
  • Created over 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

JSON Schema validator in Swift

JSON Schema

An implementation of JSON Schema in Swift. Supporting JSON Schema Draft 4, 6, 7, 2019-09, 2020-12.

The JSON Schema 2019-09 and 2020-12 support are incomplete and have gaps with some of the newer keywords.

JSONSchema.swift does not support remote referencing #9.

Installation

JSONSchema can be installed via CocoaPods.

pod 'JSONSchema'

Usage

import JSONSchema

try 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(try 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.

More Repositories

1

swiftenv

Swift Version Manager
Shell
1,979
star
2

Commander

Compose beautiful command line interfaces in Swift
Swift
1,530
star
3

Mockingjay

An elegant library for stubbing HTTP requests with ease in Swift
Swift
1,490
star
4

PathKit

Effortless path operations in Swift
Swift
1,453
star
5

JSONWebToken.swift

Swift implementation of JSON Web Token (JWT).
Swift
763
star
6

Spectre

BDD Framework and test runner for Swift projects and playgrounds
Swift
403
star
7

URITemplate.swift

Swift implementation of URI Template (RFC6570)
Swift
199
star
8

apiblueprint.vim

This vim plugin brings syntax highlighting and linting for API Blueprint.
Vim Script
113
star
9

dotfiles

kylef's dotfile
Vim Script
33
star
10

swiftenv-api

API for swiftenv to return the available versions of Swift
Python
25
star
11

draughtsman

API Blueprint Parser for Python 3
Python
23
star
12

changelog

A formal specification for changelog files and entries
18
star
13

goji

Command line JIRA client
Python
18
star
14

swiftenv-docker

This repository contains swiftenv images for Docker
Makefile
18
star
15

irctk

A Python IRC client library
Python
6
star
16

maintain

A unified interface to maintaining projects of any language.
Python
6
star
17

ucp

A simple and universal command line tool for capturing screenshots and uploading to the web.
Shell
5
star
18

redirector

Simple web server for HTTP redirecting from one domain to another.
Python
4
star
19

pygments-apiblueprint

An API Blueprint Lexer for Pygments
Python
3
star
20

refract.py

A Python library for interacting with Refract
Python
3
star
21

life

This repository is used as a personal issue tracker
2
star
22

homebrew-formulae

Ruby
1
star