Lines Matching +full:object +full:- +full:schema
8 * http://www.apache.org/licenses/LICENSE-2.0
58 Error("failed to load binary schema: " + filename, false, false); in LoadBinarySchema()
77 { "", "strict-json", "",
80 { "", "allow-non-utf8", "",
81 "Pass non-UTF-8 input through parser and emit nonstandard \\x escapes in "
82 "JSON. (Default is to raise parse error on non-UTF-8 input.)" },
83 { "", "natural-utf8", "",
84 "Output strings with UTF-8 as human-readable strings. By default, UTF-8 "
86 { "", "defaults-json", "",
88 { "", "unknown-json", "",
89 "Allow fields in JSON that are not defined in the schema. These fields "
91 { "", "no-prefix", "",
93 { "", "scoped-enums", "",
95 "--no-prefix." },
96 { "", "no-emit-min-max-enum-values", "",
99 { "", "swift-implementation-only", "",
101 { "", "gen-includes", "",
103 "required (no include statements) use --no-includes." },
104 { "", "no-includes", "",
106 "file depends on (C++, Python, Proto-to-Fbs)." },
107 { "", "gen-mutable", "",
108 "Generate accessors that can mutate buffers in-place." },
109 { "", "gen-onefile", "",
111 "Implies --no-include." },
112 { "", "gen-name-strings", "",
114 { "", "gen-object-api", "", "Generate an additional object-based API." },
115 { "", "gen-compare", "", "Generate operator== for object-based API types." },
116 { "", "gen-nullable", "",
118 { "", "java-package-prefix", "",
120 { "", "java-checkerframework", "", "Add @Pure for Java." },
121 { "", "gen-generated", "", "Add @Generated annotation for Java." },
122 { "", "gen-jvmstatic", "",
123 "Add @JvmStatic annotation for Kotlin methods in companion object for "
125 { "", "gen-all", "",
126 "Generate not just code for the current schema files, but for all files it "
130 { "", "gen-json-emit", "",
132 { "", "cpp-include", "", "Adds an #include in generated file." },
133 { "", "cpp-ptr-type", "T",
134 "Set object API pointer type (default std::unique_ptr)." },
135 { "", "cpp-str-type", "T",
136 "Set object API string type (default std::string). T::c_str(), T::length() "
138 "constructible from std::string (see the --cpp-str-flex-ctor option to "
140 { "", "cpp-str-flex-ctor", "",
143 { "", "cpp-field-case-style", "STYLE",
145 "'unchanged' - leave unchanged (default) * 'upper' - schema snake_case "
146 "emits UpperCamel; * 'lower' - schema snake_case emits lowerCamel." },
147 { "", "cpp-std", "CPP_STD",
149 "CPP_STD values: * 'c++0x' - generate code compatible with old compilers; "
150 "'c++11' - use C++11 code generator (default); * 'c++17' - use C++17 "
152 { "", "cpp-static-reflection", "",
153 "When using C++17, generate extra code to provide compile-time (static) "
154 "reflection of Flatbuffers types. Requires --cpp-std to be \"c++17\" or "
156 { "", "object-prefix", "PREFIX",
157 "Customize class prefix for C++ object-based API." },
158 { "", "object-suffix", "SUFFIX",
159 "Customize class suffix for C++ object-based API. Default Value is "
161 { "", "go-namespace", "", "Generate the overriding namespace in Golang." },
162 { "", "go-import", "IMPORT",
165 { "", "go-module-name", "",
167 { "", "raw-binary", "",
169 "given a mismatched schema." },
170 { "", "size-prefixed", "", "Input binaries are size prefixed buffers." },
171 { "", "proto-namespace-suffix", "SUFFIX",
173 { "", "oneof-union", "", "Translate .proto oneofs to flatbuffer unions." },
174 { "", "keep-proto-id", "", "Keep protobuf field ids in generated fbs file." },
175 { "", "proto-id-gap", "",
178 "'nop' - do not care about gap * 'warn' - A warning message will be shown "
181 "* 'error' - An error message will be shown and the fbs generation will be "
184 { "", "schema", "", "Serialize schemas instead of JSON (use with -b)." },
185 { "", "bfbs-filenames", "PATH",
189 "directory of the first provided schema file." },
190 …{ "", "bfbs-absolute-paths", "", "Uses absolute paths instead of relative paths in the BFBS output…
191 { "", "bfbs-comments", "", "Add doc comments to the binary schema files." },
192 { "", "bfbs-builtins", "",
193 "Add builtin attributes to the binary schema files." },
194 { "", "bfbs-gen-embed", "",
195 "Generate code to embed the bfbs schema to the source." },
197 "Specify a schema the following schemas should be an evolution of. Gives "
199 { "", "conform-includes", "PATH",
200 "Include path for the schema given with --conform PATH" },
201 { "", "filename-suffix", "SUFFIX",
204 { "", "filename-ext", "EXT",
206 "language-specific (e.g., '.h' for C++)" },
207 { "", "include-prefix", "PATH",
209 { "", "keep-prefix", "",
210 "Keep original prefix of schema include statement." },
211 { "", "reflect-types", "",
213 { "", "reflect-names", "", "Add minimal type/name reflection." },
214 { "", "rust-serialize", "",
216 { "", "rust-module-root-file", "",
218 { "", "root-type", "T", "Select or override the default root_type." },
219 { "", "require-explicit-ids", "",
221 { "", "force-defaults", "",
223 { "", "force-empty", "",
224 "When serializing from object API representation, force strings and "
226 { "", "force-empty-vectors", "",
227 "When serializing from object API representation, force vectors to empty "
231 "schema-less FlexBuffers." },
232 { "", "no-warnings", "", "Inhibit all warnings messages." },
233 { "", "warnings-as-errors", "", "Treat all warnings as errors." },
234 { "", "cs-global-alias", "",
237 { "", "cs-gen-json-serializer", "",
238 "Allows (de)serialization of JSON text in the Object API. (requires "
239 "--gen-object-api)." },
240 { "", "json-nested-bytes", "",
243 { "", "ts-flat-files", "",
246 { "", "ts-entry-points", "",
247 "Generate entry point typescript per namespace. Implies gen-all." },
248 { "", "annotate-sparse-vectors", "", "Don't annotate every vector element." },
249 { "", "annotate", "SCHEMA",
250 "Annotate the provided BINARY_FILE with the specified SCHEMA file." },
251 { "", "no-leak-private-annotation", "",
252 "Prevents multiple type of annotations within a Fbs SCHEMA file. "
254 { "", "python-no-type-prefix-suffix", "",
256 { "", "python-typing", "", "Generate Python type annotations" },
257 { "", "ts-omit-entrypoint", "",
259 { "", "file-names-only", "",
268 size_t max_line_length = max_col - start_col; in AppendTextWrappedString()
291 ss << "-" << option.short_opt; in AppendOption()
300 ss << "--" << option.long_opt << " "; in AppendOption()
327 ss << "-" << option.short_opt; in AppendShortOption()
330 if (!option.long_opt.empty()) { ss << "--" << option.long_opt; } in AppendShortOption()
348 ss.seekp(-2, ss.cur); in GetShortUsageString()
349 ss << "]... FILE... [-- BINARY_FILE...]"; in GetShortUsageString()
360 << " [OPTION]... FILE... [-- BINARY_FILE...]\n"; in GetUsageString()
374 ".bfbs) or JSON files (conforming to preceding schema). BINARY_FILEs " in GetUsageString()
375 "after the -- must be binary flatbuffer format files. Output files are " in GetUsageString()
377 "directory or the path given by -o. example: " + in GetUsageString()
378 program_name + " -c -b schema1.fbs schema2.fbs data.json"; in GetUsageString()
411 // TODO(dbaileychess): Right now we just support a single text-based in AnnotateBinaries()
412 // output of the annotated binary schema, which we generate here. We in AnnotateBinaries()
413 // could output the raw annotations instead and have third-party tools in AnnotateBinaries()
434 if (arg[0] == '-') { in ParseFromCommandLineArguments()
435 if (options.filenames.size() && arg[1] != '-') in ParseFromCommandLineArguments()
437 if (arg == "-o") { in ParseFromCommandLineArguments()
441 } else if (arg == "-I") { in ParseFromCommandLineArguments()
447 } else if (arg == "--bfbs-filenames") { in ParseFromCommandLineArguments()
452 } else if (arg == "--conform") { in ParseFromCommandLineArguments()
455 } else if (arg == "--conform-includes") { in ParseFromCommandLineArguments()
461 } else if (arg == "--include-prefix") { in ParseFromCommandLineArguments()
465 } else if (arg == "--keep-prefix") { in ParseFromCommandLineArguments()
467 } else if (arg == "--strict-json") { in ParseFromCommandLineArguments()
469 } else if (arg == "--allow-non-utf8") { in ParseFromCommandLineArguments()
471 } else if (arg == "--natural-utf8") { in ParseFromCommandLineArguments()
473 } else if (arg == "--go-namespace") { in ParseFromCommandLineArguments()
476 } else if (arg == "--go-import") { in ParseFromCommandLineArguments()
479 } else if (arg == "--go-module-name") { in ParseFromCommandLineArguments()
482 } else if (arg == "--defaults-json") { in ParseFromCommandLineArguments()
484 } else if (arg == "--unknown-json") { in ParseFromCommandLineArguments()
486 } else if (arg == "--no-prefix") { in ParseFromCommandLineArguments()
488 } else if (arg == "--cpp-minify-enums") { in ParseFromCommandLineArguments()
490 } else if (arg == "--scoped-enums") { in ParseFromCommandLineArguments()
493 } else if (arg == "--no-emit-min-max-enum-values") { in ParseFromCommandLineArguments()
495 } else if (arg == "--no-union-value-namespacing") { in ParseFromCommandLineArguments()
497 } else if (arg == "--gen-mutable") { in ParseFromCommandLineArguments()
499 } else if (arg == "--gen-name-strings") { in ParseFromCommandLineArguments()
501 } else if (arg == "--gen-object-api") { in ParseFromCommandLineArguments()
503 } else if (arg == "--gen-compare") { in ParseFromCommandLineArguments()
505 } else if (arg == "--cpp-include") { in ParseFromCommandLineArguments()
508 } else if (arg == "--cpp-ptr-type") { in ParseFromCommandLineArguments()
511 } else if (arg == "--cpp-str-type") { in ParseFromCommandLineArguments()
514 } else if (arg == "--cpp-str-flex-ctor") { in ParseFromCommandLineArguments()
516 } else if (arg == "--no-cpp-direct-copy") { in ParseFromCommandLineArguments()
518 } else if (arg == "--cpp-field-case-style") { in ParseFromCommandLineArguments()
529 } else if (arg == "--gen-nullable") { in ParseFromCommandLineArguments()
531 } else if (arg == "--java-package-prefix") { in ParseFromCommandLineArguments()
534 } else if (arg == "--java-checkerframework") { in ParseFromCommandLineArguments()
536 } else if (arg == "--gen-generated") { in ParseFromCommandLineArguments()
538 } else if (arg == "--swift-implementation-only") { in ParseFromCommandLineArguments()
540 } else if (arg == "--gen-json-emit") { in ParseFromCommandLineArguments()
542 } else if (arg == "--object-prefix") { in ParseFromCommandLineArguments()
545 } else if (arg == "--object-suffix") { in ParseFromCommandLineArguments()
548 } else if (arg == "--gen-all") { in ParseFromCommandLineArguments()
551 } else if (arg == "--gen-includes") { in ParseFromCommandLineArguments()
553 Warn("warning: --gen-includes is deprecated (it is now default)\n"); in ParseFromCommandLineArguments()
554 } else if (arg == "--no-includes") { in ParseFromCommandLineArguments()
556 } else if (arg == "--gen-onefile") { in ParseFromCommandLineArguments()
559 } else if (arg == "--raw-binary") { in ParseFromCommandLineArguments()
561 } else if (arg == "--size-prefixed") { in ParseFromCommandLineArguments()
563 } else if (arg == "--") { // Separator between text and binary inputs. in ParseFromCommandLineArguments()
565 } else if (arg == "--proto-namespace-suffix") { in ParseFromCommandLineArguments()
568 } else if (arg == "--oneof-union") { in ParseFromCommandLineArguments()
570 } else if (arg == "--keep-proto-id") { in ParseFromCommandLineArguments()
572 } else if (arg == "--proto-id-gap") { in ParseFromCommandLineArguments()
582 } else if (arg == "--schema") { in ParseFromCommandLineArguments()
584 } else if (arg == "-M") { in ParseFromCommandLineArguments()
586 } else if (arg == "--version") { in ParseFromCommandLineArguments()
589 } else if (arg == "--help" || arg == "-h") { in ParseFromCommandLineArguments()
592 } else if (arg == "--grpc") { in ParseFromCommandLineArguments()
594 } else if (arg == "--bfbs-comments") { in ParseFromCommandLineArguments()
596 } else if (arg == "--bfbs-builtins") { in ParseFromCommandLineArguments()
598 } else if (arg == "--bfbs-gen-embed") { in ParseFromCommandLineArguments()
600 } else if (arg == "--bfbs-absolute-paths") { in ParseFromCommandLineArguments()
602 } else if (arg == "--reflect-types") { in ParseFromCommandLineArguments()
604 } else if (arg == "--reflect-names") { in ParseFromCommandLineArguments()
606 } else if (arg == "--rust-serialize") { in ParseFromCommandLineArguments()
608 } else if (arg == "--rust-module-root-file") { in ParseFromCommandLineArguments()
610 } else if (arg == "--require-explicit-ids") { in ParseFromCommandLineArguments()
612 } else if (arg == "--root-type") { in ParseFromCommandLineArguments()
615 } else if (arg == "--filename-suffix") { in ParseFromCommandLineArguments()
618 } else if (arg == "--filename-ext") { in ParseFromCommandLineArguments()
621 } else if (arg == "--force-defaults") { in ParseFromCommandLineArguments()
623 } else if (arg == "--force-empty") { in ParseFromCommandLineArguments()
626 } else if (arg == "--force-empty-vectors") { in ParseFromCommandLineArguments()
628 } else if (arg == "--java-primitive-has-method") { in ParseFromCommandLineArguments()
630 } else if (arg == "--cs-gen-json-serializer") { in ParseFromCommandLineArguments()
632 } else if (arg == "--flexbuffers") { in ParseFromCommandLineArguments()
634 } else if (arg == "--gen-jvmstatic") { in ParseFromCommandLineArguments()
636 } else if (arg == "--no-warnings") { in ParseFromCommandLineArguments()
638 } else if (arg == "--warnings-as-errors") { in ParseFromCommandLineArguments()
640 } else if (arg == "--cpp-std") { in ParseFromCommandLineArguments()
644 } else if (arg.rfind("--cpp-std=", 0) == 0) { in ParseFromCommandLineArguments()
645 opts.cpp_std = arg.substr(std::string("--cpp-std=").size()); in ParseFromCommandLineArguments()
646 } else if (arg == "--cpp-static-reflection") { in ParseFromCommandLineArguments()
648 } else if (arg == "--cs-global-alias") { in ParseFromCommandLineArguments()
650 } else if (arg == "--json-nested-bytes") { in ParseFromCommandLineArguments()
652 } else if (arg == "--ts-flat-files") { in ParseFromCommandLineArguments()
656 } else if (arg == "--ts-entry-points") { in ParseFromCommandLineArguments()
659 } else if (arg == "--ts-no-import-ext") { in ParseFromCommandLineArguments()
661 } else if (arg == "--no-leak-private-annotation") { in ParseFromCommandLineArguments()
663 } else if (arg == "--python-no-type-prefix-suffix") { in ParseFromCommandLineArguments()
665 } else if (arg == "--python-typing") { in ParseFromCommandLineArguments()
667 } else if (arg == "--ts-omit-entrypoint") { in ParseFromCommandLineArguments()
669 } else if (arg == "--annotate-sparse-vectors") { in ParseFromCommandLineArguments()
671 } else if (arg == "--annotate") { in ParseFromCommandLineArguments()
674 } else if (arg == "--file-names-only") { in ParseFromCommandLineArguments()
678 if (arg == "--proto") { opts.proto_mode = true; } in ParseFromCommandLineArguments()
687 code_generator_it->second; in ParseFromCommandLineArguments()
692 opts.lang_to_generate |= code_generator->Language(); in ParseFromCommandLineArguments()
694 auto is_binary_schema = code_generator->SupportsBfbsGeneration(); in ParseFromCommandLineArguments()
722 "--cs-gen-json-serializer requires --gen-object-api to be set as " in ValidateOptions()
739 Error("unable to load schema: " + options.conform_to_schema); in GetConformParser()
767 bool is_binary = static_cast<size_t>(file_it - options.filenames.begin()) >= in GenerateCode()
776 parser->builder_.Clear(); in GenerateCode()
777 parser->builder_.PushFlatBuffer( in GenerateCode()
781 // Generally reading binaries that do not correspond to the schema in GenerateCode()
786 if (!parser->file_identifier_.length()) { in GenerateCode()
787 Error("current schema has no file_identifier: cannot test if \"" + in GenerateCode()
789 "\" matches the schema, use --raw-binary to read this file" in GenerateCode()
792 contents.c_str(), parser->file_identifier_.c_str(), in GenerateCode()
796 parser->file_identifier_ + in GenerateCode()
797 "\", use --raw-binary to read this file anyway."); in GenerateCode()
812 // Try to parse the file contents (binary schema/flexbuffer/textual in GenerateCode()
813 // schema) in GenerateCode()
823 parser->flex_root_ = flexbuffers::GetRoot(data, size); in GenerateCode()
825 parser->flex_builder_.Clear(); in GenerateCode()
830 if (!is_schema && !parser->builder_.GetSize()) { in GenerateCode()
832 // didn't just parse a schema with a different extension. in GenerateCode()
833 Error("input file is neither json nor a .fbs (schema) file: " + in GenerateCode()
840 auto err = parser->ConformTo(conform_parser); in GenerateCode()
844 parser->Serialize(); in GenerateCode()
847 parser->file_extension_ = reflection::SchemaExtension(); in GenerateCode()
858 parser->Serialize(); in GenerateCode()
859 bfbs_buffer = parser->builder_.GetBufferPointer(); in GenerateCode()
860 bfbs_length = parser->builder_.GetSize(); in GenerateCode()
867 const CodeGenerator::Status status = code_generator->GenerateMakeRule( in GenerateCode()
874 code_generator->LanguageName()); in GenerateCode()
880 if (code_generator->SupportsBfbsGeneration()) { in GenerateCode()
884 const CodeGenerator::Status status = code_generator->GenerateCode( in GenerateCode()
887 Error("Unable to generate " + code_generator->LanguageName() + in GenerateCode()
888 " for " + filebase + code_generator->status_detail + in GenerateCode()
892 if ((!code_generator->IsSchemaOnly() || in GenerateCode()
894 code_generator->GenerateCode(*parser, options.output_path, in GenerateCode()
897 Error("Unable to generate " + code_generator->LanguageName() + in GenerateCode()
898 " for " + filebase + code_generator->status_detail); in GenerateCode()
904 const CodeGenerator::Status status = code_generator->GenerateGrpcCode( in GenerateCode()
909 code_generator->LanguageName()); in GenerateCode()
912 code_generator->LanguageName()); in GenerateCode()
918 if (!parser->SetRootType(opts.root_type.c_str())) in GenerateCode()
920 else if (parser->root_struct_def_->fixed) in GenerateCode()
926 parser->MarkGenerated(); in GenerateCode()
940 Error("Expected a `.bfbs` or `.fbs` schema, got: " + in Compile()
949 Error("unable to load schema: " + options.annotate_schema); in Compile()
964 // If we need to generate the .bfbs file from the provided schema file in Compile()
975 Error("could not parse a value binary schema from: " + in Compile()
988 return -1; in Compile()
994 if (code_generator->SupportsRootFileGeneration()) { in Compile()
995 code_generator->GenerateRootFile(*parser, options.output_path); in Compile()
1005 code_generators_.find("-" + option.short_opt) != code_generators_.end()) { in RegisterCodeGenerator()
1006 Error("multiple generators registered under: -" + option.short_opt, false, in RegisterCodeGenerator()
1012 code_generators_["-" + option.short_opt] = code_generator; in RegisterCodeGenerator()
1016 code_generators_.find("--" + option.long_opt) != code_generators_.end()) { in RegisterCodeGenerator()
1017 Error("multiple generators registered under: --" + option.long_opt, false, in RegisterCodeGenerator()
1023 code_generators_["--" + option.long_opt] = code_generator; in RegisterCodeGenerator()