patched flow2schema
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Vitaliy Filippov 6fe28de2dc Translate null correctly when it is a part of a union type 3 years ago
bin Make CLI 5 years ago
declarations Support BooleanLiteralTypeAnnotation 3 years ago
src Translate null correctly when it is a part of a union type 3 years ago
tests Add selectiveImport sample 4 years ago
.babelrc Use flow to check code 5 years ago
.flowconfig Specify @flow everywhere 4 years ago
.gitignore Compile sources with babel 5 years ago
.travis.yml Add coverage 5 years ago
README.md Add a small example 5 years ago
appveyor.yml Drop flow checks for appveyor 5 years ago
package.json Update flow to 0.77 4 years ago

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.