Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tradle/validate-model
validate models before using them in your Tradle bots
https://github.com/tradle/validate-model
data-modeling modeling tradle validation
Last synced: about 2 months ago
JSON representation
validate models before using them in your Tradle bots
- Host: GitHub
- URL: https://github.com/tradle/validate-model
- Owner: tradle
- Created: 2017-02-07T19:24:30.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-07-09T20:00:37.000Z (over 2 years ago)
- Last Synced: 2024-10-31T17:54:41.977Z (2 months ago)
- Topics: data-modeling, modeling, tradle, validation
- Language: JavaScript
- Homepage:
- Size: 359 KB
- Stars: 1
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @tradle/validate
validate your Tradle models
## Usage
```js
const baseModels = require('@tradle/models').models
const validate = require('@tradle/validate-model')
const nameModel = {
type: 'tradle.Model',
id: 'com.example.Name',
title: 'Name',
properties: {
fullName: {
type: 'string'
},
nickName: {
type: 'string'
}
},
required: ['nickName']
}// validate a property
validate.property({ model: nameModel, propertyName: 'nickName' })// validate a model
validate.model(nameModel)// validate all models and their cross-references
const mergedModels = Object.assign({}, baseModels, { [nameModel.id]: nameModel })
validate(mergedModels)
```