Giter VIP home page Giter VIP logo

pykwalify's Introduction

pyKwalify

YAML/JSON validation library

This framework is a port with a lot of added functionality of the Java version of the framework kwalify that can be found at http://www.kuwata-lab.com/kwalify/

The original source code can be found at http://sourceforge.net/projects/kwalify/files/kwalify-java/0.5.1/

The source code of the latest release that has been used can be found at https://github.com/sunaku/kwalify. Please note that source code is not the original authors code but a fork/upload of the last release available in Ruby.

The schema this library is based on and extended from: http://www.kuwata-lab.com/kwalify/ruby/users-guide.01.html#schema

Usage

Create a data file. Json and Yaml formats are both supported.

- foo
- bar

Create a schema file with validation rules.

type: seq
sequence:
  - type: str

Run validation from cli.

pykwalify -d data.yaml -s schema.yaml

Examples

The documentation describes in detail how each keyword and type works and what is possible in each case.

But there is a lot of real world examples that can be found in the test data/files. It shows a lot of examples of how all keywords and types work in practice and in combination with each other.

The files can be found here and show both schema/data combinations that will work and that will fail.

  • tests/files/success/
  • tests/files/fail/
  • tests/files/partial_schemas/

YAML parser

ruamel.yaml is the default YAMl parser installed with pykwalify.

Ruamel.yaml is more supported in the yaml 1.2 spec and is more actively developed.

Depending on how both libraries are developed, this can change in the future in any major update.

UTF-8 and data encoding

If you have problems with unicode values not working properly when running pykwalify on Python 2.7.x then try to add this environment variable to your execution:

PYTHONIOENCODING=UTF-8 pykwalify ...

and it might help to force UTF-8 encoding on all string objects. If this does not work please open up an issue with your schema and data that can be used to track down the problem in the source code.

Project details

python support 2.7, 3.5, 3.6, 3.7
Source https://github.com/Grokzen/pykwalify
Docs (Latest release) http://pykwalify.readthedocs.io/en/master/
Docs (Unstable branch) http://pykwalify.readthedocs.io/en/unstable/
Gitter (Free Chat) Gitter
Changelog https://github.com/Grokzen/pykwalify/blob/unstable/docs/release-notes.rst
Upgrade instructions https://github.com/Grokzen/pykwalify/blob/unstable/docs/upgrade-instructions.rst
Issues https://github.com/Grokzen/pykwalify/issues
Travis (master) Build Status https://travis-ci.org/Grokzen/pykwalify
Travis (unstable) Build Status https://travis-ci.org/Grokzen/pykwalify
Test coverage Coverage Status https://coveralls.io/github/Grokzen/pykwalify
pypi https://pypi.python.org/pypi/pykwalify/
Open Hub https://www.openhub.net/p/pykwalify
License MIT https://github.com/Grokzen/pykwalify/blob/unstable/docs/license.rst
Copyright Copyright (c) 2013-2017 Johan Andersson
git repo git clone [email protected]:Grokzen/pykwalify.git
install stable pip install pykwalify
install dev $ git clone [email protected]:Grokzen/pykwalify.git pykwalify
$ cd ./pykwalify
$ virtualenv .venv
$ source .venv/bin/activate
$ pip install -r dev-requirements.txt
$ pip install -e .
required dependencies docopt >= 0.6.2
python-dateutil >= 2.4.2
supported yml parsers ruamel.yaml >= 0.11.0

pykwalify's People

Contributors

grokzen avatar scottclowe avatar hannanabdul55 avatar bneron avatar elitemastereric avatar jmacarthur avatar mrab avatar alexandredecan avatar cswindle avatar cxong avatar dhimmel avatar elray1 avatar cogwirrel avatar mrqubo avatar jwilk avatar jakirkham avatar jlec avatar lokespotify avatar marcsieger avatar mbolivar avatar mwiens91 avatar nowox avatar gonditeniz avatar

Stargazers

Priyanka O avatar

Watchers

 avatar

Forkers

priya-gittest

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.