GithubHelp home page GithubHelp logo

flatbuffers-net's People

Contributors

evolutional avatar jbrads avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

flatbuffers-net's Issues

"original_order" attribute

Add support for the original_order attribute from the fbs schema. This forces the table serializer to handle fields in the order they were specified in and not size ordered.

Allow user-specified Field/Type names overrides

When emitting a schema from a .NET type, we may wish to specify a user-defined name for a type or field. This can aid in resolving conflicts between similarly named types to provide a 'public' name for the fbs schema whilst being allowed to change the private code-side name.

Test inherited classes

Root issue #19

Create tests to verify that classes with inheritance will reflect and serialize/deserialize correctly.

User-specified field ordering

Allow users to annotate their C# contracts with an attribute that dictates the field ordering. This performs the a similar role as the id attribute in the fbs schema

eg:

table Something {
   x:float (id: 1);
   y:float (id: 0);
}

Allow struct/class type overload

Allow a .NET struct/class to be serialized as a table/struct. The default behaviour will serialize a struct as a struct and a class as a table.

We will want per type overrides, so it makes sense for this to be an attribute.

Benchmarking

Run a benchmark of the serializer/deserailizer routines to build a comparison of the performance between this library and the canonical flatc generated API

Documentation & Examples

Create a rich set of documentation to detail the features of this project. Currently the README and unit tests are the only documentation. A goal would be to achieve either wiki-based documentation or a Github Pages portal with the various docs in it

Ignore field attribute

Add support for an attribute to allow users to ignore fields on their types during reflection. This will allow fields to exist on a type that are skipped by any flatbuffers operations.

Schema dependencies and ordering

When writing the schema, we need to determine a map of dependencies and emit the fragments in the correct order. This will ensure that flatc can parse the schema correctly.

"key" attribute support

To quote the fbs schema doc:

key (on a field): this field is meant to be used as a key when sorting a vector of the type of table it sits in. Can be used for in-place binary search.

"enum" determine correct base size from values

Enums currently default to int as their underlying type, which means they will take 32-bits by default.

public MyEnum
{
    Etc,
}

The reflection routine should automatically determine the correct size based on the max value (in this case, 8 bits).

Handle CanRead/CanWrite on field/properties

Currently we assume that all properties are both readable and writable. We may need to boil this up the the struct definition to say if the type can be serialized/deserialized

For example if all properties are writable, it can be deserialized, if all properties are readable it can be serialized. If some can't be read/write then the type cannot be serialized at all

Default value support

Add default value support to the TypeModel.
Allow the user to specify the default value of a table field with an attribute.
Use the default value in the serialization process (eg: skip fields that equal default value when serializing, use default value to deserialize missing fields)

Namespace Support

We need a way of providing namespace support. This would affect type name resolution during reflection and the writing of the fbs schema

Tables containing other table fails to serialize

There's currently a bug wherein a table that references another table will fail to serialize.

eg:

    public class Inner
    {
        public bool Prop { get; set;
    }

    public class Outer
    {
        public Inner TableProp { get; set; }
    }

It fails with a NotSupportedException during serialization, whether the field is null or not.

Increase testing

Increase testing over specific scenarios.

  • Lists of structs
  • Lists of tables
  • Lists of enums
  • Tables referencing shared objects (vectors, strings, etc)

etc

Schema Comments

Whilst it's not possible to pick up comments from source, we can add a FlatBuffersCommentAttribute to allow users to annotate types (struct, table, union, enum) and fields. These comments would be written into the schema file.

Schema Writer options

Add support for user options in the schema writer.

  • spaces or tabs
  • indent size
  • Java-style bracing

"bit_flags" support on enum

From the docs:

bit_flags (on an enum): the values of this field indicate bits, meaning that any value N specified in the schema will end up representing 1<<N, or if you don't specify values at all, you'll get the sequence 1, 2, 4, 8, ...

We need to handle this somehow. Ideally, it should be the [Flags] attribute, but doing so requires explicit setting of the enum values in .NET (eg: they're still sequential). Perhaps this is adequate and have a runtime check to verify?

User-specified attributes

Allow the specification of user attributes. This will predominantly support the emitting of them on the fbs schema files

"force_align" attribute

From the fbs schema doc "force the alignment of this struct to be something higher than what it is naturally aligned to"

"root_type" attribute

Support the root_type attribute from the fbs schema. Determine if it has an impact on the serializer, or primarily on the schema writer

File extension

Decide how we want to handle fbs attributes such as file_identifier and file_extension. We may wish to provide serialization functions to create buffer 'files'.

IEnumerable serialization / deserialization

Investigate a strategy to serialize IEnumerable types. FlatBuffers currently requires knowledge of the vector item count up front for padding purposes.

It should be possible to modify the FlatBufferBuilder type in the base flatbuffers project to support writing of vectors without knowledge of the count until the end, however this would need to be pushed into the main google project first.

It may be possible to implement this functionality as an extension method, too.

Create specific exceptions for the Serializer

Create a specific set of FlatBuffersSerializationException based exceptions for the serialization/deserialization process. This allows users to better diagnose and handle errors.

"include" support in schema files

Add support for include in the schema writer. This will require some consideration on how schema fragments are packaged into modules and how modules interact.

FlatBuffer Verifier

In the C++ version of google/flatbuffers there is the ability to verify the integrity of a buffer. This would be a useful utility to implement here.

"union" support

Decide how union should be supported in the schema writer / serializer. In fbs this is essentially an enum which identifies the type of a blob of data in flatbuffer format.

Add Serialization to a Stream

Not a true stream serializer, as flatbuffers needs a full buffer - but we should add helpers to write the buffers to a Stream.

This would allow the quick creation of a buffer and dumping to a stream.

Ideally we should allow reading from a stream, but this may require some thought as FB isn't really a streamable format.

Testing: Monster Example

The library should be capable of reading the canonical 'Monster' test buffer. Create tests and objects to show this.

Allow 'Lock' on TypeModelRegistry

TypeModels are currently created on the fly when a new type is discovered. There are situations where we don't want to allow this and should throw when this happens. This is applicable to scenarios where we want to handle our initialization in one place and not ad-hoc.

Create "FlatBuffersConvert" helpers

Json.Net has JsonConvert helpers which wrap the boilerplate serializer setup. It's useful for people wanting to quickly use the serializer with no config. We should add similar functionality.

"required" attribute on fields

Provide support for the required attribute from the fbs schema. Throw exceptions when serializing a table which has no data for this field.

Test use of fields

Root issue #19

Increase testing of structs/classes that use fields not properties. This includes the use of default values.

Detect and handle circular dependencies

Circular dependencies between types aren't handled correctly in the schema handling process. The correct behaviour is to detect them and throw a user exception.

"nested_flatbuffer" attribute support

Add support for "nested_flatbuffer".

Likely won't be applied to byte[] fields as per the fbs schema, but more likely a field of object type and the attribute will instruct how to serialize the type.

fbs for BCL types

There are several BCL types in common use (eg: DateTime, TimeSpan, etc). Created a bcl.fbs schema for these types in a similar way that Marc Gravell did in Protobuf-net

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.