0.1.0 • Published 6 years ago

json-schema-to-proptypes v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

json-schema-to-proptypes

Transform JSON Schema schemas to PropTypes.

This package was imported from and is a subset of https://github.com/dowjones/react-json-schema-proptypes. Doesn't depend on React nor on PropTypes packages.

Supports JSON Schema draft-04 schemas conversion to a custom PropType function that will validate against that schema.

Usage

import jsonSchemaToPropTypes from './'

const mySchema = {
  type: 'object',
  required: ['a'],
  properties: {
    a: { type: 'string' },
    b: { type: 'string' }
  }
}

const myPropTypes = jsonSchemaToPropTypes(mySchema)