Skip to content

Commit

Permalink
Put documentation to bfbs if it is not empty (google#7649)
Browse files Browse the repository at this point in the history
* Fix C/C++ Create<Type>Direct with sorted vectors

If a struct has a key the vector has to be sorted. To sort the vector
you can't use "const".

* Changes due to code review

* Improve code readability

* Add generate of JSON schema to string to lib

* option indent_step is supported

* Remove unused variables

* Fix break in test

* Fix style to be consistent with rest of the code

* [TS] Fix reserved words as arguments (google#6955)

* [TS] Fix generation of reserved words in object api (google#7106)

* [TS] Fix generation of object api

* [TS] Fix MakeCamel -> ConvertCase

* [C#] Fix collision of field name and type name

* [TS] Add test for struct of struct of struct

* Update generated files

* Add missing files

* [TS] Fix query of null/undefined fields in object api

* Put documentation to bfbs if it is not empty

* Fix monster test bfbs reference files

* Fix generated monster test files

Why they are different when generating it with linux and windows executable?
  • Loading branch information
tira-misu authored and Jochen Parmentier committed Oct 29, 2024
1 parent 505f484 commit 6455b79
Show file tree
Hide file tree
Showing 6 changed files with 5,009 additions and 5,613 deletions.
Binary file modified samples/monster.bfbs
Binary file not shown.
12 changes: 6 additions & 6 deletions src/idl_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3803,7 +3803,7 @@ Offset<reflection::Object> StructDef::Serialize(FlatBufferBuilder *builder,
const auto name__ = builder->CreateString(qualified_name);
const auto flds__ = builder->CreateVectorOfSortedTables(&field_offsets);
const auto attr__ = SerializeAttributes(builder, parser);
const auto docs__ = parser.opts.binary_schema_comments
const auto docs__ = parser.opts.binary_schema_comments && !doc_comment.empty()
? builder->CreateVectorOfStrings(doc_comment)
: 0;
std::string decl_file_in_project = declaration_file ? *declaration_file : "";
Expand Down Expand Up @@ -3861,7 +3861,7 @@ Offset<reflection::Field> FieldDef::Serialize(FlatBufferBuilder *builder,
auto name__ = builder->CreateString(name);
auto type__ = value.type.Serialize(builder);
auto attr__ = SerializeAttributes(builder, parser);
auto docs__ = parser.opts.binary_schema_comments
auto docs__ = parser.opts.binary_schema_comments && !doc_comment.empty()
? builder->CreateVectorOfStrings(doc_comment)
: 0;
double d;
Expand Down Expand Up @@ -3914,7 +3914,7 @@ Offset<reflection::RPCCall> RPCCall::Serialize(FlatBufferBuilder *builder,
const Parser &parser) const {
auto name__ = builder->CreateString(name);
auto attr__ = SerializeAttributes(builder, parser);
auto docs__ = parser.opts.binary_schema_comments
auto docs__ = parser.opts.binary_schema_comments && !doc_comment.empty()
? builder->CreateVectorOfStrings(doc_comment)
: 0;
return reflection::CreateRPCCall(
Expand Down Expand Up @@ -3942,7 +3942,7 @@ Offset<reflection::Service> ServiceDef::Serialize(FlatBufferBuilder *builder,
const auto name__ = builder->CreateString(qualified_name);
const auto call__ = builder->CreateVector(servicecall_offsets);
const auto attr__ = SerializeAttributes(builder, parser);
const auto docs__ = parser.opts.binary_schema_comments
const auto docs__ = parser.opts.binary_schema_comments && !doc_comment.empty()
? builder->CreateVectorOfStrings(doc_comment)
: 0;
std::string decl_file_in_project = declaration_file ? *declaration_file : "";
Expand Down Expand Up @@ -3980,7 +3980,7 @@ Offset<reflection::Enum> EnumDef::Serialize(FlatBufferBuilder *builder,
const auto vals__ = builder->CreateVector(enumval_offsets);
const auto type__ = underlying_type.Serialize(builder);
const auto attr__ = SerializeAttributes(builder, parser);
const auto docs__ = parser.opts.binary_schema_comments
const auto docs__ = parser.opts.binary_schema_comments && !doc_comment.empty()
? builder->CreateVectorOfStrings(doc_comment)
: 0;
std::string decl_file_in_project = declaration_file ? *declaration_file : "";
Expand Down Expand Up @@ -4025,7 +4025,7 @@ Offset<reflection::EnumVal> EnumVal::Serialize(FlatBufferBuilder *builder,
const auto name__ = builder->CreateString(name);
const auto type__ = union_type.Serialize(builder);
const auto attr__ = SerializeAttributes(builder, parser);
const auto docs__ = parser.opts.binary_schema_comments
const auto docs__ = parser.opts.binary_schema_comments && !doc_comment.empty()
? builder->CreateVectorOfStrings(doc_comment)
: 0;
return reflection::CreateEnumVal(*builder, name__, value, type__, docs__,
Expand Down
Binary file modified tests/arrays_test.bfbs
Binary file not shown.
Loading

0 comments on commit 6455b79

Please sign in to comment.