Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/metarhia/metaschema
Schema definition and validation 💡
https://github.com/metarhia/metaschema
check database dsl globalstorage hacktoberfest impress javascript js json meta-edu metadata metaprogramming metarhia node nodejs schema type types validate
Last synced: about 19 hours ago
JSON representation
Schema definition and validation 💡
- Host: GitHub
- URL: https://github.com/metarhia/metaschema
- Owner: metarhia
- License: mit
- Created: 2017-06-22T11:32:52.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-09-22T09:00:20.000Z (4 months ago)
- Last Synced: 2025-01-18T20:51:12.463Z (8 days ago)
- Topics: check, database, dsl, globalstorage, hacktoberfest, impress, javascript, js, json, meta-edu, metadata, metaprogramming, metarhia, node, nodejs, schema, type, types, validate
- Language: JavaScript
- Homepage: https://metarhia.com
- Size: 984 KB
- Stars: 52
- Watchers: 20
- Forks: 18
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Security: SECURITY.md
- Authors: AUTHORS
Awesome Lists containing this project
README
# Metaschema
Metadata schema and interface (contract) definition language
[![ci](https://github.com/metarhia/metaschema/workflows/Testing%20CI/badge.svg)](https://github.com/metarhia/metaschema/actions?query=workflow%3A%22Testing+CI%22+branch%3Amaster)
[![snyk](https://snyk.io/test/github/metarhia/metaschema/badge.svg)](https://snyk.io/test/github/metarhia/metaschema)
[![npm version](https://badge.fury.io/js/metaschema.svg)](https://badge.fury.io/js/metaschema)
[![npm downloads/month](https://img.shields.io/npm/dm/metaschema.svg)](https://www.npmjs.com/package/metaschema)
[![npm downloads](https://img.shields.io/npm/dt/metaschema.svg)](https://www.npmjs.com/package/metaschema)
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/metarhia/metaschema/blob/master/LICENSE)## Installation
```bash
$ npm install metaschema
```## Examples
```js
const { Schema } = require('metaschema');const schema = Schema.from({
name: {
first: 'string',
last: 'string',
third: '?string',
},
age: 'number',
levelOne: {
levelTwo: {
levelThree: { type: 'enum', enum: [1, 2, 3] },
},
},
collection: { array: { array: 'number' } },
});const data = {
name: {
first: 'a',
last: 'b',
},
age: 5,
levelOne: { levelTwo: { levelThree: 1 } },
collection: [
[1, 2, 3],
[3, 5, 6],
],
};console.log(schema.check(data));
// Output:
// ValidationResult { errors: [], valid: true }
```## License & Contributors
Copyright (c) 2017-2024 [Metarhia contributors](https://github.com/metarhia/metaschema/graphs/contributors).
Metaschema is [MIT licensed](./LICENSE).\
Metaschema is a part of [Metarhia](https://github.com/metarhia) technology stack.