# openpoll-schemas

> A package containing all the JSON Schema definitions for OpenPoll

Latest version **1.0.2** (published 2018-03-11) · SEE LICENSE IN LICENSE.TXT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install openpoll-schemas
pnpm add openpoll-schemas
yarn add openpoll-schemas
bun add openpoll-schemas
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2018-03-11 |
| First published | 2018-03-05 |
| Weekly downloads | 0 |
| License | SEE LICENSE IN LICENSE.TXT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 15.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | OpenPoll Inc |
| Maintainers | cyberuben |
| Keywords | blockchain, openpoll |

## Links

- npm: https://www.npmjs.com/package/openpoll-schemas
- Repository: https://github.com/opoll/openpoll-schemas
- Homepage: https://github.com/opoll/openpoll-schemas#readme
- Issues: https://github.com/opoll/openpoll-schemas/issues
- npm.io page: https://npm.io/package/openpoll-schemas

## Dependencies (1)

- [jsonschema](https://npm.io/package/jsonschema.md) ^1.2.2

## Recent versions

- 1.0.2 (latest) — 2018-03-11
- 1.0.1 — 2018-03-05
- 1.0.0 — 2018-03-05

## README

# OpenPoll Schemas

This is a repo containing all the JSON Schema definitions for OpenPoll.

# Usage

`openpoll-schemas` exports two features, an `schemas` object containing a (structured) way of accessing the schemas
(`https://schemas.openpoll.io/0.1/mainchain/block.json` becomes `schemas["0.1"].mainchain.block`), and a `validator`
instance ([`jsonschema`](https://npmjs.com/package/jsonschema)). You can validate your data against the schemas by using
the following code:

```javascript
const schemas = require("openpoll-schemas").schemas;
const validator = require("openpoll-schemas").validator;

let data = {
    some: "data",
    is: false
};

console.log(validator.validate(data, schemas["0.1"].mainchain.block));
```

Keep in mind that the schemas are loaded asynchronously so it might take a bit of time to get them to load. You can
check if it's done by attaching a `.then()` method to the exported member `loaded` as shown below:

```javascript
const openpoll = require("openpoll-schemas");

openpoll.loaded.then(() => {
    console.log("Loaded all schemas");
    // Do synchronous logic here
});
```

# Additional information

All schemas in this package can also be found on https://schemas.openpoll.io. The ID of a schema should resolve to a
valid URL.

---
_Source: https://npm.io/package/openpoll-schemas · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
