Validate ProtoDef protocol definition in node. Fork of: https://github.com/ProtoDef-io/node-protodef-validator.
  • JavaScript 100%
Find a file
MnPX 479c647aa9 Update README and modules to point at mnpx.dev repo
- removed a bunch of references to GitHub and external NPMs
2026-09-23 15:23:43 +10:00
.github/workflows Use Node 24 in npm-publish workflow so OIDC trusted publishing works (#20) 2026-08-27 02:09:36 -04:00
ProtoDef@6a88164e6f Update README and modules to point at mnpx.dev repo 2026-09-23 15:23:43 +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-09-23 15:23:43 +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 Speed up dataType validation ~12x by collapsing default type branches (#18) 2026-08-16 13:58:12 -07:00
package.json Update README and modules to point at mnpx.dev repo 2026-09-23 15:23:43 +10:00
README.md Update README and modules to point at mnpx.dev repo 2026-09-23 15:23:43 +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.5.0

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