protoc-gen-flowtypes

command
v0.0.0-...-de50d6b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2017 License: MIT Imports: 10 Imported by: 0

README

protoc-gen-flowtypes

Generate flowtype type definitions for proto3 messages and enums.

Contributions welcome.

$ cat simple.proto
syntax = "proto3";

message SearchRequest {
  string query = 1;
  int32 page_number = 2;
  int32 result_per_page = 3;
  enum Corpus {
    UNIVERSAL = 0;
    WEB = 1;
    IMAGES = 2;
    LOCAL = 3;
    NEWS = 4;
    PRODUCTS = 5;
    VIDEO = 6;
  }
  Corpus corpus = 4;
}

message SearchResponse {
  repeated string results = 1;
  int32 num_results = 2;
  SearchRequest original_request = 3;
}

example use:

$ protoc -I. -I${GOPATH}/src --flowtypes_out=. simple.proto
$ cat simple_types.js

simple_types.js:

/* @flow */
// Code generated by protoc-gen-flowtypes DO NOT EDIT.

export type SearchRequestCorpus = "UNIVERSAL" | "WEB" | "IMAGES" | "LOCAL" | "NEWS" | "PRODUCTS" | "VIDEO";

export type SearchRequest = {
  query?: string,
  page_number?: number,
  result_per_page?: number,
  corpus?: SearchRequestCorpus,
  example_required: number
};

export type SearchResponse = {
  results?: Array<string>,
  num_results?: number,
  original_request?: SearchRequest
};

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package genflowtypes provides a code generator for flow types.
Package genflowtypes provides a code generator for flow types.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL