@mojaloop/ml-schema-validator

Mojaloop library that contains Joi schema validations that align with the Mojaloop API

Usage no npm install needed!

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

README

ml-schema-validator

Git Commit Git Releases Npm Version NPM Vulnerabilities CircleCI

Shared Joi validation code for Mojaloop services

Contents:

Usage

The library supports both Joi validation >= version 17. To use the library you can import it into your project

Tests

Currently test coverage will automatically pass at 100% because these are just objects, I would always suggest creating a JSON and create a test against the schema if you are contributing. Both positive and negative scenarios

Running the tests:

npm run test
npm run test:unit
npm run test:coverage
npm run test:coverage-check

Tests include code coverage. See the test/unit/ folder for testing scripts.

Auditing Dependencies

We use npm-audit-resolver along with npm audit to check dependencies for vulnerabilities, and keep track of resolved dependencies with an audit-resolve.json file.

To start a new resolution process, run:

npm run audit:resolve

You can then check to see if the CI will pass based on the current dependencies with:

npm run audit:check

And commit the changed audit-resolve.json to ensure that CircleCI will build correctly.