flo
flowtypify
npm i flowtypify
flo

flowtypify

Generate flowtype definitions from JSON Schemata

by Raimo Radczewski

1.0.1 (see all)License:Apache-2.0TypeScript:Not Found
npm i flowtypify
Readme

npm version

CI Deps DevDeps

Flowtypify - Generate Flowtype Definitions from JSON Schemas

flowtypify generates flowtype definitions from a given JSON Schema. This enables you to type-check the contract your app is working against. Whenever you update the schema, regenerate the flowtype definitions and flow will tell you about breaking changes.

Version-wise its an early Proof of Concept, but the testsuite already covers most of the features I've seen in the wild so far.

Usage

Invoking fowtypify will parse the JSON schemas and output the types to STDOUT. With --write enabled, a file with the same basename plus .flow.js will be created for each supplied schema.

npm install --save-dev flowtypify
./node_modules/.bin/flowtypify --write src/schematas/*.json

Example Screenshot

FAQ

Flowtypify generates lots of unsealed types (& Object)

Yepp, that's, apart from the lack of any optimizations in flowtypify, due to your schema not having additionalProperties: false set on object definitions you have.

What works?

Everything in test/scenarios works, the following does not work, yet ;)

  • Resolve external $ref links
  • Resolve definitions through $id fields (no support for $id as of JSON Schema Core 9.2 at all, yet)
  • Transformations
    • Change RootType name
    • Transform Type names (e.g. uppercase)
    • Custom transformations (e.g. Optional<*> types)

Downloads/wk

7

GitHub Stars

38

LAST COMMIT

4yrs ago

MAINTAINERS

1

CONTRIBUTORS

1

OPEN ISSUES

2

OPEN PRs

0
VersionTagPublished
1.0.1
latest
4yrs ago
No alternatives found
No tutorials found
Add a tutorial