Releases: tatethurston/TwirpScript
v0.0.51
What's Changed
- When using protobuf
map
fields, map keys are now typed as strings:Record<string, $SomeType>
. Previously other types were accepted, which would cause type checking to fail when the key wasboolean
,bigint
, ornumber
. This is also more correct because JavaScript always encodes object keys as strings. Generated type definitions formap
types are no longer exported. See #151 for more background. - Empty messages now generate the full serialization interface implemented by other messages. This resolves an issue where messages with fields whose value was an empty message would fail code generation.
- Enum serializers now have two private serialization helpers. This resolves an issue where Enums imported into other protobuf files failed code generation. See #150 for more background.
Full Changelog: v0.0.50...v0.0.51
v0.0.50
What's Changed
- Add
typescript.emitDeclarationOnly
only option. This will only emit TypeScript type definitions and not any runtime. See #147 for more context.
Full Changelog: v0.0.49...v0.0.50
v0.0.49
What's Changed
This version has 2 breaking changes that are unlikely to impact users:
- Enums are now represented by the enum value specified in
proto
instead of an integer. Eg: "FOO_BAR" instead of 0. This improves the developer experience when printing messages. This is a breaking change, but users using protobuf serialization should be unimpacted unless their code directly references enums via their integer value instead of the generated constants.
Eg:
// this code will now need to migrate to the string value instead of an integer
`if (foo.someEnum === 0)`
// this code will continue to work without change
`if (foo.someEnum === SomeEnum.Field)`
JSON serialization now also uses the enum value instead of an integer value, as described by the protobuf JSON specification. This is a breaking change for JSON clients.
- Bytes are now Base64 encoded when JSON serializing as described by the protobuf JSON specification above. This is a breaking change for JSON clients.
Full Changelog: v0.0.48...v0.0.49
v0.0.48
What's Changed
This version has the following bug fixes:
- Fix nested message definitions. Previously this would cause
"ReferenceError: Cannot access before initialization" error
. - Fix repeated int64 generation. The generated code would not compile for repeated bigint cases
- Fix bigint json serialization for
map
s - Fix comment escaping
- Fix reserved names for internal variables
Code generation for map
types are no longer inlined. This is an internal refactor that should not impact consumption, but there will be changes to generated .pb.ts
files the next time yarn twirpscript
runs.
Full Changelog: v0.0.47...v0.0.48
v0.0.47
What's Changed
- add json serialization customization options by @tatethurston in #131
See the README's configuration section for more context.
Full Changelog: v0.0.46...v0.0.47
v0.0.46
What's Changed
This version has 3 breaking changes:
- (Only impacts TypeScript users) The 'Service' naming suffix has been removed from the generated TypeScript types for services. Given the following proto:
service Haberdasher {
rpc MakeHat(Size) returns (Hat);
}
The generated service type will now be Haberdasher
instead of HaberdasherService
. This enables better out of the box compatibility with buf which expects all service names to end with Service
. Following this recommendation would generate TwirpScript types with 'ServiceService' suffixes.
<Service>Service => <Service>
- The 'Handler' suffix has been removed from the generated
create<Service>Handler
helper.
Given the proto above, the generated helper is now createHaberdasher
instead of createHaberdasherHandler
.
create<Service>Handler=> create<Service>
- (Only impacts TypeScript users)
optional
types now acceptnull
andundefined
. This enables better compatibility with other tools that may type optionals assome type | null
Changes:
- remove naming suffixes by @tatethurston in #125
- add exclude option to twirp.json by @tatethurston in #127
- add null to optional ts types by @tatethurston in #128
Full Changelog: v0.0.45...v0.0.46
v0.0.45
What's Changed
- no longer generate
_readMessageJSON
for empty messages - fix map types in
_readMessageJSON
Full Changelog: v0.0.43...v0.0.45
v0.0.44
What's Changed
This version has breaking changes between the generated code and the runtime. Run yarn twirspcript
to update your generated .pb.ts
when updating to this version.
TwirpScript now ships with JSON serializers and supports the json_name
option described here. This enables clients to specify custom JSON field names.
Breaking change: int64 types were previously encoded as strings, but are now encoded as bigint.
Changes:
- add json_name support by @tatethurston in #116
- use bigint for int64 types by @tatethurston in #118
Full Changelog: v0.0.43...v0.0.44
v0.0.43
v0.0.43
What's Changed
- fix repeated msg deserialization by @tatethurston in #112
Full Changelog: v0.0.42...v0.0.43
v0.0.42
What's Changed
- compact code generation for empty messages by @tatethurston in #101.
Full Changelog: v0.0.41...v0.0.42