v0.8.0
Pre-release-
Require @bare-ts/lib v0.3.x
-
Automatically promote root type aliases as main type aliases
@bare-ts/tool generates encoders and decoders for main type aliases.
Main type aliases can be selected with the option--main
:bare-ts compile schema.bare --main Post
# schema.bare type Person struct { name: str } type Post struct { author: Person }
If the option
--main
is not set, then @bare-ts/tool promotes now
root type aliases as main type aliases. Root type aliases are type aliases
that are not referred by a type in the schema.In the previous schema,
Post
is a root type alias, whilePerson
is not.
The following command has now the same effect as the previous one:bare-ts compile schema.bare
It promotes
Post
as a main type aliases.To avoid the promotion of root types, you must use the option
--no-main
:bare-ts compile schema.bare --no-main
--no-main
and--main
cannot be both set. -
BREAKING CHANGES: forbid f32 and f64 as map key type
According to IEEE-754 2019:
NaN (Not a Number) is not equal to any value, including itself.This inequality leads to different implementations:
-
Implementations that "follows" the standard
In this case, an unbounded number of values may be bind to the key NaN
and cannot be accessed.This is the implementation chosen by Golang.
-
Implementations that normalize NaNs and consider that NaN
is equal to itselfThis is the implementation chosen by JavaScript
-
Implementations that rely on the binary comparison of NaNs
This makes complex the support of f32 and f64 as map key type.
To avoid this complexity the ongoing BARE draft forbids their usage as
map key type. -
-
Allow leading and trailing pipes in unions
The following schema is now valid:
type LeadingPipe union { | u8 } type TrailingPipe union { u8 | }
-
Do not emit trailing spaces in code generation