The documentation is compiled from the markdown sources to html using
`pandoc`. In order to install `pandoc` run:
cabal install pandoc
The documentation build is optional and if `pandoc` is not found during
cmake project configuration the documentation build is skipped.
File(s) with the `.json` extension are assumed to contain the JSON
representation of schema abstract syntax tree in the format produced by
`gbc schema`
The Generic instance is needed only to derive generic implementations of
FromJSON and ToJSON typeclasses so we move the declarations to
Schema/JSON.hs and only derive Generic for data types that need it.
Derived show typeclass for schema types in order to support QuickCheck.
Added custom ShowPretty typeclass for printing Declarations in parser
error messages. Implemented custom JSON parsing for types that had
custom JSON serialization.
The schema AST is written in JSON format. We foresee two classes of
scenarios that will use it.
Tools that need to process Bond schema files using languages other than
Haskell can avoid recreating Bond parser. Example might be schema
repositories, lints, etc.
The schema AST will also be used to allow users to inject schema
transformations into codegen process. This in many cases can be a
lightweight alternative to custom codegen.
When reading string fields, the SimpleJsonParser expects to find a JsonToken of
type String. But if the string value matches a date format, the actual JsonToken
that is seen is of type Date. To fix this, we are setting the JsonTextReader to not
try to parse strings as dates.
Also improve the exception text when reading unenxpected input to help know
what JsonToken was actually read, and fix a similar possible issue with parsing
doubles.
By default the Bond.CSharp.targets will run 2 fewer concurrent jobs than
there are processor cores on the machine. User can override this
behaviour for their project by specifying a different `--jobs` option in
`BondOptions` property.
In some scenarios the hierarchy of schemas may be very interconnected
and redundant parsing of the same imported files is a huge performance
overhead for code generation (this change showed 20x improvement when
compiling a sample set of ~900 interconnected schemas).
When compiling multiple .bond files at once, the `--jobs=[NUM]` command
line option can be used to specify how many jobs should be run
concurrently. When used without arguments, the default is to run as many
jobs as there are processors. The option also accepts negative numbers
to specify fewer jobs than the number of processors. Often the optimal
performance is achieved by leaving one or more cores for other processes
on the machine.
Unit tests take a long time to run in CI. Building all tests with
--collection-interfaces flag is somewhat wasteful because a lot of tests
don't use collections at all. Furthermore this way we only tested
collection interfaces together with properties. This change removes the
separate test configuration for --collection-interfaces and instead uses
concrete/interface collection alternatively for different .bond files in
Fields/Properties configuration. This way every schema is tested with
both interfaces and concrete collections and both are also tested with
fields and properties. This gives better coverage while eliminating
redundant identical tests in different assemblies.
When bonded<T> is serialized to untagged protocols like Simple Binary
it is first marshaled into a separate buffer using a tagged protocol and
then written as length prefixed blob to the untagged protocol.
OutputBuffer used for marshaling by default allocates 64KB which is
costly if the bonded<T> payload is small.