@appland/appmap-validate

2.4.0 • Public • Published

appmap-validate

Check whether an appmap adheres to the specification.

Install

npm i @appland/validate

CLI

npx appmap-validate path/to/file.appmap.json

API

const {validate} = require("appmap-validate");
// Returns undefined if the appmap is valid
// Throws an InputError if there was a problem with the input options
// Throws an InvalidAppmapError if the provided appmap is invalid
// Any other thrown error should be considered as a bug
validate(
  data,
  {
    version, // appmap specification version
    "schema-depth": 0 // depth of the schema to display
    "instance-depth": 0 // depth of the instance to display
  }
);

Design Decisions

  • Every object is extensible Appmap producers are free to include additional properties. This can be useful to experiment with novel extensions which are not yet part of the spec. Also it can be useful to include additional data for debugging purpose.
  • Every optional property is nullable When a property is is not required, appmap producers have two options. Either they do not include the property in the object. Or they set its value to null which is easier/faster to do when using literal object notation. For instance, in js:
    // Missing optional property:
    {
      required: 'foo',
      ...(test ? { optional: 'bar' } : {}),
    };
    // null optional property:
    {
      required: 'foo',
      optional: test ? 'bar' : null,
    };

Readme

Keywords

none

Package Sidebar

Install

npm i @appland/appmap-validate

Weekly Downloads

2,030

Version

2.4.0

License

MIT

Unpacked Size

167 kB

Total Files

16

Last publish

Collaborators

  • kgilpin
  • dustinbyrne
  • appland-release
  • lachrist