{"id":21258917,"url":"https://github.com/microfleet/validation","last_synced_at":"2026-01-28T18:02:20.982Z","repository":{"id":1993583,"uuid":"45490562","full_name":"microfleet/validation","owner":"microfleet","description":"Integrates ajv module for various validation tasks","archived":false,"fork":false,"pushed_at":"2024-12-02T02:50:18.000Z","size":1032,"stargazers_count":0,"open_issues_count":8,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-29T12:06:26.379Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microfleet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-03T19:32:59.000Z","updated_at":"2022-01-14T09:06:46.000Z","dependencies_parsed_at":"2024-04-29T03:40:38.280Z","dependency_job_id":"b92e9c84-8d30-4f20-8230-cec1120b42fa","html_url":"https://github.com/microfleet/validation","commit_stats":{"total_commits":65,"total_committers":9,"mean_commits":7.222222222222222,"dds":0.5692307692307692,"last_synced_commit":"73b74cea6fe855a75bdd3383fdfc18d1a75a09b5"},"previous_names":["makeomatic/ms-validation","makeomatic/ms-amqp-validation"],"tags_count":43,"template":false,"template_full_name":null,"purl":"pkg:github/microfleet/validation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microfleet%2Fvalidation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microfleet%2Fvalidation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microfleet%2Fvalidation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microfleet%2Fvalidation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microfleet","download_url":"https://codeload.github.com/microfleet/validation/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microfleet%2Fvalidation/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264712917,"owners_count":23652687,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-21T04:11:26.197Z","updated_at":"2026-01-28T18:02:15.943Z","avatar_url":"https://github.com/microfleet.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Microfleet Validation Module\n\n[![Build Status](https://semaphoreci.com/api/v1/microfleet/validation/branches/master/badge.svg)](https://semaphoreci.com/microfleet/validation)\n\nThis is basically a wrapper of [ajv](https://github.com/epoberezkin/ajv) module.\nWhat it does - is accepts a directory with schemas, reads it in an async or sync fashion based on your preference\nand caches validators under it's name, minus it's extension (to be completely honest - it strips down `.json` only).\nBased on the bluebird promises.\n\n## Installation\n\n`npm i @microfleet/validation`\n\n## Usage\n\n```ts\n// Lets assume that we have a following file structure:\n//\n// .\n// ./schemas/config.json\n// ./schemas/ping.json\n// ./index.js\n//\n\nimport Errors = require('common-errors');\nimport Validator, { HttpStatusError } from '@microfleet/validation';\nconst validator = new Validator('./schemas');\n\nawait validator.init()\n\n// some logic here\nvalidator.validate('config', {\n  configuration: 'string'\n})\n.then(doc =\u003e {\n  // all good\n  // handle doc, which would eq { configuration: 'string' }\n})\n.catch(HttpStatusError, (error) =\u003e {\n  // handle error here\n});\n\nconst result = validator.validateSync('config', { data: true });\nif (result.error) {\n  // handle error!\n}\n\n// do stuff\n// ...\n\n// init filter\nvalidator.init('./dir', null, true); // all schemas in this dir will filter out additional properties instead of throwing an error\n\n// catches when we only have 417 errors\nvalidator.filter('config', { conf: 'string', extra: true })\n  .then(result =\u003e {\n    //  { conf: 'string' }\n  });\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrofleet%2Fvalidation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrofleet%2Fvalidation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrofleet%2Fvalidation/lists"}