Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/component/model-schema

A plugin that creates a model's attributes from a schema.
https://github.com/component/model-schema

Last synced: 13 days ago
JSON representation

A plugin that creates a model's attributes from a schema.

Awesome Lists containing this project

README

        

# model-schema

A plugin that creates a model's attributes from a schema.

## Installation

$ component install segmentio/model-schema
$ npm install model-schema

## Example

```js
var model = require('model');
var schema = require('model-schema');

var json = {
id: {
type: 'string',
required: true,
validators: [Function, Function]
},
name: {
type: 'string',
validators: [Function]
}
};

var User = model()
.use(schema(json));
```

## API

#### schema(json)

Return the plugin function for a given `json` schema.