flow2schema/README.md

42 lines
790 B
Markdown
Raw Normal View History

2017-10-29 02:15:03 +03:00
# flow2avro
## Example
Input:
```javascript
$ ./bin/flow2avro -
interface Foo {
foo: string,
2017-10-29 02:29:55 +03:00
// $avro long
bar: number,
opt: ?number,
2017-10-29 02:15:03 +03:00
baz: 'one' | 'two',
mix: 'one' | 'two' | number,
}
```
Output:
```javascript
{
Foo: {
type: 'record',
fields: [
{ name: 'foo', type: 'string' },
2017-10-29 02:29:55 +03:00
{ name: 'bar', type: 'long' },
{ name: 'opt', type: [ 'null', 'double' ] },
2017-10-29 02:15:03 +03:00
{ name: 'baz', type: { type: 'enum', symbols: [ 'one', 'two' ] } },
{ name: 'mix', type: [
'double',
{ type: 'enum', symbols: [ 'one', 'two' ] }
] }
],
name: 'Foo'
}
}
```
2017-10-29 02:29:55 +03:00
## TODO
2017-10-29 02:15:03 +03:00
2017-10-29 16:05:35 +03:00
* Support `extends` and `implements`.
2017-10-29 02:15:03 +03:00
* Generics.