794167254a | ||
---|---|---|
bin | ||
declarations | ||
src | ||
tests | ||
.babelrc | ||
.flowconfig | ||
.gitignore | ||
.travis.yml | ||
README.md | ||
appveyor.yml | ||
package.json |
README.md
flow2schema
Currently avro is the only supported target.
Example
Input ($ cat example.js
):
export interface Foo {
foo: string,
// $avro long
bar: number,
opt: ?number,
baz: 'one' | 'two',
mix: 'one' | 'two' | number,
}
Output ($ ./bin/flow2schema example.js
):
[
{
"type": "record",
"fields": [
{"name": "foo", "type": "string"},
{"name": "bar", "type": "double"},
{"name": "opt", "type": ["null", "double"]},
{"name": "baz", "type": {"type": "enum", "symbols": ["one", "two"]}},
{
"name": "mix",
"type": ["double", {"type": "enum", "symbols": ["one", "two"]}]
}
],
"name": "Foo",
"namespace": "example"
}
]
TODO
- Complete generics support.
- Errors and warnings.
- Support commonjs modules.
- Documentation.