patched flow2schema
 
Go to file
Paul Loyd f9a80591ad Compile sources with babel 2017-11-16 15:17:15 +03:00
bin Compile sources with babel 2017-11-16 15:17:15 +03:00
src Compile sources with babel 2017-11-16 15:17:15 +03:00
tests Compile sources with babel 2017-11-16 15:17:15 +03:00
.babelrc Compile sources with babel 2017-11-16 15:17:15 +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 Fix readme.md 2017-11-09 12:19:18 +03:00
appveyor.yml Add appveyor and badges 2017-11-05 00:26:11 +03:00
package.json Compile sources with babel 2017-11-16 15:17:15 +03:00

README.md

flow2avro

Version npm Linux Build Windows Build Coverage Status

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/flow2avro 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

  • Generics.
  • Errors and warnings.
  • Support commonjs modules.
  • Documentation.