1FLATC(1)                         User Manuals                         FLATC(1)
2
3
4

NAME

6       flatc - flatbuffers compiler
7

SYNOPSIS

9       flatc   [generator-options]  [-o  PATH]  [-I=path]  [-S]  files...  [--
10       files...]
11
12       The files are read and parsed in order, and can contain either  schemas
13       or  data (see below). Data files are processed according to the defini‐
14       tions of the most recent schema specified. -- indicates that  the  fol‐
15       lowing  files  are  binary files in FlatBuffer format conforming to the
16       schema indicated before it. Depending on the flags  passed,  additional
17       files may be generated for each file processed.
18

OPTIONS

20       For any schema input files, one or more generators can be specified:
21
22       --cpp, -c
23          Generate  a  C++  header  for all definitions in this file (as file‐
24       name_generated.h).
25
26       --java, -j
27          Generate Java code.
28
29       --csharp, -n
30          Generate C# code.
31
32       --go, -g
33          Generate Go code.
34
35       --python, -p
36          Generate Python code.
37
38       --js, -s
39          Generate JavaScript code.
40
41       --ts
42          Generate TypeScript code.
43
44       --php
45          Generate PHP code.
46
47       --grpc
48          Generate RPC stub code for GRPC.
49
50       --dart
51          Generate Dart code.
52
53       --lua
54          Generate Lua code.
55
56       --lobster
57          Generate Lobster code.
58
59       --rust, -r
60          Generate Rust code.
61
62       For any data input files:
63
64       --binary, -b
65          If data is contained in this file, generate a filename.bin  contain‐
66       ing the binary flatbuffer (or a different extension if one is specified
67       in the schema).
68
69       --json, -t
70          If data is contained in this file, generate a  filename.json  repre‐
71       senting the data in the flatbuffer.
72
73       Additional options:
74
75       -o PATH
76          Output  all generated files to PATH (either absolute, or relative to
77       the current directory). If omitted, PATH will be the current directory.
78       PATH should end in your systems path separator, e.g. / or \.
79
80       -I PATH
81          when encountering include statements, attempt to load the files from
82       this path. Paths will be tried in the order given, and if all fail  (or
83       none  are  specified)  it  will try to load relative to the path of the
84       schema file being parsed.
85
86       -M
87          Print make rules for generated files.
88
89       --strict-json
90          Require & generate strict JSON (field names are enclosed in  quotes,
91       no  trailing  commas  in  tables/vectors).  By  default,  no quotes are
92       required/generated, and trailing commas are allowed.
93
94       --defaults-json
95          Output fields whose value is equal to the default value when writing
96       JSON text.
97
98       --no-prefix
99          Don't prefix enum values in generated C++ by their enum type.
100
101       --scoped-enums
102          Use  C++11  style  scoped and strongly typed enums in generated C++.
103       This also implies --no-prefix.
104
105       --gen-includes
106          (deprecated), this is the default behavior. If the original behavior
107       is required (no include statements) use --no-includes.
108
109       --no-includes
110          Don't generate include statements for included schemas the generated
111       file depends on (C++).
112
113       --gen-mutable
114          Generate additional non-const  accessors  for  mutating  FlatBuffers
115       in-place.
116
117       --gen-object-api
118          Generate an additional object-based API. This API is more convenient
119       for object construction and mutation than the base API, at the cost  of
120       efficiency  (object  allocation).  Recommended only to be used if other
121       options are insufficient.
122
123       --gen-compare
124          Generate operator== for object-based API types.
125
126       --gen-onefile
127          Generate single output file (useful for C#)
128
129       --gen-all
130          Generate not just code for the current schema  files,  but  for  all
131       files  it includes as well. If the language uses a single file for out‐
132       put (by default the case for C++ and JS), all code will end up in  this
133       one file.
134
135       --no-js-exports
136          Removes Node.js style export lines (useful for JS)
137
138       --goog-js-export
139          Uses  goog.exportsSymbol and goog.exportsProperty instead of Node.js
140       style exporting. Needed for compatibility with the Google closure  com‐
141       piler (useful for JS).
142
143       --es6-js-export
144          Generates  ECMAScript v6 style export definitions instead of Node.js
145       style  exporting.  Useful  when  integrating  flatbuffers  with  modern
146       Javascript projects.
147
148       --raw-binary
149          Allow binaries without a file_indentifier to be read. This may crash
150       flatc given a mismatched schema.
151
152       --proto
153          Expect input files to be .proto files (protocol buffers). Output the
154       corresponding  .fbs  file.  Currently supports: package, message, enum,
155       nested declarations, import (use -I for paths), extend,  oneof,  group.
156       Does  not support, but will skip without error: option, service, exten‐
157       sions, and most everything else.
158
159       --schema
160          Serialize schemas instead of JSON (use with -b). This will output  a
161       binary  version  of the specified schema that itself corresponds to the
162       reflection/reflection.fbs schema. Loading this binary file is the basis
163       for reflection functionality.
164
165       --bfbs-comments
166          Add doc comments to the binary schema files.
167
168       --conform FILE
169          Specify  a  schema  the following schemas should be an evolution of.
170       Gives errors if not. Useful to  check  if  schema  modifications  don't
171       break schema evolution rules.
172
173       --include-prefix PATH
174          Prefix this path to any generated include statements.
175
176       --keep-prefix
177          Keep original prefix of schema include statement.
178
179       --reflect-types
180          Add minimal type reflection to code generation.
181
182       --reflect-names
183          Add minimal type/name reflection.
184
185       --root-type T
186          Select or override the default root_type.
187
188       --force-defaults
189          Emit default values in binary output from JSON.
190
191       --force-empty
192          When  serializing  from object API representation, force strings and
193       vectors to empty rather than null.
194
195       NOTE: short-form options for generators are deprecated,  use  the  long
196       form whenever possible.
197

SEE ALSO

199       flatbuffers(7),  Official  documentation ⟨http://google.github.io/flat
200       buffers⟩
201
202
203
204Linux                             APRIL 2018                          FLATC(1)
Impressum