flow2schema
![Coverage Status](https://camo.githubusercontent.com/a0e9223ffc13c83bd4b9466ea9e02c64bd8e50e1ed65c3cecf3904a8d87b641a/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6c6f79642f666c6f7732736368656d612f62616467652e7376673f6272616e63683d6d6173746572)
Example
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.