All Projects → diegohaz → Schm

diegohaz / Schm

Licence: mit
Composable schemas for JavaScript and Node.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Schm

fefe
Validate, sanitize and transform values with proper TypeScript types and zero dependencies.
Stars: ✭ 34 (-93.17%)
Mutual labels:  schema, parse, validate
ty
Here is a schema checker which can return well typed results. Tell your friends!
Stars: ✭ 21 (-95.78%)
Mutual labels:  schema, json-schema
sf-java-ui
Json Schema Form java based library allow developers to define schema and form using field annotations
Stars: ✭ 23 (-95.38%)
Mutual labels:  schema, json-schema
tyshemo
A javascript runtime data type checking system and morden reactive state management model.
Stars: ✭ 70 (-85.94%)
Mutual labels:  schema, validate
php-simple-request
php-simple-request is a request parser library designed to simplify requests validation and filtering using annotations, generating at the same time an object representation from the request data.
Stars: ✭ 15 (-96.99%)
Mutual labels:  parse, json-schema
jgeXml
The Just-Good-Enough XML Toolkit
Stars: ✭ 20 (-95.98%)
Mutual labels:  parse, json-schema
schema-shot
Framework-agnostic snapshot testing using "schema by example" for highly dynamic data
Stars: ✭ 34 (-93.17%)
Mutual labels:  schema, json-schema
reach-schema
Functional schema-driven JavaScript object validation library.
Stars: ✭ 34 (-93.17%)
Mutual labels:  schema, validate
fform
Flexibile and extendable form builder with constructor
Stars: ✭ 26 (-94.78%)
Mutual labels:  schema, json-schema
Json Schema To Ts
Infer TS types from JSON schemas 📝
Stars: ✭ 261 (-47.59%)
Mutual labels:  json-schema, schema
Babel Plugin Import Graphql
Enables import syntax for .graphql and .gql files
Stars: ✭ 284 (-42.97%)
Mutual labels:  schema, parse
typescript-to-json-schema
Generate JSON schema from your Typescript sources
Stars: ✭ 54 (-89.16%)
Mutual labels:  schema, json-schema
openapi4j
OpenAPI 3 parser, JSON schema and request validator.
Stars: ✭ 92 (-81.53%)
Mutual labels:  schema, json-schema
element-schema-form
A schema-based element-ui form component for Vue2.x.
Stars: ✭ 31 (-93.78%)
Mutual labels:  schema, json-schema
joyce
Joyce is a highly scalable event-driven Cloud Native Data Hub.
Stars: ✭ 37 (-92.57%)
Mutual labels:  schema, json-schema
metaschema
Schema definition and validation 💡
Stars: ✭ 25 (-94.98%)
Mutual labels:  schema, validate
another-json-schema
Another JSON Schema validator, simple & flexible & intuitive.
Stars: ✭ 48 (-90.36%)
Mutual labels:  schema, json-schema
magnet
A JSON/BSON schema generator
Stars: ✭ 16 (-96.79%)
Mutual labels:  schema, json-schema
Vue Json Ui Editor
Edit JSON in UI form with JSON Schema and Vue.js
Stars: ✭ 392 (-21.29%)
Mutual labels:  json-schema, schema
Jsonschema
An implementation of the JSON Schema specification for Python
Stars: ✭ 3,474 (+597.59%)
Mutual labels:  schema, json-schema

Build Status Coverage Status



If you find this useful, please don't forget to star ⭐️ the repo, as this will help to promote the project.
Follow me on Twitter and GitHub to keep updated about this project and others.




schm is a library for creating immutable, composable, parseable and validatable (yeah, many *ables) schemas in JavaScript and Node.js. That's highly inspired by functional programming paradigm.

Play with schm on RunKit (click on Clone and edit this document at the bottom and skip login if you want).

const schema = require('schm')

const userSchema = schema({
  name: String,
  age: {
    type: Number,
    min: 18,
  },
})

userSchema.parse({
  name: 'Haz',
  age: '27',
})

await userSchema.validate({
  name: 'Jeane',
  age: 10,
})

Output:

// parsed
{
  name: 'Haz',
  age: 27,
}

// validate error
[
  {
    param: 'age',
    value: 10,
    validator: 'min',
    min: 18,
    message: 'age must be greater than or equal 18',
  },
]

The way you declare the schema object is very similar to mongoose Schemas. So, refer to their docs to learn more.

Packages

schm repository is a monorepo managed by lerna. Click on package name to see specific documentation.

Package Version Description
schm NPM version The main package
schm-computed NPM version Adds computed parameters to schemas
schm-express NPM version Express middlewares to handle querystring and response body
schm-koa NPM version Koa middlewares to handle querystring and response body
schm-methods NPM version Adds methods to parsed schema objects
schm-mongo NPM version Parses values to MongoDB queries
schm-translate NPM version Translates values keys to schema keys

Contributing

When submitting an issue, put the related package between brackets in the title:

[methods] Something wrong is not right # related to schm-methods
[translate] Something right is not wrong # related to schm-translate
Something wrong is wrong # general issue

PRs are welcome. You should have a look at lerna to understand how this repository works.

After cloning the repository, run yarn. That will install all the project dependencies, including the packages ones.

Before submitting a PR:

  1. Make sure to lint the code: yarn lint or lerna run lint;
  2. Make sure tests are passing: yarn test or lerna run test;

License

MIT © Diego Haz

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].