json-schema-to-flow-type
v1.0.0
Published
[![Build Status](https://img.shields.io/travis/morlay/json-schema-to-flow-type.svg?style=flat-square)](https://travis-ci.org/morlay/json-schema-to-flow-type) [![NPM](https://img.shields.io/npm/v/json-schema-to-flow-type.svg?style=flat-square)](https://npm
Downloads
1,497
Keywords
Readme
Convert JSON Schema to Flow Type Definitions
APIs
type Imports = {
[key: string]: Schema
}
simplifySchema(schema, Schema, imports: ?Imports): Schema
schema
should haveid
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
- Support for exact object types when
additionalProperties: false
is present.