Socket
Socket
Sign inDemoInstall

json-schema-prop-types

Package Overview
Dependencies
15
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    json-schema-prop-types

JSON Schema compatibility layer for React Prop-Types.


Version published
Maintainers
1
Created

Readme

Source

JSON Schema Prop Types

JSON Schema compatibility layer for React Prop-Types.

Install

npm install json-schema-prop-types

Getting started

// TODO: Code examples

Advanced Usage

TODO: Call off to Ajv docs for advanced Schemas.

Parity with React Prop Types

This package aims to be at least equal to the props-types package in it's capability. Below is a mapping of prop-types features to this packages solution.

Prop TypeNative SupportCustom SupportNotes
anyJSON Schema blank definition
stringJSON Schema type "string"
numberJSON Scehma types "number" or "integer"
func🚫Supported by Ajv custom keyword "instanceof"
boolJSON Schema type "boolean"
oneOfJSON Schema keyword "enum"
oneOfTypeJSON Schema keyword "oneOf"
arrayJSON Schema type "array"
arrayOfJSON Schema type "array" with keyword "items"
objectJSON Schema type "object"
objectOfJSON Schema keyword "patternProperties"
instanceOf🚫Supported by Ajv custom keyword "instanceof"
shapeJSON Schema type "object" with keyword "properties"
element🚫Custom definition "_ReactElement"
node🚫Custom definition "_Node"
(...).isRequiredJSON Schema keyword "required"

Usage in production

It is recommended that you disable prop-types in production as described here: https://github.com/oliviertassinari/babel-plugin-transform-react-remove-prop-types

Dependencies

The Ajv JSON Schema validator powers the validation checks. This is extended by ajv-keywords in order to support validation of functions and classes.

Peer Dependencies

This package expects to be used with React, React DOM and Prop Types. The following package versions have been tested:

  • react - 16.2.0
  • react-dom - 16.2.0
  • prop-types - 15.6.0

FAQs

Last updated on 19 May 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc