• Stars
    star
    239
  • Rank 163,172 (Top 4 %)
  • Language
    Python
  • License
    Other
  • Created almost 14 years ago
  • Updated 3 months ago

Reviews

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

Repository Details

πŸŽ“ deprecated general purpose python data validator

validictory

warning:⚠️ As of 2018 this library is deprecated, please consider using jsonschema (https://pypi.python.org/pypi/jsonschema) instead.
https://travis-ci.org/jamesturk/validictory.svg?branch=master https://coveralls.io/repos/jamesturk/validictory/badge.png?branch=master Documentation Status

A general purpose Python data validator.

Works with Python 2.7 and Python 3.3+

Schema format based on JSON Schema Proposal (http://json-schema.org)

Contains code derived from jsonschema, by Ian Lewis and Yusuke Muraoka.

Usage

JSON documents and schema must first be loaded into a Python dictionary type before it can be validated.

Parsing a simple JSON document:

>>> import validictory
>>>
>>> validictory.validate("something", {"type":"string"})

Parsing a more complex JSON document:

>>> import json
>>> import validictory
>>>
>>> data = json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]')
>>> schema = {
...   "type":"array",
...   "items":[
...     {"type":"string"},
...     {"type":"object",
...      "properties":{
...        "bar":{
...          "items":[
...            {"type":"string"},
...            {"type":"any"},
...            {"type":"number"},
...            {"type":"integer"}
...          ]
...        }
...      }
...    }
...   ]
... }
>>> validictory.validate(data,schema)

Catch ValueErrors to handle validation issues:

>>> import validictory
>>>
>>> try:
...     validictory.validate("something", {"type":"string","minLength":15})
... except ValueError, error:
...     print(error)
...
Length of value 'something' for field '_data' must be greater than or equal to 15

You can read more in the official documentation at Read the Docs.

More Repositories

1

tf-idf-similarity

Ruby gem to calculate the similarity between texts using tf*idf
Ruby
728
star
2

color-generator

Ruby gem to randomly generate distinct colors with consistent lightness and saturation
Ruby
80
star
3

pupa-ruby

A data scraping framework based on Open Civic Data's Pupa
Ruby
67
star
4

image-proxy

An image proxy using the Express Node.js framework
JavaScript
59
star
5

multi_mail

Ruby gem to easily switch between email APIs
Ruby
35
star
6

fastcsv

A fast Ragel-based CSV parser, compatible with Ruby's CSV
Ruby
29
star
7

open_data_canada

The aspirational canonical database of Canadian open government data catalogs
Ruby
9
star
8

open_source_canada

Auditing tools for Canadian governments' open source code (data files not maintained)
Ruby
8
star
9

copy_paste_pdf

Converts PDF to CSV by copy-pasting from Apple's Preview to Microsoft Excel
Ruby
7
star
10

info-go

Documentation and scraper for the Government of Ontario Employee and Organization Directory (INFO-GO) API
Ruby
5
star
11

gitpop

Find the best fork on GitHub
JavaScript
5
star
12

wikipedia-names-your-band

Wikipedia Names Your Band
Python
4
star
13

rackbin

The simplest possible Rack postbin
Ruby
3
star
14

information_request_summaries_and_responses

Collects information request summaries and responses
Ruby
3
star
15

inventory

Open data standards inventory
Python
2
star
16

redirector

A simple Sinatra redirection app
Ruby
1
star
17

indoor_voice

Lowercase all-caps strings excluding acronyms
Ruby
1
star
18

best_new_music

Save Pitchfork's Best New Music to your Spotify account
Ruby
1
star
19

opengovdialogue.ca-jekyll

HTML
1
star
20

popit-ruby

Ruby gem that wraps the PopIt API
Ruby
1
star
21

token_action

Rails engine to redeem tokens and perform actions
Ruby
1
star
22

WhatsMyWard-Themes

Themes for Apps 4 Good's "What's My Ward?"
Ruby
1
star
23

netstring

A netstring parser and emitter
Ruby
1
star
24

rabx-message

A RPC using Anything But XML (RABX) message parser and emitter
Ruby
1
star
25

multi_mail-servers

Test servers for MultiMail
Ruby
1
star
26

lycopodium

Test what transformations you can make to a set of values without creating collisions
Ruby
1
star
27

clip-analysis

Analysis of Canadian open data licenses in the CIPPIC Open Licensing Project
Ruby
1
star
28

pdftk

Fork of pdftk for OS X Lion
Java
1
star