All Projects â†’ kaelzhang â†’ Skema

kaelzhang / Skema

Licence: mit
🛰 Skema provides a handy & composable way to validate / transform / purify the input data.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Skema

Awesome Python Models
A curated list of awesome Python libraries, which implement models, schemas, serializers/deserializers, ODM's/ORM's, Active Records or similar patterns.
Stars: ✭ 124 (-65.46%)
Mutual labels:  schema, validation, model
Meteor Astronomy
Model layer for Meteor
Stars: ✭ 608 (+69.36%)
Mutual labels:  schema, validation, model
Framework
Strongly-typed JavaScript object with support for validation and error handling.
Stars: ✭ 136 (-62.12%)
Mutual labels:  schema, validation, model
Vue Rawmodel
RawModel.js plugin for Vue.js v2. Form validation has never been easier!
Stars: ✭ 79 (-77.99%)
Mutual labels:  schema, validation, model
Structure
A simple schema/attributes library built on top of modern JavaScript
Stars: ✭ 292 (-18.66%)
Mutual labels:  schema, validation, model
Password Validator
Validates password according to flexible and intuitive specification
Stars: ✭ 224 (-37.6%)
Mutual labels:  schema, validation
Truss
Assertions API for Clojure/Script
Stars: ✭ 239 (-33.43%)
Mutual labels:  schema, validation
binstruct
Golang binary decoder for mapping data into the structure
Stars: ✭ 67 (-81.34%)
Mutual labels:  structure, struct
valify
Validates data in JavaScript in a very simple way
Stars: ✭ 13 (-96.38%)
Mutual labels:  validation, struct
Joiful
TypeScript Declarative Validation for Joi
Stars: ✭ 177 (-50.7%)
Mutual labels:  schema, validation
godmt
Tool that can parse Go files into an abstract syntax tree and translate it to several programming languages.
Stars: ✭ 42 (-88.3%)
Mutual labels:  schema, model
pyvaru
Rule based data validation library for python 3.
Stars: ✭ 17 (-95.26%)
Mutual labels:  validation, model
Schematics
Project documentation: https://schematics.readthedocs.io/en/latest/
Stars: ✭ 2,461 (+585.52%)
Mutual labels:  schema, validation
Computed Types
🦩 Joi like validations for TypeScript
Stars: ✭ 197 (-45.13%)
Mutual labels:  schema, validation
Coolie
Coolie(苦力) helps you to create models (& their constructors) from a JSON file.
Stars: ✭ 508 (+41.5%)
Mutual labels:  struct, model
Trilogy
TypeScript SQLite layer with support for both native C++ & pure JavaScript drivers.
Stars: ✭ 195 (-45.68%)
Mutual labels:  schema, model
modelsafe
A type-safe data modelling library for TypeScript
Stars: ✭ 13 (-96.38%)
Mutual labels:  schema, model
fefe
Validate, sanitize and transform values with proper TypeScript types and zero dependencies.
Stars: ✭ 34 (-90.53%)
Mutual labels:  schema, validation
openapi-schema-validator
OpenAPI schema validator for Python
Stars: ✭ 35 (-90.25%)
Mutual labels:  schema, validation
Typed Immutable
Immutable and structurally typed data
Stars: ✭ 263 (-26.74%)
Mutual labels:  schema, structure

Build Status Coverage

skema

skema provides a handy and composable way to validate/transform JavaScript variables:

  • Supports both async and sync flows. Skema has two working modes to support either async or sync validators, setters, etc, making it capable with much more complicated challenges.

  • NOT only type checker. Unlike TypeScript, joi, and many others, Skema is not only a JavaScript type checker, but also a good solution for your Anti-Corruption Layer (ACL) to transform and purify the input data. And Skema could also be configured as a simple schema validator too.

  • Pluggable basic types. Even basic types such as Number could also be replaced and customized if using Skema. Actually, in the core of Skema, there is NOT a single definition of one type.

  • Powerful custom types. Every single type is able to be customized that you can handle almost everything including descriptor, conditions, default values, validators and so on.

  • Composable structures. You could build a much bigger schema with the small ones into the whole world.

Install

npm i skema

Basic Usage

🔬 Live Demo with JsFiddle

import {shape} from 'skema'

// Schema definitions are ONLY objects.
const User = shape({
  id: 'number?',
  name: String
})

// Then use these definitions to purify our data.
const user = User.from({
  id: '1',
  name: 'Steve'
})

console.log(user)
// {
//   id: 1,
//   name: 'Steve'
// }

user.id = 'boooom!'
// throw TypeError
// - message: 'not a number'
// - code: 'VALIDATION_FAILS'

Documentations

Many Examples

Related Packages

  • @skema/basic The default built-in javascript types of skema.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].