Validate ProtoDef protocol definition in node. Fork of: https://github.com/ProtoDef-io/node-protodef-validator.
Find a file
MnPX 028a8f61a8
Some checks failed
CI / build (14.x) (push) Has been cancelled
npm-publish / npm-publish (push) Has been cancelled
Update README and modules to point at mnpx.dev repo
- removed a bunch of references to GitHub and external NPMs
2026-05-05 21:02:10 +10:00
.github/workflows Fix publish condition for npm-publish v4 (#17) 2026-03-28 10:20:58 -07:00
ProtoDef@6a88164e6f Update README and modules to point at mnpx.dev repo 2026-05-05 21:02:10 +10:00
.gitignore update ajv and protodef 2018-09-24 23:11:51 +02:00
.gitmodules Update README and modules to point at mnpx.dev repo 2026-05-05 21:02:10 +10:00
.gitpod.yml add gitpod yml file + add link to build 2019-08-24 16:47:34 +00:00
cli.js everything works 2017-02-01 01:12:51 +01:00
example.js everything works 2017-02-01 01:12:51 +01:00
example_protocol.json update submodule (#13) 2024-12-08 23:41:40 +01:00
index.js Add primitives.json import (#5) 2021-06-10 21:30:26 +02:00
package.json Update README and modules to point at mnpx.dev repo 2026-05-05 21:02:10 +10:00
README.md Update README and modules to point at mnpx.dev repo 2026-05-05 21:02:10 +10:00

ProtoDef-validator

Validate ProtoDef protocol definition in node

Usage

See example

API

Validator

Class to make validator instances

Validator.addType(name [,schema])

add the type name with schema schema

If schema isn't specified, use a default schema.

Validator.addTypes(schemas)

Add schemas which is an object with keys the name of the schemas and values the schema definitions.

Validator.validateType(type)

validates a type definition type

throws an exception if the type isn't correct

Validator.validateProtocol(protocol)

validates a protocol definition protocol

throws an exception if the protocol isn't correct

History

1.4.0

1.3.0

  • update protodef

1.2.3

  • add .json suffix when requiring (for webpack)

1.2.2

  • fix release

1.2.1

  • update ajv and protodef

1.2.0

  • allow : in switch keys

1.1.7

  • properly define compareTo/compareToValue

1.1.6

  • fix compareToValue switch property allowance

1.1.5

  • properly normalize schema names

1.1.4

  • normalize refs

1.1.3

  • print errors again

1.1.2

  • fix release

1.1.1

  • recreate ajv instance to recompile if types were validated hence compiled

1.1.0

  • check the datatypes have been defined
  • make it possible to add types with a default schema
  • better errors

1.0.2

  • ignore already added types

1.0.1

  • fix index.js

1.0.0

  • can validate types and protocols