Commit Graph

2098 Commits

Author SHA1 Message Date
Wouter van Oortmerssen bc518a5127 Fixed FlexBufferBuilder asserting on duplicate keys 2020-11-23 09:02:40 -08:00
Derek Bailey 100c59054c
Added a few more paths for auto labeler (#6281) 2020-11-19 22:13:19 -08:00
Austin Schuh e58c182443
Add --require-explicit-ids to require explicit ids (#6277)
* Add --require-explicit-ids to require explicit ids

We just got bit by a well intentioned developer forgetting that field
order by default is the field index.  3 people missed it in review.

I'm looking at ways to make it harder to mess up.  We are requesting
that developers explicitly id all fields in tables.  Automatic (opt in
for others) enforcement of this will help the effort succeed.  This
patch adds a command line flag which lets the user require ids on all
fields in tables.

* Added docs to Compiler.md as well
2020-11-19 17:16:45 -08:00
schoetbi 69a8b2a579
idl_gen_json_schema.cpp: Changed generation of array element types (#6253)
* idl_gen_json_schema.cpp: Changed generation of array element types
#6175

* idl_gen_json_schema.cpp: Simplified indent generation as suggested by @vglavnyy
#6175
2020-11-19 16:17:03 -08:00
Kelvin Hu 25eba6f35f
fix typo (#6280) 2020-11-19 09:08:52 -08:00
Derek Bailey e1f0f75ba6
Updated Ms build Action to fix build issue (#6279) 2020-11-19 00:20:47 -08:00
James Kuszmaul faeb04fbe1
Add type annotation to unspecified array (#6264)
The lack of any type on the `ret` variable was causing our typescript compiler to complain.
2020-11-16 10:49:53 -08:00
mustiikhalil 537212afee
[Swift] Adds a format file and reformats the swift project (#6250)
* Formats files & adds licence

* Revert arrays

* Keeps array indentation as is

* Adds licence to code formatter

* Updates code generators
2020-11-16 19:52:38 +03:00
mustiikhalil 6764f25d91
Adds a fix for enum generation (#6263) 2020-11-15 17:50:12 +03:00
AdamKorcz d6a8dbd26f
Experimental fix for failing oss-fuzz coverage build (#6259) 2020-11-13 15:48:05 -08:00
Casper ed391e1777
BREAKING: Rust flexbuffers serde human readable set to false (#6257)
Co-authored-by: Casper Neo <cneo@google.com>
2020-11-13 07:53:01 -08:00
AdamKorcz a49531414b
Update to flags in fuzzing-cmake file (#6256) 2020-11-12 10:21:34 -08:00
Jason Lenz de1f0342c8
Remove _POSIX_C_SOURCE and _XOPEN_SOURCE definitions when compiling o… (#6205)
* Remove _POSIX_C_SOURCE and _XOPEN_SOURCE definitions when compiling on OpenBSD

* Only define _POSIX_C_SOURCE and _XOPEN_SOURCE for mingw/cygwin platforms

* Only define POSIX statements for mingw/cygwin/qnx platforms
2020-11-12 10:12:32 -08:00
Stefan F d0d51e2a5c
flatc should support --binary --schema with optional scalar fields. (#6252)
* 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.
2020-11-12 10:06:09 -08:00
Ivo List 33ab26017d
Bump version of rules_go to 0.24.5 (#6234)
Versions of rules_go below 0.24 include platforms repository, which are lacking
definitions of os:macos, cpu:arm64 constraints.

This definitions are needed to properly select toolchains in latest
bazel.
2020-11-12 10:04:34 -08:00
Derek Bailey febb9d87c9
Union As Accessors for C# (#6251)
* Union As Accessors for C#

* Changed loop to be compatible with older compilers

* errant change fix
2020-11-12 09:28:21 -08:00
mustiikhalil 8778dc7c2b
Resets buffer without deallocating current pointer (#6247)
Resets buffer without deallocating current pointer & Bumps version
2020-11-09 17:55:53 +03:00
OptoCloud aae376e9a8
Add GetBufferSpan() function to bufferbuilder (#6235)
This will return the finished internal buffer data as a span
2020-11-05 18:09:01 -08:00
Paulo Pinheiro 0ff0471488
Modernize android build and sample (#6229)
Android build was dated, using the Android.mk approach. Current
project configuration on Android encourages the usage of CMake, so we
are updating the android project as an example on how to use either the
Java/Kotlin generate code or the native C++ one.
2020-11-05 14:23:37 -08:00
Casper 46a8c7e958
Added required-nested-flatbuffer to monster_test and fixed rust (#6236)
Co-authored-by: Casper Neo <cneo@google.com>
2020-11-05 13:58:06 -08:00
Derek Bailey bc56c553ec
Notify based on Labelling issues and PR (#6241) 2020-11-05 13:40:01 -08:00
Derek Bailey 07d7cd78a7
Converted globs to use single quotes (#6240) 2020-11-05 13:12:19 -08:00
Derek Bailey cdef70e246
More adjustments to the auto labeler (#6239) 2020-11-05 13:02:33 -08:00
Derek Bailey 9dd44df35c
Updated Lua labeller glob (#6238) 2020-11-05 12:50:33 -08:00
Charlie Yin c9b29d0885
Support size-prefixed buffers and add tests for size-prefixed messages (#6232) 2020-11-05 11:23:56 -08:00
mustiikhalil fba93e0abb
Removes duplicate swift in labeler (#6228)
Removed grpc tag from swift label set & removes duplicate swift label
2020-10-31 18:35:44 +03:00
Derek Bailey d1a545b1fb
Added more labels for auto labeler (#6227) 2020-10-30 14:01:35 -07:00
Derek Bailey ea92a668d8
[C#] Optional Scalars (#6217)
* [C#] Optional Scalars

* Moved scalar optional check to avoid null enum conversion
2020-10-30 13:18:59 -07:00
Paulo Pinheiro 6034de286a
[Label Bot] Add Java and Kotlin support for the label bot (#6226)
CI is an unrelated timeout.
2020-10-30 13:18:36 -07:00
Casper b08b0a4402
Implement `Debug` trait for Rust flatbuffers. (#6207)
* Refactor idl_gen_rust to a ForAllX continuation pattern.

* Removed unneeded SetValue and updated sample rust gencode

* Make Rust flatbuffers print right

* Generated code and removed unnecessary trait constraint

* bumped rust version. Release required

* removed an unwrap in Rust Debug-print unions

* Tested formatting flatbuffers in rust.

* Set float precision in flaky debug-print test

* impl Debug for structs too

Co-authored-by: Casper Neo <cneo@google.com>
2020-10-29 12:57:29 -07:00
mustiikhalil 17ae48decc
[Label Bot] Adds some languages to labeler bot (#6222)
* Adds swift, ts, go, py to labeler bot

* Removes unneeded dir search
2020-10-29 09:05:25 +03:00
Derek Bailey fc80979253
Auto Labeler Setup, Just C# for now (#6221) 2020-10-28 22:02:32 -07:00
Derek Bailey 55658f523a
Auto Labeler Setup, Just C# for now (#6218)
* Auto Labeler Setup, Just C# for now

* Removed trailer comma as that might caused the issue

* Removed any[].

* Changed .cs glob
2020-10-28 21:25:02 -07:00
Casper 14ecfe4236
Updated comments and fixed a fundamental type error. (#6214)
* Updated comments and fixed a fundemental type error.

* bump rust flatbuffers semver

Co-authored-by: Casper Neo <cneo@google.com>
2020-10-28 19:23:22 -07:00
Kamil Rojewski a0182cdb11
optional scalars for ts/js (#6215)
* optional scalars for ts/js

* removed range based for

* removed range based for
2020-10-28 09:45:23 -07:00
Derek Bailey 0dfcc0a378
Adds NetTest.bat to run .NET Core tests on Windows (#6216) 2020-10-27 22:51:58 -07:00
Paulo Pinheiro f9a18ea635
[Java] Implement optional scalars (#6212)
Java implementation of optional scalars, following issue #6014.
2020-10-26 17:46:50 -07:00
mustiikhalil c7586e85aa
Empties the sharedString map on reset on go and csharp (#6187)
Fixes go tests
2020-10-26 12:38:24 -07:00
Derek Bailey 914c646014
Removed C# references from java generator. Move annotations closer to definitions (#6204) 2020-10-25 21:42:29 -07:00
mustiikhalil 42d7c79977
Adds readable size to asserts in read functions (#6210) 2020-10-25 15:59:30 +03:00
Casper e68e8d7de9
Refactor idl_gen_rust (#6206)
* Refactor idl_gen_rust to a ForAllX continuation pattern.
* Updated rust sample code

Co-authored-by: Casper Neo <cneo@google.com>
2020-10-24 15:46:55 -07:00
Vladimir Glavnyy 84809be7e7
Fix typo in flatbuffers::span declaration. (#6202) 2020-10-22 14:07:29 -07:00
Paulo Pinheiro 1606fb6375
Kotlin test optional enum (#6201)
* Add test for optional enums in Kotlin

* Rename optional_scalars2.fbs into optional_scalars.fbs

Also updated all references in the project to point to
"optional_scalars.fbs" instead of "optional_scalars2.fbs".
2020-10-22 13:36:02 -07:00
Casper fe8e3c7e5d
Mass Refactoring to use `IsString` and other BASE_TYPE helpers (#6193)
* Updated SupportsAdvancedUnionFeatures to look out for string

* Mass refactoring to use BASE_TYPE helper functions.

Co-authored-by: Casper Neo <cneo@google.com>
2020-10-20 08:00:31 -07:00
Casper 8f6fa4b715
Updated SupportsAdvancedUnionFeatures to look out for string (#6190)
Co-authored-by: Casper Neo <cneo@google.com>
2020-10-19 13:16:00 -07:00
Björn Harrtell b46db38f57
[JS/TS] Rewrite flexbuffers JS to TS (#6148)
* Partial TS rewrite

* Completed port but bugs remain

* Expose builder function

* Break out and fix stack-value and formatting
2020-10-19 13:11:35 -07:00
Casper 9fa1d27059
Rework enums in rust. (#6098)
* Rework enums in rust.

They're now a unit struct, rather than an enum. This is a
backwards incompatible change but the previous version had UB
and was also backwards incompatible so...

* Update and test sample rust flatbuffers

* Use bitflags crate to properly support rust enums.

Previously, the bitflags attribute was just ignored. This is a breaking change
as the bitflgs API is not like a normal rust enum (duh).

* variant_name() -> Option<_>

* repr transparent

* Reexport bitflags from flatbuffers

* Make bitflags constants CamelCase, matching normal enums

* Deprecate c-style associated enum constants

Co-authored-by: Casper Neo <cneo@google.com>
2020-10-19 11:40:03 -07:00
schoetbi a402b3abae
idl_gen_json_schema Fix generation of arrays of enums (#6184)
* idl_gen_json_schema.cpp: Fixed generation of arrays of enums
#6175

* Fixed failing unit tests

* GenBaseType generate "integer".
Fixes #6066

* Ran tests/generate_code.

* Removed modern R"()" strings

* changed std::to_string to NumToString
2020-10-16 10:43:09 -07:00
Niels Hofmans 0e1415b996
fix(go_test): remove deprecated grpc call (#6183) 2020-10-15 15:47:06 -07:00
tira-misu 5cd7137103
Add generation of JSON Schema to library (#6165)
* 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
2020-10-15 15:28:25 -07:00