@acot/schema-validator

A simple wrapper module for schema-utils.

Usage no npm install needed!

<script type="module">
  import acotSchemaValidator from 'https://cdn.skypack.dev/@acot/schema-validator';
</script>

README

@acot/schema-validator

A simple wrapper module for schema-utils.

Installation

Install via npm:

$ npm install --save @acot/schema-validator

Usage

T.B.A

import { validate } from '@acot/schema-validator';

type User = {
  id: string;
  name: string;
  age: string;
};

const user = {
  id: 'akfgayq12ugb',
  name: 'Iron Man',
  age: 55,
};

validate<User>(
  {
    properties: {
      id: {
        type: 'string',
      },
      name: {
        type: 'string',
      },
      age: {
        type: 'integer',
      },
    },
    additionalProperties: false,
  },
  user,
  {
    name: 'User',
    base: 'options',
  },
);