summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-02-04Upgrade swift grpc to alpha 24 (#6439)mustiikhalil7-171/+474
Upgrade swift grpc to alpha 24
2021-01-30[fuzzer] Limit parser_fuzzer execution time (#6431)Vladimir Glavnyy2-2/+2
Limit the length of the fuzzer input to 16384 characters to prevent timeout in JSON parser (Vector of tables with key). Related oss-fuzz issues: - 5742497110294528
2021-01-28This commit contains the initial implementation of Flexbuffers in Kotlin. ↵Paulo Pinheiro25-0/+4772
The code was ported based (#6387) on the current Java Implementation. The code dependencies related to JVM were removed and the project is able to target all available platforms. The only requirement to implement to fully support a target is to implement functions described in `ByteArray.kt`. Right now the code support JVM and native targets. JS port still missing, but just be trivial to introduce. Currently, only the `jvm` and `macosX64` targets are enabled until we figure out how to enable tests on all platforms on CI. A submodule called "benchmark" is also introduced. It contains a series of benchmarks comparing Java and Kotlin implementations of FlexBuffers and the UTF8 API. Finally, this commit does not contain the scripts necessary to publish the artifacts. This will be introduced at a later stage once the team has an agreement on how to rollout Kotlin releases.
2021-01-28Better python generated code naming (#6336)Richard A Hofer17-497/+1001
* Remove a lot of redundancy from the Python generated code. Update tutorial to reflect new Python generated code. * Add aliases for newly deprecated Python generated methods. This should help with backwards compatibility. * Fix incorrect names in deprecated comments.
2021-01-26Rust: remove inner attributes (#6410)Casper15-9/+104
* remove inner attributes * Added test for outdir in Rust * add bin/outdir * Moved outdir test to its own package and only run it if flatc is available Co-authored-by: Casper Neo <cneo@google.com>
2021-01-25[Rust] Ensure unions are referenced with the correct path (#6422)William Bain32-57/+1448
* Add codegen test for namespaced unions * [Rust] Handle cross-namespace union use * [Rust] Test namespace handling * [Rust] Drop trailing whitespace in codegen * [Rust] Set flags in generate_code.bat to match .sh * [C#] Add additional namespace test file
2021-01-25Refactor FieldDef to model presense as an enum rather than 2 bools. (#6420)Casper14-160/+183
* Define presence. * Migrate to IsRequired and IsOptional methods * moved stuff around * Removed optional and required bools from FieldDef * change assert to return error * Fix tests.cpp * MakeFieldPresence helper * fmt * old c++ compatibility stuff Co-authored-by: Casper Neo <cneo@google.com>
2021-01-25[c++] Apply NativeName before WrapInNameSpace in idl_gen_cpp.cpp (#6419)Andreas Kabel1-34/+33
* Apply NativeName before WrapInNameSpace in idl_gen_cpp.cpp * remove actual_type argument from GetUnionElement -- it's always true * Merge GetUnionElement's native_type and wrap_native argument -- they always have the same value. * Use convenience method WrapNativeNameInNameSpace * Remove wrap_namespace argument from GetUnionElement * Move declaration closer to first use.
2021-01-22Formats cpp code (#6349)mustiikhalil11-100/+167
2021-01-22Rust Object API (#6070)Casper21-321/+2364
* inital commit of rust object api * Required fields support. * clang fallthrough * Fix unused variables * just don't fall through * remove comment * s/panic/unreachable * Tests for object API * Added defaults * deleted unintentionally added files and updated .bat file * fix bat file * clang format * Cargo clippy checks * remove commented out code * clippy allows * Remove matches! macro since we're not yet at Rust v1.42 * install clippy in RustTest.sh * move line Co-authored-by: Casper Neo <cneo@google.com>
2021-01-21Clarify that (Flat|Flex)Buffers do not deduplicate vector elements (#6415)Juan Cruz Viotti1-2/+8
I'm also clarifying that while elements are not deduplicated, vectors may contain more than one offset to the same value. Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2021-01-21Clarify that FlatBuffers unions do not support scalars (#6416)Juan Cruz Viotti1-3/+5
I mention that a common practice is to wrap the scalar value in a table or a struct. Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2021-01-21Explain how FlatBuffers encodes unions (#6414)Juan Cruz Viotti1-0/+7
This is an attempt to explain how FlatBuffers encodes union types as an extra section in the "FlatBuffers internals" document. Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2021-01-21dart Builder - expose finished buffer size (#6403)Ivan Dlugos2-6/+9
2021-01-21Remove invalid claim that Protocol Buffers does not support unions (#6413)Juan Cruz Viotti1-2/+2
Protocol Buffers v3 supports the `oneof` operator: https://developers.google.com/protocol-buffers/docs/proto3#oneof Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2021-01-19[TS/JS] New gen TS code gen (#6302)Björn Harrtell56-4045/+3880
* TS/ES6 modules spike iteration 1 * Initial modularized dasherized output * Remove obsoleted parts and namespace wrapping * Use _flatbuffers_ prefix * First part of imports logic * Second part of imports logic * Fix TS/JS code removal mixup * Alias imported symbols if same name from different namespaces and some fixes * Use star import for bare imports * Fix messed up string concat * var to const and remove not needed semi * Remove some cases of ns prefixing * Add missing space * Cleanups * Completed initial import tracking logic * Compilable output * Adjust TypeScriptTest and dependents to work * Use local flatbuffers package for tests * Refactor away use of any * Remove obsolete imported_fileset and reexport_map * Still need any and fix JavaScriptTest.sh * Fix test runs out of the box * Temp add generated files * TypeScriptTest replaces JavaScriptTest and cleanups * Also remove reference to JavaScriptTest in TestAll.sh * Remove old generated ts/js files * Remove use of --js in generate_code scripts * idl_gen_js_ts to idl_gen_ts and removal of js gen * Remove obsoleted options * Fix obsolete ts test detection * Tweak ts compilation be as strict as possible * Remove jsdoc type annotation generation * Generated test ts files * Fix search and replace messup * Regenerated ts test output * Use CharToLower * Use normal for loop * Rework namespacedir * Revert "Rework namespacedir" This reverts commit 6f4eb0104ceeb86011bb076ebca901138c48e068. * Revert "Use normal for loop" This reverts commit 676b2135bfaa1853dfbb06c92b5c16a0d81bb13a. * Revert "Use CharToLower" This reverts commit 2d08648d0d72d0af201fad80d54cdc76412b35e9. * Again do rework but correct * Avoid runtime cast * Fix test runs * Also add npm install to get tsc * Bump node test versions * for range to std for loop * Clang format * Missed one clang format * Move accessor to later * Attempt to make windows version of TypeScriptTest * Want to see the output * Try to get newer node at appveyor * Style changes
2021-01-19[idl_parser] Improve symbols lookup thru parent namespaces (#6407)Vladimir Glavnyy2-16/+37
Added the new method LookupTableByName for searching symbols in parent namespaces. This method speedup (x50 or greater) symbol resolution (enum or struct) in parent namespaces. The speedup was measured without `table.empty()` guard condition. This method should suppress fuzzer timeout issue without artificial limits for nested namespaces (https://oss-fuzz.com/testcase-detail/6244168439169024). Additionally, this commit speedup (x5) the GetFullyQualifiedName method by removing unnecessary temporary std::string object.
2021-01-19Search for includes in the directory containg the current file (#6371)Mark Spatz1-4/+12
* [codegen] Search for includes in the directory containg the current file This matches the behavior of a C preprocessor, see: https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html * Skip FileExists() when file is guaranteed to not exist * end comment with period to match others
2021-01-19Upgrade Rust dependencies (#6406)Casper2-9/+9
Co-authored-by: Casper Neo <cneo@google.com>
2021-01-14[TS/JS] New gen TS code gen prequel to preserve history (#6404)Björn Harrtell4-4/+4
* Rename idl_gen_js_ts to idl_gen_ts to preserve history * Change build related files
2021-01-12Unset FieldDef.optional if its key (#6402)Casper4-178/+177
* Unset FieldDef.optional if its key * removed StringKey table, just removed an extra "required, key" * removed extra newline Co-authored-by: Casper Neo <cneo@google.com>
2021-01-12[fuzzer] Fix the binary schema loading in the monster_fuzzer (#6396)Vladimir Glavnyy1-18/+26
This commit should fix issue 29374 in oss-fuzz.
2021-01-11Fix Rust UB problems (#6393)Casper17-197/+540
* Fix miri problems by assuming alignment is 1 in rust * Removed is_aligned fn from rust verifier. * Add back is_aligned, but make it w.r.t. buffer[0] * touch unused variable * touch unused variable * +nightly * Move Rust miri testing into its own docker * fix bash * missing one endian conversion * fix endianness2 * format stuff Co-authored-by: Casper Neo <cneo@google.com>
2021-01-08Define Vector::value_type for STL compatibility (#6394)brian-brt1-0/+1
Specifically, this lets the googlemock container matchers work with a flatbuffers::Vector. https://github.com/google/googletest/blob/master/googlemock/docs/cheat_sheet.md#container-matchers
2021-01-08[fuzzer] Debug the monster_tets.bfbs on clusterfuzz server (#6392)Vladimir Glavnyy1-10/+28
For some reason, this fuzzer failed to load the binary schema file when run on the `/clusterfuzz` server. Issue: https://oss-fuzz.com/testcase-detail/6215075358703616 This issue doesn't reproduce locally with the latest oss-fuzz docker image.
2021-01-07Fix up scripts, fix generated enum value for strong mode, regenerate files ↵Dan Field9-31/+58
(#6389) * Fix up scripts, fix generated enum value for strong mode, regenerate files * missing files * GH action * remove action
2021-01-07[go] tests/GoTest.sh: Fix flags.Parse location to work on new go SDKs. (#6388)Aaron Son4-20/+23
* tests/GoTest.sh: Fix flags.Parse location to work on new go SDKs. Calling flags.Parse() within init() races with other packages which register flags in their init(), and in particular with the testing package itself. It is more reliable to call flags.Parse() from a TestMain implementation. See https://github.com/golang/go/issues/31859, https://github.com/golang/go/issues/33869. * .github: Enable build-go action in build.yaml workflow.
2021-01-07fix Dart Builder._writeString() - always write trailing zero byte (#6390)Ivan Dlugos1-0/+1
2021-01-07fix Dart Builder.reset() - clear vTables (#6386)Ivan Dlugos1-0/+1
2021-01-07[C++, JSON] Fix nullptr access when reading a key with a default value. (#6375)Vladimir Glavnyy28-574/+1238
This commit fixes handling of default and NULL `key` fields in `Parser::ParseVector` (#5928). The JSON generator updated. It outputs `key` fields even if the `--force-defaults` option is inactive. Additional test cases for `key` added.
2021-01-05Fix generated EndVector. (#6385)Richard A Hofer2-3/+3
2021-01-05Implements type promotion for Java enum (#6382)Stefan de Konink2-4/+4
* Implements type promotion for Java enum as suggested in #3890, #5111, #6369 * After generate_code.sh
2021-01-05Delete label_notify.ymlDerek Bailey1-17/+0
Removing this workflow as it isn't used.
2021-01-04Disabled PHP CI (#6381)Wouter van Oortmerssen1-13/+13
It errors with "Fatal error: Uncaught exception 'InvalidArgumentException' with message 'bad number for type byte.. in /home/runner/work/flatbuffers/flatbuffers/php/ByteBuffer.php:490" which I can't reproduce locally, and trying to fix it on CI runs into PHP's insane handling of numbers vs strings.
2021-01-04fixed warnings (#6355)Kamil Rojewski8-106/+113
* semver-compatible deprecations * removed unneeded lifetimes (+ clippy warnings) * silenced too many args warning
2021-01-04Fix multiple fbs code generation failure (#6365)Bruno ZIKI Kongawi1-2/+10
2021-01-04[idl_parser] Improve stack overflow protection (#6364)Vladimir Glavnyy6-58/+84
* [idl_parser] Improve stack overflow protection Add stack overflow protection for Flexbuffer and nested Flatbuffer parsers. Replaces the `Recurse()` method by the new ParseDepthGuard RAII class. * Remove move operator from Parser. It was wrong decision to add move ctor and assignment into Parser class. These operators will make it extremely difficult to add constant or reference fields in the future. * Remove ';' from definition of FLATBUFFERS_DELETE_FUNC * Format code * Make this PR compatible with MSVC2010 (it doesn't support inherited ctor)
2021-01-04[idl_parser] Check the range of explicitly set field's id value (#6363)Vladimir Glavnyy2-9/+53
* [idl_parser] Check the range of explicitly set field's id value The explicitly set `id` attribute should be a non-negative value of the `voffset_t` type. * Format FieldIdentifierTest()
2021-01-04Generate code to encode and decode nested flatbuffers in Python. (#6354)Richard A Hofer3-0/+127
* Generate code to encode and decode nested flatbuffers in Python. * Delete accidental trailing whitespace. * Fully delete trailing whitespace.
2021-01-04[Rust] Shared String (#6367)mustiikhalil3-0/+92
* Adds shared strings and tests for shared strings * Adds resets on string_map * Moved shared strings to use vector instead of hashmap * Addresses all the issues * Resolves some comments
2021-01-02Updates license date to 2021 (#6378)mustiikhalil25-25/+25
2020-12-30include_prefix support for rust (#6330)Kamil Rojewski1-2/+10
* include_prefix support for rust * include_prefix support for java * formatting fixes * Revert "include_prefix support for java" * style fix
2020-12-17[Swift] Rebuild the way swift handles structs from scratch (#6326)mustiikhalil21-718/+1049
* Rebuild the way swift handles structs from scratch * Updates docs, and sample binary * Replaces InMemory to Mutable * Migrates docs from inmemory * use inline for some functions * Renamed Mutable objects * Updates documentation
2020-12-17Fix typos in usage/comments; Make rust generator respect to --filenam… (#6342)mqy3-6/+7
* Fix typos in usage/comments; Make rust generator respect to --filename-suffix * run clang format
2020-12-17Renaming infinity variables in test.cpp (#6340)Kjetil Østerås1-26/+26
The infinityf symbol is causing a conflict when building for cygwin. In the cygwin math.h header there is also a symbol called infinityf. So this patch is needed to be able to build the flatbuffer tests in a cygwin environment.
2020-12-14Add vectorNumElements attribute to Builder for simpler vector creation. (#6328)Richard A Hofer7-64/+61
* Add vectorNumElements attribute to Builder for simpler vector creation. This adds a default to EndVector which should simplify its use. * Update tutorial to reflect new default arg in Python EndVector. * Remove optional argument to Python EndVector. * Add generated files. * Unset Builder.vectorNumElems when not in use.
2020-12-11[CI] Adds formatter to CI (#6272)mustiikhalil4-0/+154
* Adds formatters CI Adds Error message & setup formatting like cpp Adds Swift Adds typescript Adds python tests yarn Adds format.md * Removes unneeded scripts + moves install script to install phase * Adds format.md content * Adds cpp to the formatter.md and fixes ci * Adds cpp to formatter ci
2020-12-11Fix Max CI build path (#6333)Wouter van Oortmerssen1-4/+5
apparently the default xcodebuild path of ./build clashes with the BUILD file present (case insensitive file system?)
2020-12-10Generate nullable properties in C# object-based API for optional scalars. ↵Stefan F4-2/+176
(without -gen-mutable) (#6273) * Added missing EndTable() call to VerifyObject() VerifyObject called VerifyTableStart() but not EndTable(). This made Verifier::VerifyComplexity() increase depth_ with each table, not with the depth of tables. https://groups.google.com/forum/#!topic/flatbuffers/OpxtW5UFAdg * Added Check to VerifyAlignment https://stackoverflow.com/questions/59376308/flatbuffers-verifier-returns-false-without-any-assertion-flatbuffers-debug-veri * Add GetStringView (Convenience function to get string_view from a String returning an empty string_view on null pointer) like GetString, GetCstring * flatc should warn, when an attribute is attached more than once. flatc.exe -b duplicate.fbs warning: duplicate.fbs(5, 36): warning: attribute already found: priority duplicate.fbs: namespace MyGame; attribute "priority"; table Monster (priority:1, priority:2) { } root_type Monster; * flatc should support --binary --schema with optional scalar fields. This fixes 'error: Optional scalars are not yet supported in at least one the of the specified programming languages.' when calling flatc.exe --binary --schema with a schema containing optional scalars. * Generate nullable properties in C# object-based API for optional scalars. tests\generate_code.bat extended to test this. Ran tests\generate_code.bat Ran tests\Flatbuffers.Test\NetTest.bat * %TEST_BASE_FLAGS% replaced with --gen-object-api in generate_code.bat, because only this is part of this PR. Added this same flag to generate_code.sh * generate_code.bat and generate_code.sh changed to only test c# with object based api.
2020-12-10[Python] Commit some orphan python genfile diffs. (#6325)David P. Sicilia13-13/+13