Blob Blame History Raw
.TH FLATC 1 "APRIL 2018" Linux "User Manuals"
.SH NAME
.PP
flatc \- flatbuffers compiler
.SH SYNOPSIS
.PP
\fB\fCflatc\fR [\fIgenerator\-options\fP] [\fB\fC\-o\fR PATH] [\fB\fC\-I\fR=path] [\fB\fC\-S\fR] files... [\fB\fC\-\-\fR files...]
.PP
The files are read and parsed in order, and can contain either schemas or data (see below). Data files are processed according to the definitions of the most recent schema specified. \fB\fC\-\-\fR indicates that the following files are binary files in FlatBuffer format conforming to the schema indicated before it. Depending on the flags passed, additional files may be generated for each file processed.
.SH OPTIONS
.PP
For any schema input files, one or more generators can be specified:
.PP
\fB\fC\-\-cpp\fR, \fB\fC\-c\fR
   Generate a C++ header for all definitions in this file (as \fB\fCfilename_generated.h\fR).
.PP
\fB\fC\-\-java\fR, \fB\fC\-j\fR
   Generate Java code.
.PP
\fB\fC\-\-csharp\fR, \fB\fC\-n\fR
   Generate C# code.
.PP
\fB\fC\-\-go\fR, \fB\fC\-g\fR
   Generate Go code.
.PP
\fB\fC\-\-python\fR, \fB\fC\-p\fR
   Generate Python code.
.PP
\fB\fC\-\-js\fR, \fB\fC\-s\fR
   Generate JavaScript code.
.PP
\fB\fC\-\-ts\fR
   Generate TypeScript code.
.PP
\fB\fC\-\-php\fR
   Generate PHP code.
.PP
\fB\fC\-\-grpc\fR
   Generate RPC stub code for GRPC.
.PP
\fB\fC\-\-dart\fR
   Generate Dart code.
.PP
\fB\fC\-\-lua\fR
   Generate Lua code.
.PP
\fB\fC\-\-lobster\fR
   Generate Lobster code.
.PP
\fB\fC\-\-rust\fR, \fB\fC\-r\fR
   Generate Rust code.
.PP
For any data input files:
.PP
\fB\fC\-\-binary\fR, \fB\fC\-b\fR
   If data is contained in this file, generate a \fB\fCfilename.bin\fR containing the binary flatbuffer (or a different extension if one is specified in the schema).
.PP
\fB\fC\-\-json\fR, \fB\fC\-t\fR
   If data is contained in this file, generate a \fB\fCfilename.json\fR representing the data in the flatbuffer.
.PP
Additional options:
.PP
\fB\fC\-o PATH\fR
   Output all generated files to PATH (either absolute, or relative to the current directory). If omitted, PATH will be the current directory. PATH should end in your systems path separator, e.g. \fB\fC/\fR or \fB\fC\\\fR\&.
.PP
\fB\fC\-I PATH\fR
   when encountering \fB\fCinclude\fR statements, attempt to load the files from this path. Paths will be tried in the order given, and if all fail (or none are specified) it will try to load relative to the path of the schema file being parsed.
.PP
\fB\fC\-M\fR
   Print make rules for generated files.
.PP
\fB\fC\-\-strict\-json\fR
   Require & generate strict JSON (field names are enclosed in quotes, no trailing commas in tables/vectors). By default, no quotes are required/generated, and trailing commas are allowed.
.PP
\fB\fC\-\-defaults\-json\fR
   Output fields whose value is equal to the default value when writing JSON text.
.PP
\fB\fC\-\-no\-prefix\fR
   Don't prefix enum values in generated C++ by their enum type.
.PP
\fB\fC\-\-scoped\-enums\fR
   Use C++11 style scoped and strongly typed enums in generated C++. This also implies \fB\fC\-\-no\-prefix\fR\&.
.PP
\fB\fC\-\-gen\-includes\fR
   (deprecated), this is the default behavior. If the original behavior is required (no include statements) use \fB\fC\-\-no\-includes.\fR
.PP
\fB\fC\-\-no\-includes\fR
   Don't generate include statements for included schemas the generated file depends on (C++).
.PP
\fB\fC\-\-gen\-mutable\fR
   Generate additional non\-const accessors for mutating FlatBuffers in\-place.
.PP
\fB\fC\-\-gen\-object\-api\fR
   Generate an additional object\-based API. This API is more convenient for object construction and mutation than the base API, at the cost of efficiency (object allocation). Recommended only to be used if other options are insufficient.
.PP
\fB\fC\-\-gen\-compare\fR
   Generate operator== for object\-based API types.
.PP
\fB\fC\-\-gen\-onefile\fR
   Generate single output file (useful for C#)
.PP
\fB\fC\-\-gen\-all\fR
   Generate not just code for the current schema files, but for all files it includes as well. If the language uses a single file for output (by default the case for C++ and JS), all code will end up in this one file.
.PP
\fB\fC\-\-no\-js\-exports\fR
   Removes Node.js style export lines (useful for JS)
.PP
\fB\fC\-\-goog\-js\-export\fR
   Uses goog.exportsSymbol and goog.exportsProperty instead of Node.js style exporting. Needed for compatibility with the Google closure compiler (useful for JS).
.PP
\fB\fC\-\-es6\-js\-export\fR
   Generates ECMAScript v6 style export definitions instead of Node.js style exporting. Useful when integrating flatbuffers with modern Javascript projects.
.PP
\fB\fC\-\-raw\-binary\fR
   Allow binaries without a \fB\fCfile_indentifier\fR to be read. This may crash flatc given a mismatched schema.
.PP
\fB\fC\-\-proto\fR
   Expect input files to be .proto files (protocol buffers). Output the corresponding .fbs file. Currently supports: \fB\fCpackage\fR, \fB\fCmessage\fR, \fB\fCenum\fR, nested declarations, \fB\fCimport\fR (use \fB\fC\-I\fR for paths), \fB\fCextend\fR, \fB\fConeof\fR, \fB\fCgroup\fR\&. Does not support, but will skip without error: \fB\fCoption\fR, \fB\fCservice\fR, \fB\fCextensions\fR, and most everything else.
.PP
\fB\fC\-\-schema\fR
   Serialize schemas instead of JSON (use with \-b). This will output a binary version of the specified schema that itself corresponds to the reflection/reflection.fbs schema. Loading this binary file is the basis for reflection functionality.
.PP
\fB\fC\-\-bfbs\-comments\fR
   Add doc comments to the binary schema files.
.PP
\fB\fC\-\-conform FILE\fR
   Specify a schema the following schemas should be an evolution of. Gives errors if not. Useful to check if schema modifications don't break schema evolution rules.
.PP
\fB\fC\-\-include\-prefix PATH\fR
   Prefix this path to any generated include statements.
.PP
\fB\fC\-\-keep\-prefix\fR
   Keep original prefix of schema include statement.
.PP
\fB\fC\-\-reflect\-types\fR
   Add minimal type reflection to code generation.
.PP
\fB\fC\-\-reflect\-names\fR
   Add minimal type/name reflection.
.PP
\fB\fC\-\-root\-type T\fR
   Select or override the default root_type.
.PP
\fB\fC\-\-force\-defaults\fR
   Emit default values in binary output from JSON.
.PP
\fB\fC\-\-force\-empty\fR
   When serializing from object API representation, force strings and vectors to empty rather than null.
.PP
NOTE: short\-form options for generators are deprecated, use the long form whenever possible.
.SH SEE ALSO
.PP
.BR flatbuffers (7), 
Official documentation \[la]http://google.github.io/flatbuffers\[ra]