json-schema-to-flow-type

1.0.0 • Public • Published

Convert JSON Schema to Flow Type Definitions

Build Status NPM Dependencies License

APIs

type Imports = {
  [key: string]: Schema
}

simplifySchema(schema, Schema, imports: ?Imports): Schema

  • schema should have id for type alias identifier
  • outside $ref will be resolve the real schema instead of $ref;
  • imports with { #: schema } will have same rule as above;

convertSchema(schema: Schema): FlowSchema

convert schema to a flow schema

toFlow(flowSchema): AstObject

will export ast object export ${upperCamelCase(flowSchema.id)} == ${toFlowType(flowType)}

schemaToFlow(flowSchema): string

convert definitions and schema root by toFlow

parseSchema(schema: Schema, imports: ?Imports): string

pipe simplifySchema | convertSchema | schemaToFlow

Changelog

0.4.0

  • Support for string literal object type keys

0.3.0

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    1,382
    • latest
  • 0.3.0
    2
    • prerelease

Version History

Package Sidebar

Install

npm i json-schema-to-flow-type

Weekly Downloads

186

Version

1.0.0

License

WTFPL

Unpacked Size

26.2 kB

Total Files

7

Last publish

Collaborators

  • dannynelson
  • goodeggs
  • morlay_null
  • passfort-dev