Generate json-schemas for flowtype definitions
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Make CLI Dec 17, 2017
declarations Make CLI Dec 17, 2017
src Support string keys Nov 6, 2018
tests Add selectiveImport sample Nov 21, 2018
.babelrc Use flow to check code Nov 18, 2017
.flowconfig Specify @flow everywhere Jul 25, 2018
.gitignore Compile sources with babel Nov 16, 2017
.travis.yml Add coverage Nov 4, 2017
README.md Add a small example Dec 17, 2017
appveyor.yml Drop flow checks for appveyor Nov 18, 2017
package.json Update flow to 0.77 Jul 24, 2018

README.md

flow2schema

Version npm Linux Build Windows Build Coverage Status

Example

$ cat example.js
type A<T, K> = {
    t: T,
    k: K,
};

export type X = {
    a: A<string, boolean>,
    b: number,
};
$ 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.