patched flow2schema
 
Go to file
Paul Loyd 94535791e9 Use flow to check code 2017-11-18 12:38:34 +03:00
bin Rename the project to "flow2schema" 2017-11-16 17:34:27 +03:00
declarations Use flow to check code 2017-11-18 12:38:34 +03:00
src Use flow to check code 2017-11-18 12:38:34 +03:00
tests Compile sources with babel 2017-11-16 15:17:15 +03:00
.babelrc Use flow to check code 2017-11-18 12:38:34 +03:00
.flowconfig Use flow to check code 2017-11-18 12:38:34 +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 Rename the project to "flow2schema" 2017-11-16 17:34:27 +03:00
appveyor.yml Add appveyor and badges 2017-11-05 00:26:11 +03:00
package.json Use flow to check code 2017-11-18 12:38:34 +03:00

README.md

flow2schema

Version npm Linux Build Windows Build Coverage Status

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.