@tradle/validate-model
v7.1.42
Published
validate models for your Tradle bot
Downloads
10
Keywords
Readme
@tradle/validate
validate your Tradle models
Usage
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)