Git Product home page Git Product logo

onsdigital.eq-questionnaire-validator's Introduction

eq-questionnaire-validator

An API for validating survey schemas.

Setup

It is recommended that you use Pyenv to manage your Python installations.

pip install --upgrade pip setuptools pipenv
pipenv install --dev

Running

To run the app:

make run

Testing

By default, all schemas in the tests/schemas/valid directory will be evaluated as part of the unit tests. Any errors in these schemas will cause a failure.

To run the app's unit tests:

make test

To test the apps functionality:

make run

Then, in another terminal window/tab, navigate to a checked out copy of eq-survey-runner:

make test

Installing node dependencies

In the eq-schema-validator directory, install node version manager (nvm) and node using the following commands:

brew install nvm
nvm install

Install yarn and node dependencies:

npm i -g yarn
yarn

Formatting json

Run the following to format all json files in the schemas directory:

make format

Validating with ajv

Also included is a node based version of the json schema validation which may be used during development to assist with debugging errors. This returns more errors than we'd currently like due to the way polymorphism works for each of our blocks.

Run the ajv based version of validator from within the ajv/ directory.

DEBUG=validator node app.js

This returns either an empty json response when the questionnaire is valid, or a response containing an "errors" key. The errors are ordered by their path length and with first error message being the deepest path into the schema and should represent the best match for the questionnaire which has been posted.

onsdigital.eq-questionnaire-validator's People

Contributors

jonnyshaw89 avatar dwyeradam avatar mebinabraham avatar ajmaddaford avatar bitdivision avatar iwootten avatar jamesgardiner avatar shahi645 avatar ljbabbage avatar berroar avatar petechd avatar nealedj avatar mislam92 avatar insacuri avatar benhowes avatar kierenbeckett avatar yoganandkunche avatar adammahmood avatar samiwel avatar davecharles avatar bambrp avatar warrenbailey avatar rmccar avatar

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.