Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

flow2schema

0.3.1 • Public • Published

flow2schema

Version npm Linux Build Windows Build Coverage Status

Example

$ cat example.js
type A<T, K> = {
    t: T,
    k: K,
};
 
export type X = {
    aA<string, boolean>,
    bnumber,
};
$ flow2schema -t json-schema example.js
{
    "$schema": "http://json-schema.org/draft-06/schema#",
    "definitions": {
        "example::A::string::boolean": {
            "type": "object",
            "properties": {
                "t": {"type": "string"},
                "k": {"type": "boolean"}
            },
            "required": ["t", "k"]
        },
        "example::X": {
            "type": "object",
            "properties": {
                "a": {"$ref": "#/definitions/example::A::string::boolean"},
                "b": {"type": "number"}
            },
            "required": ["a", "b"]
        }
    }
}

TODO

  • Complete generics support.
  • Errors and warnings.
  • Complete commonjs support.
  • Documentation.
  • Stabilize API.
  • Webpack plugin.
  • Rollup plugin.

install

npm i flow2schema

Downloadsweekly downloads

9

version

0.3.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability