Skip to content

Converts Thrift specs into Flow JavaScript type definitions

License

Notifications You must be signed in to change notification settings

uber-web/thrift2flow

Repository files navigation

thrift2flow

Build status

Automagically converts Apache Thrift specs to Flowtype type definition files!

NOTE: This library tries to align with the thriftrw JS semantics which means it may not be compatible with generated code from the apache thrift project.

Example:

typedef string UUID

struct Customer {
  1: UUID id
  2: string name
  3: i32 age
  4: list<string> tags
}

Output:

export type UUID = string;

export type Customer = {
  id: UUID,
  name: string,
  age: number,
  tags: string[],
};

Installation and Usage

npm install -g thrift2flow
thrift2flow --path="idl/code.foo.bar" --outputDir="src/types/idl" idl/code.foo.bar/*/*/*.thrift

Contributing

We'd love for you to contribute to this project. Before we can accept your contributions, we kindly ask you to sign our Uber Contributor License Agreement.

  • If you find a bug, please open an issue, or submit a fix via a pull request
  • If you have a feature request, open an issue, or submit an implementation via a pull request
  • If you want to contribute, submit a pull request

Thanks!