Commit Graph

2802 Commits

Author SHA1 Message Date
Derek Bailey 3b2ced0131 Update missing C# namespace to Google.FlatBuffers 2022-12-01 20:04:49 -08:00
Michael Le 00af4e23b3
Remove --gen-name-strings flag from cmake command for generating union_vector_generated.h (#7684)
* Sync make outputs with master

* Remove --gen-name-string flag from CMAKE
2022-11-30 20:57:06 -08:00
Sergei Trofimovich 7e00b754f0
tests/reflection_test.h: add missing <stdint.h> include (#7680)
Without the change build fails on weekly `gcc-13` snapshots as:

    In file included from /build/flatbuffers/tests/reflection_test.cpp:1:
    tests/reflection_test.h:9:57: error: 'uint8_t' has not been declared
        9 | void ReflectionTest(const std::string& tests_data_path, uint8_t *flatbuf, size_t length);
          |                                                         ^~~~~~~
2022-11-30 18:47:10 -08:00
Louis Laugesen cf89d1e756
Fix PHP byte validation and reenable builds (#7670)
* Fix PHP byte validation and reenable builds

* Use checkout@v3

Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-11-29 08:12:28 -08:00
sssooonnnggg ad6054c600
chore: emit more reasonable error message when using incomplete type in struct (#7678)
Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-11-29 04:59:53 +00:00
Michael Le c3a01c7228
Use FinshedBytes() in go-echo example instead of manually encoding offset (#7660)
Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-11-29 02:29:48 +00:00
Saman 533f75d91b
Fix java import wild card (#7672)
* Fix java import wild card

* fix java include

* Fix some import problems

* clang-format

* Sort imports

Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-11-28 17:27:55 -08:00
Derek Bailey fcab80f1bb
`build.yml`: MacOs Build Inplace (#7677)
* `build.yml`: MacOs Build Inplace

* Update build.yml
2022-11-28 16:38:56 -08:00
Derek Bailey 5d2d0b92b1
`build.yml` Update dependencies (#7674)
* `build.yml` Update dependencies

* Update build.yml

* Update build.yml

* `build.yml`: Use macos-11

* Update build.yml
2022-11-28 15:34:32 -08:00
Derek Bailey ae6662374d
add buildkite badge 2022-11-23 13:11:56 -08:00
Casper 7b6c9f4a3c
Rurel (#7663)
* Update release script to update Rust version (it still needs to be published after)

* Also update rust while I'm at it

Co-authored-by: Casper Neo <cneo@google.com>
2022-11-23 12:03:54 -08:00
Derek Bailey 5a42b2c76c Specify min android SDK version of 14 2022-11-23 11:54:36 -08:00
Derek Bailey 8f625561d0
FlatBuffers Version 22.11.23 (#7662) 2022-11-23 11:32:19 -08:00
Derek Bailey 9d2c04d629 FlatBuffers Version 22.11.22 2022-11-22 14:40:01 -08:00
Michael Le e000458bb1
Add --go-module-name flag to support generating Go module compatible code (#7651)
* Add --go-module-name flag to support generating code for go modules

* Rename echo example folder

* Grammar

* Update readme for go-echo example

* Update readme for go-echo example

* Re-enable go modules after test is done
2022-11-22 14:28:01 -08:00
Michael Le 60975d6f7e
Add key lookup support for tables in Go (#7644)
* Add support for key lookup for tables in Go

* Run clang format

* Run go fmt on tests

* Remove TODO in tests

* Update LookupByKey API

* Update LookupByKey API

* Don't use resolvePointer in expectEq

* Use generated getters instead of reading values directly from buffer

* Fix typo

Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-11-22 14:08:19 -08:00
Saman 1cba8b2b49
Fix go generator undefined Package name, also throwing exception (#7632)
* Fix go generator undefined Package, also throw exception in specific examples.

* Add test for go generator import problem

* Add new version of generated go file. Fix conflict.

* Add executable permission to generate_code.py script.

* Improve test quality, remove unwanted generated files, better naming

* Fix comments

* clang format

Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-11-22 13:21:25 -08:00
TJKoury eead6c6219
updated method call (#7642) 2022-11-22 13:01:32 -08:00
Alex Ames bb9b9dad5f
Fixed the BytesConsumed function, which was pointing slightly ahead. (#7657)
The BytesConsumed function uses the `cursor_` to determine how many
bytes have been consumed by the parser, in case the user of the Parser
object wants to step over the parsed flatbuffer that is embedded in some
larger string. However, the `cursor_` is always one token ahead, so that
it can determine how to consume it. It points at the token that is about
to be consumed, which is ahead of the last byte consumed.

For example, if you had a string containing these two json objects and
parsed them...

    "{\"key\":\"value\"},{\"key\":\"value\"}"

...then the `cursor_` would be pointing at the comma between the two
tables. If you were to hold a pointer to the beginning of the string and
add `BytesConsumed()` to it like so:

    const char* json = // ...
    parser.ParseJson(json);
    json += parser.BytesConsumed();

then the pointer would skip over the comma, which is not the expected
behavior. It should only consume the table itself.

The solution is simple: Just hold onto a previous cursor location and
use that for the `BytesConsumed()` call. The previous cursor location
just needs to be set to the cursor_ location each time the cursor_ is
about to be updated. This will result in `BytesConsumed()` returning
the correct number of bytes without the off-by-one-token error.

Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-11-22 20:11:14 +00:00
tira-misu ade9e19be0
[C#] Fix collision of member if union name is "Value" (#7648)
* 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 (#6955)

* [TS] Fix generation of reserved words in object api (#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

* [C#] Fix collision of member if enum name is "Value"

* Fix due to style guide

Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-11-22 20:00:13 +00:00
Wen Sun eb1abb51ea
Add support for using array of scalar as key field in Cpp (#7623)
* add support for using array of scalar as key field

* update cmakelist and test.cpp to include the tests

* update bazel rule

* address comments

* clang format

* delete comment

* delete comment

* address the rest of the commnets

* address comments

* update naming in test file

* format build file

* buildifier

* make keycomparelessthan call keycomparewithvalue

* update to use flatbuffer array instead of raw pointer

* clang

* format

* revert format

* revert format

* update

* run generate_code.py

* run code generator

* revert changes by generate_code.py

* fist run make flatc and then run generate_code.py

Co-authored-by: Wen Sun <sunwen@google.com>
2022-11-18 11:04:46 -08:00
Saman 1fa6091000
Fix schema to binary test, when build and run from all directories. specially when add to other projects. (#7650) 2022-11-17 20:24:48 -08:00
tira-misu 634c2ee7e3
Put documentation to bfbs if it is not empty (#7649)
* 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 (#6955)

* [TS] Fix generation of reserved words in object api (#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?
2022-11-17 15:55:42 -08:00
Derek Bailey 6f895f54c2 Add _deps/ to gitignore 2022-11-13 12:00:07 -08:00
Gh0u1L5 41d6903294
[Go] Fix GenNativeUnionUnPack for imported union type. (#7579)
* Fix GenNativeUnionUnPack for imported union type.

* Update test results.

Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-11-13 11:52:02 -08:00
Saman 7b038e3277
Fix import problem in dart generated files. (fixes #7609). (#7621)
* Fix import problem in dart generated files. (fixes #7609).

* Fix naming.

* Fix minor changes in generated files.

* Add some tests. Fix minor problems.

* Fix minor format problem plus import alias issue.

* Minor fix in dart code generator, remove java from examples

* remove java and go generated files

* Fix dart tests.

* Fix spell problem.

* Remove excessive tests :))

Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-11-13 19:21:57 +00:00
mr-swifter 74756e5d1b
[swift] fix broken swift test build (#7633) (#7634)
* [swift] fix broken swift test build (#7633)

* [swift] fix unused variable (#7633)

* [swift] update generated code (#7633)

* [swift] add binary & json test for nan, inf, -inf for swift (#7633)

* [swift] use just '.infinity' instead of '+.infinity' (#7633)

* [swift] remove commented code (#7633)

Co-authored-by: Derek Bailey <derekbailey@google.com>
Co-authored-by: mustiikhalil <26250654+mustiikhalil@users.noreply.github.com>
2022-11-11 18:36:47 +01:00
RishabhDeep Singh 879622fc57
Fixes #7345 to add the option to minify enums (#7566)
* Added cpp minified enums

* Update generated files

* remove initializer and fix comma

* Fix .gitignore

* Fix comma

* Add tests for cpp minify enums
2022-11-11 04:47:28 +00:00
M. Şamil Ateşoğlu 83e7a98f69
[C++] Minireflect: Add option to indent when converting table to string (#7602)
Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-11-11 02:57:29 +00:00
Alex-Ratcliffe f20b0a45b3
Add comparison operator to python objects under --gen-compare option (#7610)
* Add comparison operator to python code generator

* Missing semi-colon

* Regenerate test examples

Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-11-11 02:47:53 +00:00
Rudi Heitbaum 207708efef
[CMake]: only warn when the working directory in a git worktree (#7562)
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-11-11 02:21:38 +00:00
laurentsimon 225578a8b3
Temporary fix for SLSA generators (#7636)
* Temporary fix for SLSA generators

Sigstore made a breaking change as part of their recent GA announcement. We need a temporary fix to avoid builder failure (see slsa-framework/slsa-github-generator#1163)

/cc @asraa

* Update build.yml
2022-11-10 20:09:01 -06:00
mustiikhalil 459e8acc37
Uses swift build command directly in the CI (#7635) 2022-11-10 14:16:42 -08:00
James Kuszmaul 8aa8b9139e
Fix handling of +/-inf defaults in TS/rust/go/dart codegen (#7588)
+/-inf were not being handled, and so invalid typescript was being
generated when a float/double had an infinite default value. NaN was
being handled correctly.

Co-authored-by: Derek Bailey <derekbailey@google.com>
Co-authored-by: Casper <casperneo@uchicago.edu>
2022-11-08 10:59:46 -08:00
Michael Le 001adf782d
Add support for parsing proto map fields (#7613)
* Add support for proto 3 map to fbs gen

* Run clang-format

* Update proto golden test

* Rename variables

* Remove iostream

* Remove iostream

* Run clang format

Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-11-08 10:51:24 -08:00
Ben Beasley dbc58ab77c
Fix help output for --gen-includes (#7611)
Fixes the --help output documenting the deprecated --gen-includes
option, in which the option name contained a typo (--gen-inclues).
2022-11-08 18:16:17 +00:00
Ben Beasley 2facfeec7e
Fix missing spaces in flatc help text (#7612)
* Fix error in --json-nested-bytes help text

Correct “bytesin” to “bytes in”

* Fix missing space in --no-leak-private-annotation help text
2022-11-08 17:59:48 +00:00
刘帅 4de2814c7b
Fix: arduino platform build (#7625) 2022-11-08 09:53:53 -08:00
Valeriy Van 37b1acdaff
Fix current official name of macOS (#7627)
Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-11-08 09:49:27 -08:00
Even Rouault a22434e2a1
Add missing #include <algorithm> for std::min/std::max uses, and #include <limits> for std::numeric_limits<> (#7624) 2022-11-08 09:36:35 -08:00
Casper 214cc94681
Bump Rust version to 22.10.26 before publication (#7622) 2022-11-03 16:24:00 +00:00
Alex Ames a4ff275d9b
Added option to not requires an EoF token when parsing JSON (#7620)
Previously when parsing a JSON representation of a Flatbuffer, the
parser required that the input string contain one and only one root
table. This change adds a flag that removes that requirement, so that
if a Flatbuffer table is embedded in some larger string the parser will
simply stop parsing once it reaches the end of the root table, and does
not validate that it has reached the end of the string.

This change also adds a BytesConsumed function, which returns the number
of bytes the parser consumed. This is useful if the table embedded in
some larger string that is being parsed, and that outer parser needs to
know how many bytes the table was so that it can step over it.
2022-11-03 11:57:46 -04:00
inaryart 15f32c6907
python: object generation prefix and suffix (#7565)
Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-10-29 00:37:27 +00:00
Michael Le 051afd8825
Add CreateSharedString to python builder (#7608)
Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-10-29 00:28:35 +00:00
Alejandro Ramallo 728c033ad6
Add check for presence of realpath to CMakeLists.txt to support more platforms (#7603)
* add automatic check for realpath in CMakeLists

* added win32 check

Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-10-29 00:23:36 +00:00
Michael Le 4c514483d8
Update DartTest.sh golden files (#7606) 2022-10-29 00:15:14 +00:00
Bulent Vural c2d9c20803
[TS] Add support for fixed length arrays on Typescript (#5864) (#7021) (#7581)
* [TS] Add support for fixed length arrays on Typescript (#5864) (#7021)

    * Typescript / Javascript don't have fixed arrays but it is important to support these languages for compatibility.

    * Generated TS code checks the length of the given array and do truncating / padding to conform to the schema.

    * Supports the both standard API and Object Based API.

    * Added a test.

    Co-authored-by: Mehmet Baker <mehmet.baker@zerodensity.tv>
    Signed-off-by: Bulent Vural <bulent.vural@zerodensity.tv>

Signed-off-by: Bülent Vural <bulent.vural@zerodensity.tv>

* Formatting & readability fixes on idl_gen_ts.cpp

Signed-off-by: Bülent Vural <bulent.vural@zerodensity.tv>

* Added array_test_complex.bfbs

Signed-off-by: Bülent Vural <bulent.vural@zerodensity.tv>

* TS arrays_test_complex: Remove bfbs and use  fbs directly

Signed-off-by: Bülent Vural <bulent.vural@zerodensity.tv>

Signed-off-by: Bülent Vural <bulent.vural@zerodensity.tv>
2022-10-28 17:00:24 -07:00
Derek Bailey e34ae4c6b6
`build.yml`: Fix missing 'v' in version 2022-10-27 16:14:26 -07:00
Derek Bailey e54536127c
`build.yml` Update to Kotlin Wrapper 1.0.5 2022-10-27 13:55:41 -07:00
Derek Bailey 49d9f941c0
`release.yml` Use env var for passphrase 2022-10-26 22:50:05 -07:00