patched flow2schema
 
Go to file
Vitaliy Filippov 6fe28de2dc Translate null correctly when it is a part of a union type 2019-10-23 17:00:38 +03:00
bin Make CLI 2017-12-17 13:13:27 +03:00
declarations Support BooleanLiteralTypeAnnotation 2019-05-24 00:07:17 +03:00
src Translate null correctly when it is a part of a union type 2019-10-23 17:00:38 +03:00
tests Add selectiveImport sample 2018-11-21 17:31:48 +03:00
.babelrc Use flow to check code 2017-11-18 12:38:34 +03:00
.flowconfig Specify @flow everywhere 2018-07-25 08:38:10 +03:00
.gitignore Compile sources with babel 2017-11-16 15:17:15 +03:00
.travis.yml Add coverage 2017-11-05 01:13:56 +03:00
README.md Add a small example 2017-12-17 13:39:17 +03:00
appveyor.yml Drop flow checks for appveyor 2017-11-18 13:48:16 +03:00
package.json Update flow to 0.77 2018-07-24 23:13:34 +03:00

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.